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
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 myservermcp 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
{
"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(aliasesls,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-namesrestricts servers for a single invocation.mcp.allowedandmcp.excludedprovide persistent filtering.- Admin settings under
admin.mcpcan enforce organization policy. - Only trust MCP servers from sources you control; servers can execute code and contribute tool definitions to the model.
Troubleshooting
| Symptom | Resolution |
|---|---|
| Server not listed | Check mcp list, enablement state, and allowlists. |
| Connection fails | Verify the command is on PATH and the URL is reachable. |
| Tool name unclear | Use /mcp schema or /tools desc. |
| OAuth loop | Re-run /mcp auth and clear stale stored tokens. |