Skip to content

M31A implements the Model Context Protocol so external servers can contribute tools, resources, and prompts to the agent. Client lifecycle management lives in packages/core/src/tools/mcp-client-manager.ts.

Add a server from the CLI ​

bash
m31a mcp add myserver npx -y @example/mcp-server
m31a mcp add myserver https://example.com/mcp
m31a mcp list
m31a mcp enable myserver
m31a mcp disable myserver
m31a mcp remove myserver

mcp add accepts either a command with arguments or a URL. Connections may use stdio or HTTP transports; the compliance transport layer normalizes behavior across implementations.

Configure servers in settings ​

json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
      "timeout": 30000
    }
  },
  "mcp": {
    "allowed": ["filesystem"],
    "excluded": []
  }
}

Server definitions can also come from extensions. mcp.serverCommand sets a default launch command, while mcp.allowed and mcp.excluded filter which servers are active.

In-app management ​

Use /mcp with subcommands:

  • /mcp auth — authenticate a server (OAuth flows supported),
  • /mcp list (aliases ls, nodesc) — show servers and status,
  • /mcp desc (description) — show server descriptions,
  • /mcp schema — inspect tool schemas,
  • /mcp reload — reconnect,
  • /mcp enable / /mcp disable — toggle a server.

Tools from MCP servers appear with a server-name prefix. Resources are exposed through list_mcp_resources and read_mcp_resource. Prompts from servers are loaded as slash commands by McpPromptLoader.

Authentication ​

OAuth and token handling is implemented in packages/core/src/mcp/: auth-provider.ts, oauth-provider.ts, oauth-token-storage.ts, and stored-token-provider.ts. Tokens are stored locally, not in workspace files.

Security controls ​

  • --allowed-mcp-server-names restricts servers for a single invocation.
  • mcp.allowed and mcp.excluded provide persistent filtering.
  • Admin settings under admin.mcp can enforce organization policy.
  • Only trust MCP servers from sources you control; servers can execute code and contribute tool definitions to the model.

Troubleshooting ​

SymptomResolution
Server not listedCheck mcp list, enablement state, and allowlists.
Connection failsVerify the command is on PATH and the URL is reachable.
Tool name unclearUse /mcp schema or /tools desc.
OAuth loopRe-run /mcp auth and clear stale stored tokens.

Next steps ​

See Skills and Hooks for other extension points.

Built with VitePress. Powered by NVIDIA NIM.