Skip to main content

MCP servers

An MCP server gives the agent extra tools, resources, and prompts: access to library documentation, a database, an issue tracker, and other services. Servers are described in the mcp.json JSON file.

The agent connects the server itself

Write in the chat: "Connect the context7 MCP server". The agent adds an entry to mcp.json, and the server appears in the /mcp list.

Where servers are described​

LevelFile
Global~/.explyt/mcp.json
Project<project>/.explyt/mcp.json

Both files are optional. If they don't exist, the session simply starts without MCP servers.

The MCP files of Claude Code, Cursor, Codex and OpenCode are read only after you allow reading that agent's files, see Rules of other agents. They are read in place and never changed. ~/.config/mcp/mcp.json and ~/.agents/mcp.json are not read.

Legacy Explyt plugin files

If you used to configure MCP in the legacy Explyt plugin, its mcp_servers.json files in the same .explyt/ directories are read too, but read-only. Add new servers to mcp.json. If a server with the same name is in both files, the entry from mcp.json wins.

File format​

{
"mcpServers": {
"searxng": {
"command": "npx",
"args": ["-y", "mcp-searxng"],
"env": { "SEARXNG_URL": "${SEARXNG_URL}" }
},
"docs": {
"url": "https://mcp.example.com/sse",
"headers": { "Authorization": "Bearer ${DOCS_TOKEN}" }
}
}
}

The key is the server name. A local (stdio) server is set with the command field, a remote (HTTP) one with the url field.

FieldTypePurpose
commandstringthe executable of a local server
argsarray of stringscommand arguments
envobject of stringsenvironment variables of the server process
cwdstringworking directory of the server process
urlstringthe HTTP server address
headersobject of stringsheaders of every request
disabledbooleantrue keeps the description but doesn't start the server
excludeToolsarray of stringsserver tools that are not shown to the model
rootsbooleanfalse stops sending the project folder to the server as its root; on by default
auth{ "provider": "<id>" }send the key saved with /login for the given model provider as a Bearer token. Global file only

An entry with a field of the wrong type is skipped with a warning, and the other servers load. If the file isn't valid JSON, no servers load from it, and the agent reports an error.

Every server receives the project folder as its MCP root. A server that must keep its own folders, such as the official filesystem server, needs "roots": false.

Secrets and environment variables​

Don't write tokens into the file; refer to environment variables instead. Three forms are supported in any string of an entry: ${NAME}, $env:NAME and {env:NAME}. For example, "Bearer ${DOCS_TOKEN}". ${NAME:-default} uses default when the variable isn't set.

If a variable isn't set, the agent reports it for that server and passes the text as is.

warning

Treat a project mcp.json like project code. Through ${VAR} it can send the value of an environment variable to any address it names. Don't add servers that send secrets to an unchecked URL. The auth field doesn't work in a project file: such a server doesn't start, so that model provider keys don't leak to a foreign address.

Approving project servers​

A server from a project file (<project>/.explyt/mcp.json or another agent's project file) doesn't start until you approve it. When the session starts, the agent lists such servers and asks which of them to run in this project. Unchecked servers are denied for this project. In the terminal, /mcp lets you change the answer: a allows a server, d denies it.

The global setting mcp.projectServers in ~/.explyt/settings.json sets what happens to a project server without an answer:

ValueWithout an answer
ask (default)you are asked; the server doesn't start until you approve it
allowthe server starts without a question
denythe server doesn't start, and nobody is asked

In bypassPermissions and afk modes, in non-interactive runs and in subagents there is no question, and project servers without an answer stay off.

One server in two files​

An entry in the project file completely replaces the global entry with the same name: individual fields are not inherited. To change one field for one project, repeat the whole entry.

Turn off a server​

Add "disabled": true:

{ "mcpServers": { "docs": { "url": "https://mcp.example.com/sse", "disabled": true } } }

The description stays in the file, and you can turn the server back on without entering it again.

Hide individual tools​

List the tools in excludeTools:

{ "mcpServers": { "docs": { "url": "…", "excludeTools": ["delete_page", "admin_*"] } } }

Both the tool name (delete_page) and the name with the server prefix (docs_delete_page) match. The * and ? wildcards are supported.

The /mcp command​

The /mcp command in the terminal shows the servers, their status and tools. In it you can turn a server or an individual tool on or off; the command writes the same disabled and excludeTools fields. For another agent's servers it saves the switches in otherAgents.mcpOverrides in settings.json and leaves that agent's files unchanged.

When changes take effect​

The configuration is read once at session start. Editing the file doesn't affect a session that is already running: start a new one or apply the changes through /mcp, which restarts MCP itself.

A server that failed to connect doesn't break the session: it stays in the list with an error status, and the other servers keep working. What servers write to their log is saved in mcp.log in the agent directory (~/.local/share/explyt-ai-agent/agent/mcp.log): look there when a server doesn't start.