|
8 | 8 |
|
9 | 9 | > **Stop grepping for concepts. Start searching for meaning.** |
10 | 10 |
|
11 | | -**opencode-codebase-index** brings semantic understanding to your [OpenCode](https://opencode.ai) workflow. Instead of guessing function names or grepping for keywords, ask your codebase questions in plain English. |
| 11 | +**opencode-codebase-index** brings semantic understanding to your [OpenCode](https://opencode.ai) workflow — and now to any MCP-compatible client like Cursor, Claude Code, and Windsurf. Instead of guessing function names or grepping for keywords, ask your codebase questions in plain English. |
12 | 12 |
|
13 | 13 | ## 🚀 Why Use This? |
14 | 14 |
|
15 | 15 | - 🧠 **Semantic Search**: Finds "user authentication" logic even if the function is named `check_creds`. |
16 | 16 | - ⚡ **Blazing Fast Indexing**: Powered by a Rust native module using `tree-sitter` and `usearch`. Incremental updates take milliseconds. |
17 | 17 | - 🌿 **Branch-Aware**: Seamlessly handles git branch switches — reuses embeddings, filters stale results. |
18 | 18 | - 🔒 **Privacy Focused**: Your vector index is stored locally in your project. |
19 | | -- 🔌 **Model Agnostic**: Works out-of-the-box with GitHub Copilot, OpenAI, Gemini, or local Ollama models. |
| 19 | + 🔌 **Model Agnostic**: Works out-of-the-box with GitHub Copilot, OpenAI, Gemini, or local Ollama models. |
| 20 | + 🌐 **MCP Server**: Use with Cursor, Claude Code, Windsurf, or any MCP-compatible client — index once, search from anywhere. |
20 | 21 |
|
21 | 22 | ## ⚡ Quick Start |
22 | 23 |
|
|
39 | 40 | Ask: |
40 | 41 | > "Find the function that handles credit card validation errors" |
41 | 42 |
|
| 43 | +## 🌐 MCP Server (Cursor, Claude Code, Windsurf, etc.) |
| 44 | + |
| 45 | +Use the same semantic search from any MCP-compatible client. Index once, search from anywhere. |
| 46 | + |
| 47 | +1. **Install dependencies** |
| 48 | + ```bash |
| 49 | + npm install opencode-codebase-index @modelcontextprotocol/sdk zod |
| 50 | + ``` |
| 51 | + |
| 52 | +2. **Configure your MCP client** |
| 53 | + |
| 54 | + **Cursor** (`.cursor/mcp.json`): |
| 55 | + ```json |
| 56 | + { |
| 57 | + "mcpServers": { |
| 58 | + "codebase-index": { |
| 59 | + "command": "npx", |
| 60 | + "args": ["opencode-codebase-index-mcp", "--project", "/path/to/your/project"] |
| 61 | + } |
| 62 | + } |
| 63 | + } |
| 64 | + ``` |
| 65 | + |
| 66 | + **Claude Code** (`claude_desktop_config.json`): |
| 67 | + ```json |
| 68 | + { |
| 69 | + "mcpServers": { |
| 70 | + "codebase-index": { |
| 71 | + "command": "npx", |
| 72 | + "args": ["opencode-codebase-index-mcp", "--project", "/path/to/your/project"] |
| 73 | + } |
| 74 | + } |
| 75 | + } |
| 76 | + ``` |
| 77 | + |
| 78 | +3. **CLI options** |
| 79 | + ```bash |
| 80 | + npx opencode-codebase-index-mcp --project /path/to/repo # specify project root |
| 81 | + npx opencode-codebase-index-mcp --config /path/to/config # custom config file |
| 82 | + npx opencode-codebase-index-mcp # uses current directory |
| 83 | + ``` |
| 84 | + |
| 85 | +The MCP server exposes all 8 tools (`codebase_search`, `codebase_peek`, `find_similar`, `index_codebase`, `index_status`, `index_health_check`, `index_metrics`, `index_logs`) and 4 prompts (`search`, `find`, `index`, `status`). |
| 86 | + |
| 87 | +The MCP dependencies (`@modelcontextprotocol/sdk`, `zod`) are optional peer dependencies — they're only needed if you use the MCP server. |
| 88 | + |
42 | 89 | ## 🔍 See It In Action |
43 | 90 |
|
44 | 91 | **Scenario**: You're new to a codebase and need to fix a bug in the payment flow. |
@@ -494,6 +541,8 @@ CI will automatically run tests and type checking on your PR. |
494 | 541 | ``` |
495 | 542 | ├── src/ |
496 | 543 | │ ├── index.ts # Plugin entry point |
| 544 | +│ ├── mcp-server.ts # MCP server (Cursor, Claude Code, Windsurf) |
| 545 | +│ ├── cli.ts # CLI entry for MCP stdio transport |
497 | 546 | │ ├── config/ # Configuration schema |
498 | 547 | │ ├── embeddings/ # Provider detection and API calls |
499 | 548 | │ ├── indexer/ # Core indexing logic + inverted index |
|
0 commit comments