MCP integration

Ninja supports the Model Context Protocol. Connected servers expose extra tools the agent can call (with the same confirmation flow as other non-shell tools).

Config locations

Scope Path
Global (Linux) ~/.config/ninja/mcp_config.json
Global (macOS) ~/Library/Application Support/ninja/mcp_config.json
Global (Windows) %APPDATA%\ninja\mcp_config.json
Project .ninja/mcp_config.json

Example

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed"]
    },
    "my-tools": {
      "command": "npx",
      "args": ["-y", "my-mcp-server"],
      "env": {
        "MY_API_TOKEN": "..."
      }
    }
  }
}
Field Meaning
command Program to start
args Arguments
env Environment for that process

Verify

ninja doctor

Doctor reports whether MCP servers connected. A single bad server is usually a warning; Ninja still starts.

Safety tips

  • Prefer narrow scopes (limited filesystem roots, least-privilege tokens).
  • Store secrets in env or the process environment — not in chat.
  • MCP tools still need your approval when they change things (unless you auto-approve).