2.4 KiB
2.4 KiB
How to Configure MCP Tools in nanobot
This guide adds an MCP server to nanobot so the agent can use external tools through the Model Context Protocol.
What you will build
- a working nanobot agent
- one MCP integration configured through Apps or
~/.nanobot/config.json - a restricted set of MCP tools exposed to the model
When to use this
Use MCP when the capability you need already exists as an MCP server, or when you want external tools to be managed outside nanobot core.
Install
python -m pip install nanobot-ai
nanobot onboard --wizard
nanobot agent -m "Hello!"
Install the MCP server runtime separately. Many examples use npx, uvx, or a
remote HTTP endpoint.
Minimal working example
For local interactive setup:
- Run
nanobot webuiand open Apps. - Choose a known integration preset, or add a custom stdio, HTTP, or SSE server.
- Limit the enabled tools when the server exposes more than the task needs.
- Save and restart when prompted.
- Mention the integration with
@in the next message and ask for a small test action.
For manual or deployment-managed config, add this to ~/.nanobot/config.json:
{
"tools": {
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"],
"enabledTools": ["read_file"]
}
}
}
}
Restart nanobot and ask a question that requires the MCP tool.
Production notes
- Prefer
enabledToolsover exposing every tool by default. - Use
toolTimeoutfor slow MCP operations. - Use HTTP MCP only for endpoints you trust.
- Keep MCP server commands stable and versioned in deployment docs or scripts.
Security notes
- Stdio MCP starts a local process; review the command before enabling it.
- HTTP/SSE MCP uses nanobot's SSRF guard.
- Allow private HTTP MCP hosts only with narrow
tools.ssrfWhitelistCIDRs. - Do not place secrets in command arguments when environment variables or headers can be used.
Troubleshooting
- Run the MCP command outside nanobot first.
- Start
nanobot gateway --verboseand inspect tool registration logs. - If an HTTP MCP URL is blocked, check whether it points to loopback or a private address that needs explicit allowlisting.