MCP¶
nanocode can connect to Model Context Protocol servers and
call their tools through its MCP tool. Servers can be remote (HTTP) or local
(stdio), and nothing about a server reaches the model until you connect
it.
Configuring servers¶
Each server is an [mcp.<name>] block.
Remote (HTTP)¶
[mcp.example]
url = "https://example.com/mcp"
bearer_token_env_var = "EXAMPLE_MCP_TOKEN" # optional: send a bearer token from this env var
# auth = "oauth" # optional: use interactive OAuth instead
# auto_connect = true # optional: connect at startup (default false)
Local (stdio)¶
[mcp.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
# env = { FOO = "bar" } # optional extra environment variables
# auto_connect = true
Options¶
Key |
Applies to |
Meaning |
|---|---|---|
|
remote |
Server endpoint (mutually exclusive with |
|
local |
Program and arguments to launch |
|
local |
Extra environment variables for the subprocess |
|
remote |
Authenticate via interactive OAuth |
|
remote |
Send |
|
remote |
Map of HTTP header → env var holding its value |
|
both |
Connect at startup instead of on demand (default |
Connecting¶
Servers are manual by default — they stay inactive,
and cost nothing, until you connect them. Set auto_connect = true for servers you always
want. Ways to connect:
/mcp— open the interactive manager and toggle a server on or off.
The /mcp interactive server manager.¶
@serverin a message — connect on demand. The connection remains active until you disconnect it.
Connecting a server on demand with an @-mention.¶
/mcp connect <server> [server ...]//mcp disconnect <server>— terminal fallbacks./mcp tools [server]— list the tools of connected servers.
Connecting several servers in one command runs them concurrently; interactive OAuth browser flows are serialized so they do not interfere with each other.
Once a server is connected, nanocode can use its tools like any other. Tools the server marks read-only run without a prompt; anything that may change state asks for confirmation first.
Authentication¶
Bearer token — set
bearer_token_env_var(or a custom header viaenv_http_headers).OAuth — set
auth = "oauth". Connecting runs the authorization flow; disconnecting clears the saved login.
Trust
Local (stdio) servers run programs on your machine, and remote servers receive whatever the agent sends them. Only connect servers you trust.