codexray

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.

Category
Visit Server

README

codexray πŸ”¦

X-ray vision for your codebase β€” a fast C++ symbol indexer exposed as an MCP server for AI coding agents.

CI License: MIT C++17 Python

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 tagged function, not method
  • Macros can confuse brace matching; templates only partially understood
  • References are identifier-level, not resolved across scopes/overloads
  • No incremental re-index yet (index_repository rebuilds)

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured