Navegador

navegador / docs / guide / mcp-integration.md
1
# MCP Integration
2
3
Navegador ships a built-in [Model Context Protocol](https://modelcontextprotocol.io) server. When running in MCP mode, all navegador commands become callable tools that agents can invoke with structured input and receive structured output.
4
5
---
6
7
## CLI vs MCP: when to use which
8
9
The primary interface for agents is the **CLI**, not MCP. Here's why:
10
11
| | CLI | MCP |
12
|---|---|---|
13
| Token cost | Low — agent calls a shell tool, gets back only what it asked for | Higher — MCP tool calls involve protocol overhead |
14
| Setup | None beyond installing navegador | Requires MCP config in agent settings |
15
| Best for | Agent hooks, shell scripts, CI | Interactive sessions in Claude / Cursor |
16
| Output formats | JSON, markdown, rich terminal | Structured JSON always |
17
18
Use **MCP** when you want navegador tools available as first-class tool calls in an interactive Claude or Cursor session. Use the **CLI** (via agent hooks) for automated background sync and pre-edit context loading.
19
20
---
21
22
## Starting the MCP server
23
24
```bash
25
navegador mcp
26
```
27
28
With a custom database path:
29
30
```bash
31
navegador mcp --db .navegador/navegador.db
32
```
33
34
The server speaks MCP over stdio. It does not bind a port.
35
36
---
37
38
## Agent configuration
39
40
=== "Claude Code"
41
42
Add to your project's `.claude/settings.json`:
43
44
```json
45
{
46
"mcpServers": {
47
"navegador": {
48
"command": "navegador",
49
"args": ["mcp"],
50
"env": {
51
"NAVEGADOR_DB": ".navegador/navegador.db"
52
}
53
}
54
}
55
}
56
```
57
58
=== "Claude Desktop"
59
60
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
61
62
```json
63
{
64
"mcpServers": {
65
"navegador": {
66
"command": "navegador",
67
"args": ["mcp", "--db", "/path/to/project/.navegador/navegador.db"]
68
}
69
}
70
}
71
```
72
73
=== "Cursor"
74
75
Add to `.cursor/mcp.json` in your project root:
76
77
```json
78
{
79
"mcpServers": {
80
"navegador": {
81
"command": "navegador",
82
"args": ["mcp"],
83
"env": {
84
"NAVEGADOR_DB": ".navegador/navegador.db"
85
}
86
}
87
}
88
}
89
```
90
91
---
92
93
## Available MCP tools
94
95
All tools accept and return JSON. There are 11 tools in total.
96
97
| Tool | Equivalent CLI | Description |
98
|---|---|---|
99
| `ingest` | `navegador ingest` | Ingest a repo into the graph |
100
| `context` | `navegador context` | File-level context bundle |
101
| `function` | `navegador function` | Function with call graph |
102
| `class` | `navegador class` | Class with hierarchy |
103
| `explain` | `navegador explain` | Universal node lookup |
104
| `search` | `navegador search` | Text search across graph |
105
| `query` | `navegador query` | Raw Cypher passthrough |
106
| `get_rationale` | `navegador explain --rationale` | Decisions and rules governing a node |
107
| `find_owners` | `navegador codeowners` | People and domains that own a node |
108
| `search_knowledge` | `navegador search --knowledge` | Search knowledge layer only |
109
| `blast_radius` | `navegador impact` | Transitive impact set for a node |
110
111
### Tool input schemas
112
113
**ingest**
114
```json
115
{ "path": "./repo", "clear": false }
116
```
117
118
**context**
119
```json
120
{ "file": "src/auth/service.py", "format": "json" }
121
```
122
123
**function**
124
```json
125
{ "name": "validate_token", "file": "src/auth/service.py", "depth": 2 }
126
```
127
128
**class**
129
```json
130
{ "name": "PaymentProcessor", "file": "src/payments/processor.py" }
131
```
132
133
**explain**
134
```json
135
{ "name": "AuthService", "file": "src/auth/service.py" }
136
```
137
138
**search**
139
```json
140
{ "query": "rate limit", "all": true, "docs": false, "limit": 20 }
141
```
142
143
**query**
144
```json
145
{ "cypher": "MATCH (f:Function) RETURN f.name LIMIT 10" }
146
```
147
148
**get_rationale**
149
```json
150
{ "name": "process_payment", "file": "src/payments/processor.py" }
151
```
152
153
**find_owners**
154
```json
155
{ "name": "AuthService", "file": "src/auth/service.py" }
156
```
157
158
**search_knowledge**
159
```json
160
{ "query": "idempotency", "limit": 10 }
161
```
162
163
**blast_radius**
164
```json
165
{ "name": "validate_token", "depth": 3 }
166
```
167
168
---
169
170
## Read-only mode
171
172
Start the MCP server in read-only mode to prevent agents from modifying the graph. This is recommended for shared or production environments.
173
174
```bash
175
navegador mcp --read-only
176
```
177
178
In read-only mode, the `ingest` tool is disabled and the `query` tool only accepts `MATCH`/`RETURN` queries. Write keywords (`CREATE`, `MERGE`, `SET`, `DELETE`) are rejected.
179
180
Set in agent config:
181
182
```json
183
{
184
"mcpServers": {
185
"navegador": {
186
"command": "navegador",
187
"args": ["mcp", "--read-only"],
188
"env": {
189
"NAVEGADOR_DB": ".navegador/navegador.db"
190
}
191
}
192
}
193
}
194
```
195
196
Or set `read_only = true` in `.navegador/config.toml` under `[mcp]`.
197
198
---
199
200
## Editor integration
201
202
Instead of configuring MCP manually, use the editor setup command:
203
204
```bash
205
navegador editor setup claude-code
206
navegador editor setup cursor
207
navegador editor setup codex
208
navegador editor setup windsurf
209
```
210
211
This writes the correct MCP config file for the selected editor and prompts for the database path.
212
213
---
214
215
## When MCP makes sense
216
217
- You are in an interactive Claude or Cursor session and want to call `explain`, `search`, or `function` without dropping to a terminal
218
- You want navegador tools auto-discovered by the agent without writing custom tool definitions
219
- You are building an agent workflow that dynamically queries the graph mid-task
220
221
For automated background tasks (re-ingest on file save, sync on pull), use the CLI via [agent hooks](agent-hooks.md) instead.
222

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button