Code Intelligence Plugin — integrate code-index-mcp for codebase understanding #85

Open
opened 2026-02-23 11:10:46 +00:00 by nazim · 0 comments
Contributor

Context

code-index-mcp is an MCP server that indexes codebases and exposes search/analysis tools to LLMs. It uses tree-sitter AST parsing for 7 languages (Python, JS/TS, Java, Go, Zig, ObjC), fallback for 50+, persistent caching, and file watching.

Why this matters for cobot

Cobot agents that work on code (review PRs, fix issues, refactor) currently rely on raw file reads and grep. A code intelligence layer would give them:

  • Symbol-level search — find where a function is defined/called, not just grep for a string
  • Structural understanding — class hierarchies, imports, method signatures, complexity metrics
  • Efficient context loading — instead of reading entire files, pull just the relevant symbols
  • Auto-refresh — file watcher keeps the index current as the agent makes changes

Integration approaches

Option A: MCP client in tools plugin

Add MCP client support to cobot's tools plugin. The agent could connect to any MCP server (code-index-mcp, or others) as a tool provider. This is the most general approach — code-index-mcp becomes just one of many MCP tools.

Pros: General-purpose, ecosystem-compatible, any MCP server works
Cons: MCP protocol overhead, another dependency (MCP client lib)

Option B: Dedicated code-intelligence plugin

Build a code_intel plugin that wraps code-index-mcp's core (tree-sitter parsing + indexing) directly as a cobot plugin, exposing capabilities like search_symbol, analyze_file, find_references as native cobot tools.

Pros: Tighter integration, no MCP protocol overhead, fits plugin architecture
Cons: More maintenance, tightly coupled to one implementation

Option C: Subprocess + stdio (lightest touch)

Launch code-index-mcp as a subprocess via uvx code-index-mcp and communicate over stdio/MCP protocol. No library integration needed.

Pros: Zero coupling, always latest version, trivial to set up
Cons: Process management, stdio parsing

Recommendation

Option A (MCP client) is the most forward-looking. MCP is becoming the standard for tool integration in the AI agent ecosystem. Adding MCP client support to cobot opens the door to code-index-mcp and dozens of other MCP servers (databases, APIs, browsers, etc.).

Option C is a good quick-win for prototyping.

Key features to expose

  1. set_project_path — point the indexer at a repo
  2. search_code — search across indexed files (uses ripgrep/ugrep under the hood)
  3. analyze_file — deep analysis of a single file (imports, classes, methods, complexity)
  4. find_symbol — locate function/class definitions and references
  5. list_files — filtered file listing with metadata

References

  • code-index-mcp README
  • MCP spec
  • Related: #49 (Activity Loop) — code intelligence feeds into autonomous code review/fix loops
  • Related: #53 (Dev Workflow) — sub-agents doing implementation need codebase understanding
## Context [code-index-mcp](https://github.com/johnhuang316/code-index-mcp) is an MCP server that indexes codebases and exposes search/analysis tools to LLMs. It uses tree-sitter AST parsing for 7 languages (Python, JS/TS, Java, Go, Zig, ObjC), fallback for 50+, persistent caching, and file watching. ## Why this matters for cobot Cobot agents that work on code (review PRs, fix issues, refactor) currently rely on raw file reads and grep. A code intelligence layer would give them: - **Symbol-level search** — find where a function is defined/called, not just grep for a string - **Structural understanding** — class hierarchies, imports, method signatures, complexity metrics - **Efficient context loading** — instead of reading entire files, pull just the relevant symbols - **Auto-refresh** — file watcher keeps the index current as the agent makes changes ## Integration approaches ### Option A: MCP client in tools plugin Add MCP client support to cobot's `tools` plugin. The agent could connect to any MCP server (code-index-mcp, or others) as a tool provider. This is the most general approach — code-index-mcp becomes just one of many MCP tools. **Pros:** General-purpose, ecosystem-compatible, any MCP server works **Cons:** MCP protocol overhead, another dependency (MCP client lib) ### Option B: Dedicated code-intelligence plugin Build a `code_intel` plugin that wraps code-index-mcp's core (tree-sitter parsing + indexing) directly as a cobot plugin, exposing capabilities like `search_symbol`, `analyze_file`, `find_references` as native cobot tools. **Pros:** Tighter integration, no MCP protocol overhead, fits plugin architecture **Cons:** More maintenance, tightly coupled to one implementation ### Option C: Subprocess + stdio (lightest touch) Launch code-index-mcp as a subprocess via `uvx code-index-mcp` and communicate over stdio/MCP protocol. No library integration needed. **Pros:** Zero coupling, always latest version, trivial to set up **Cons:** Process management, stdio parsing ## Recommendation **Option A (MCP client)** is the most forward-looking. MCP is becoming the standard for tool integration in the AI agent ecosystem. Adding MCP client support to cobot opens the door to code-index-mcp and dozens of other MCP servers (databases, APIs, browsers, etc.). Option C is a good quick-win for prototyping. ## Key features to expose 1. `set_project_path` — point the indexer at a repo 2. `search_code` — search across indexed files (uses ripgrep/ugrep under the hood) 3. `analyze_file` — deep analysis of a single file (imports, classes, methods, complexity) 4. `find_symbol` — locate function/class definitions and references 5. `list_files` — filtered file listing with metadata ## References - [code-index-mcp README](https://github.com/johnhuang316/code-index-mcp) - [MCP spec](https://modelcontextprotocol.io) - Related: #49 (Activity Loop) — code intelligence feeds into autonomous code review/fix loops - Related: #53 (Dev Workflow) — sub-agents doing implementation need codebase understanding
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot#85
No description provided.