codexray
Enables AI coding agents to quickly search and navigate large codebases by indexing symbols and references, offering tools for fuzzy symbol lookup, file outlining, and reference discovery without a language server.
README
codexray 🔦
X-ray vision for your codebase — a fast C++ symbol indexer exposed as an MCP server for AI coding agents.
Give your coding agent instant, whole-repo symbol awareness without running a language server:
$ codexray search conn --root ./myproject
950 method 42 onConnect src/net/server.cpp
870 function 18 connect_db src/db/pool.cpp
Why
AI agents working in large repos waste tokens grepping blindly or re-deriving structure.
codexray answers the three questions agents ask most, in milliseconds:
- "Where is this symbol?" → fuzzy
search_symbols - "What's in this file?" →
file_outline - "Where else is it used?" →
find_references
It speaks Model Context Protocol, so Claude Code, opencode, Cursor, Codex CLI, Windsurf and friends can use it as a tool — no plugins, no LSP server, no config soup.
Highlights
- ⚡ C++17 core, zero external dependencies — single translation unit, ~1100 LOC
- 🐍 Python interface via
ctypes(no pybind11 build headaches) - 🔌 MCP server out of the box (
codexray-mcp) - 🧭 Fuzzy search:
gret→Greeter,onConnect; exact > prefix > substring > subsequence scoring - 📚 5 languages today: C/C++, Python, JavaScript/TypeScript, Go, Rust
- 📖 References index: every identifier occurrence, definitions flagged
- 🪶 No daemon, no database — an index is just memory; rebuild is cheap
Measured on a laptop (AMD Ryzen): 25,395 system headers · 6.5M lines · 364k symbols · 9.8M references indexed in ~29 s (~225k lines/s), fuzzy search over all symbols in <100 ms.
Quickstart
Requires: a C++ compiler (g++ or clang++) and Python ≥ 3.10.
git clone https://github.com/akashmark8-cloud/codexray && cd codexray
make # builds build/libcodexray.so
pip install -e ".[dev]" # python package + mcp sdk
CLI
codexray stats --root path/to/repo # what got indexed
codexray search Widget --root path/to/repo # fuzzy symbol search
codexray outline src/main.rs # file outline
codexray refs main # references (defs flagged *)
codexray serve --root path/to/repo # run the MCP server (stdio)
Use it from your AI agent
Point any MCP client at codexray-mcp:
<details> <summary><b>Claude Code</b></summary>
claude mcp add codexray -- codexray-mcp --root /path/to/your/project
</details>
<details> <summary><b>opencode</b> — <code>~/.config/opencode/opencode.json</code></summary>
{
"mcp": {
"codexray": {
"type": "local",
"command": ["codexray-mcp", "--root", "/path/to/your/project"]
}
}
}
</details>
<details> <summary><b>Claude Desktop</b> — <code>claude_desktop_config.json</code></summary>
{
"mcpServers": {
"codexray": {
"command": "codexray-mcp",
"args": ["--root", "/path/to/your/project"]
}
}
}
</details>
Tools exposed: index_repository, search_symbols, file_outline,
find_references, get_index_stats.
Python API
from codexray import CodeIndex
idx = CodeIndex()
idx.add_tree("./myproject")
for hit in idx.search("connect", limit=5):
print(hit["kind"], hit["name"], f'{hit["path"]}:{hit["line"]}')
print(idx.outline("src/server.cpp"))
print(idx.references("Server"))
How it works
┌────────────────────────────┐ ┌──────────────────────────────┐
│ your repo │ │ AI agent (Claude Code, │
│ .cpp .py .ts .go .rs ... │ │ opencode, Cursor, Codex…) │
└─────────────┬──────────────┘ └──────────────▲───────────────┘
│ os.walk + read │ MCP (stdio)
┌─────────────▼──────────────┐ ┌──────────────┴───────────────┐
│ C++ core (libcodexray) │◀──ctypes│ Python layer │
│ • tokenizer (comments, │ │ • tree walker + excludes │
│ strings, raw strings) │ │ • CodeIndex high-level API │
│ • heuristic def scanner │ │ • FastMCP-style tool server │
│ • scope/end-line tracker │ └──────────────────────────────┘
│ • fuzzy scorer │
│ • JSON output │
└────────────────────────────┘
One pass per file builds two indexes: a symbol table (name, kind, span, signature) and a reference map (identifier → occurrences). Search scores candidates by exact / prefix / substring / word-boundary-subsequence match with gap penalties.
Project layout
src/cpp/codexray.h C API (usable from any FFI-capable language)
src/cpp/codexray.cpp the entire native core
src/codexray/_native.py ctypes bindings
src/codexray/index.py CodeIndex (tree walking, excludes, summaries)
src/codexray/server.py MCP server (5 tools)
src/codexray/cli.py command-line interface
tests/ pytest suite
examples/demo/ polyglot sample project
Status & roadmap
This is a young project — the parser is intentionally heuristic (fast, dependency-free) rather than a full AST. It handles real-world code well but not everything. Known limitations:
- Out-of-line C++ member definitions (
void Widget::set(...)) are taggedfunction, notmethod - Macros can confuse brace matching; templates only partially understood
- References are identifier-level, not resolved across scopes/overloads
- No incremental re-index yet (
index_repositoryrebuilds)
Ideas welcome — tree-sitter backends, watch-mode incremental updates, more languages, persisted indexes. Open an issue!
Development
make test # build + pytest
python -m pytest tests/ -v
License
MIT © 2026 akashmark8-cloud
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。