GNU TeXmacsUser manualReferenceAboutEnglish
Installing and connecting an agent

The server needs TeXmacs Upsilon (the option --mcp is not in the official TeXmacs), which you can download from mgubi.github.io/texmacs. To work on a file which is open in your TeXmacs, your TeXmacs and the agent's must be the same version of TeXmacs Upsilon. There is nothing to install besides it: the server is the program, started with the option --mcp. What you do is to tell your agent which command to run. The agent then starts TeXmacs by itself, when it needs it, and stops it when it is done.

The command on each platform
macOS

The program is the executable inside the application. For the Cocoa application it is

/Applications/TeXmacs Upsilon.app/Contents/MacOS/TeXmacs

(TeXmacs Upsilon Vue.app and TeXmacs Upsilon Qt.app for the other interfaces). The path has spaces: in a shell it must be quoted, in a configuration file it is a string. The option is added after it: --mcp.

Linux

The launcher texmacs of an installation, for instance /usr/bin/texmacs when it was installed in /usr, or TeXmacs/bin/texmacs in the folder of a build from the sources. If it is in the PATH, then texmacs --mcp is enough. The launcher keeps the standard input for --mcp, which the server needs. (The AppImage closes the standard input of the program, so that it cannot be used as a server.)

Windows

The server is not available yet: the standard input and output of the program are not connected on this platform.

Claude Code
claude mcp add texmacs -- texmacs --mcp

On macOS give the whole path of the program (quote it because of the spaces):

claude mcp add texmacs -- "/Applications/TeXmacs Upsilon.app/Contents/MacOS/TeXmacs" --mcp

Environment variables are added with -e, after the name of the server and before the --:

claude mcp add texmacs -e TEXMACS_MCP_ROOTS=$HOME/papers -- texmacs --mcp

By default claude mcp add registers the server for the current project folder only (the local scope): run it in the folder where you will use Claude Code, or add -s user to have the server in every project. Then start a new Claude Code session (or use /mcp in the running one). claude mcp list shows the server, and claude mcp remove texmacs removes it (in the same scope).

Claude Desktop

Open Settings\(\rightarrow\)Developer\(\rightarrow\)Edit Config (the file claude_desktop_config.json, on macOS in ~/Library/Application Support/Claude/), add the server and restart the application:

{
  "mcpServers": {
    "texmacs": {
      "command": "/Applications/TeXmacs Upsilon.app/Contents/MacOS/TeXmacs",
      "args": ["--mcp"],
      "env": { "TEXMACS_MCP_ROOTS": "/Users/you/papers" }
    }
  }
}
Another client

Any client of MCP which can start a program over standard input and output (the transport called stdio) will do: give it the command and the argument --mcp, and optionally the environment. The server speaks JSON-RPC, one message per line.

Environment variables
TEXMACS_MCP_ROOTS

The folders in which the agent may open files, separated by colons (/home/me/papers:/home/me/notes). Without it, the agent can open any file which you can read. Paths with .. are refused, and symbolic links are resolved before the check. This limits what the server opens, not what the other tools of the agent can do; see What an agent may not do.

TEXMACS_MCP_READONLY

If it is set (and is neither empty nor 0), the server does not offer the tools which change anything: replace, insert, delete, edit_text, undo_agent, withdraw_proposal, save_document, close_document and create_document.

TEXMACS_MCP_DEBUG

If it is set (to any value), the server also writes every message to the log.

TEXMACS_HOME_PATH

The folder of the user files of TeXmacs (see below).

The home folder and the log

The server uses the same home folder as the application: ~/.TeXmacs_Upsilon or the folder given by TEXMACS_HOME_PATH. Your preferences are read from there. Nothing which TeXmacs prints can disturb the protocol: everything goes to the file system/mcp.log of the home folder, which is renamed when it grows over 4 MB.

Checking that it works

In a terminal (here the launcher, on macOS the path of the program) send one message and read the answer; the server ends when its input ends:

echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1"}}}' | texmacs --mcp

The answer is a line with "serverInfo" and the name texmacs. In the agent, ask for the list of its tools (in Claude Code, /mcp), and then to list the open documents or to give the outline of one of your files.

Working on a file which you have open

To let the agent work on the document that you have open in TeXmacs, the files must be shared between the programs; see Working together with the agent.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".