Skip to main content
Glama
ghassenTn

Cordyceps Search

by ghassenTn

๐Ÿฆ  Cordyceps Search

Cordyceps Search is a high-performance codebase semantic search, dependency tracking, and AST-aware refactoring engine. It is packaged as an MCP (Model Context Protocol) server designed to empower developer agents with the structural understanding and refactoring capabilities of a mature IDE.

By combining the blazing speed of a Rust-native CSR (Compressed Sparse Row) graph engine with the precision of tree-sitter AST parsers, Cordyceps Search enables instant semantic discovery, caller/callee blast radius auditing, and cross-file refactoring.


๐Ÿš€ Key Features

  • Zero-Copy CSR Graph Engine: Backed by a high-performance Rust core (engramdb) for microsecond-level graph traversals and memory efficiency.

  • Multi-Language AST Parsing: Full structural extraction (classes, methods, functions, calls, returns, docstrings) for Python, JavaScript, JSX, TypeScript, and TSX using tree-sitter.

  • Cross-Boundary API Tracking: Traces connections between frontend HTTP requests (fetch, axios) and backend endpoints (Django, Flask, FastAPI).

  • AST-Aware Safe Refactoring: Supports syntax-validated node edits, structured node creation, and AST-aware renaming with cross-file reference propagation.

  • Watchdog-Driven Real-Time Sync: Automatically detects file additions, modifications, and deletions in the workspace, debouncing events, and keeping the code graph dynamically updated.

  • Thread-Safe RW Concurrency: Protected by a read-write lock mechanism to ensure safe multi-threaded reads while keeping the unsendable Rust engine execution serial.


Related MCP server: OmniWeave

Supported Languages

Indexed via tree-sitter. Adding a language = drop a YAML config in src/database/parser/languages/ โ€” no code changes required. Other files are ingested as body-only File nodes (searchable, no AST).

Language

Extensions

Parser

Notes

Python

.py

tree_sitter_python

Full contextual resolution โ€” imports/aliases, lexical scopes, receiver types, self/cls/super() MRO, shadowed locals, union annotations

JavaScript

.js

tree_sitter_javascript

Functions, classes, calls, imports/exports, routes, HTTP calls

JavaScript (JSX)

.jsx

tree_sitter_javascript

Same as JS + JSX components

TypeScript

.ts

tree_sitter_typescript

Types, interfaces, generics, inheritance

TypeScript (TSX)

.tsx

tree_sitter_typescript

Same as TS + JSX/TSX components

Body-only file nodes (no AST, searchable as files): .json, .md, .html, .css, .yml, .yaml, .toml, .txt, .sql.

Excluded from indexing: node_modules, venv, .venv, __pycache__, target, dist, build, migrations, .git, .idea, .vscode, coverage, .next, .nuxt, fixtures, test_fixtures, test_data and any dotfile dirs. Extend via CORDYCEPS_EXCLUDE env var (comma-separated).


๐Ÿ—๏ธ Architecture

alt text

  • main.py: The stdio transport server entrypoint using FastMCP.

  • src/database/: Core client interface wrapping the Rust engine, managing Django ORM/URL resolutions, and enforcing read-write thread safety.

  • src/database/parser/: Language-specific grammar configurations and the UniversalCodeParser that walks tree-sitter ASTs.

  • src/watcher/: File system events monitor built on watchdog to coordinate incremental rebuilds.

  • src/services/: Logical business operations supporting graph queries, fuzzy searches, and AST modification edits.


Getting Started

Prerequisites

  • Python >= 3.11

  • uv (Fast Python Package Installer)

  • Rust toolchain (only for local engramedb development)

Installation

git clone https://github.com/ghassenTn/cordyceps_mcp.git
cd cordyceps_mcp
uv sync --python 3.11

This installs engramedb from PyPI as declared in pyproject.toml. No local engine checkout required for normal use.

Local Development (engine + MCP)

For editable installs where MCP uses a sibling engramedb checkout:

git clone https://github.com/ghassenTn/cordyceps_mcp.git
git clone https://github.com/ghassenTn/engramedb.git
# layout: cordyceps_mcp/  ../engramedb/
cd cordyceps_mcp
uv sync --python 3.11  # uses [tool.uv.sources] path = "../engramedb"

Engine development:

cd ../engramedb
maturin develop --release

๐Ÿ“‚ Command Guide

Run the following commands using the uv toolchain:

Command

Description

uv run python main.py [workspace_path]

Starts the MCP server (stdio transport). Defaults to current directory.

uv run python -m pytest

Runs the full test suite (89 tests passing).

uv run python -m pytest -m unit

Runs only parser and YAML serialization unit tests.

uv run python -m pytest -m integration

Runs graph database and editor integration tests.

uv run python -m pytest -xvs test_ast_parser.py

Fast feedback loop for debugging parser tests.


MCP Tools Provided

The server exposes a single unified tool. Legacy standalone tools (search_nodes, analyse_impact, trace_business_flow, etc.) were removed โ€” all capabilities are now via the query DSL.

query_dsl โ€” Unified Code Graph Query

Executes a Cordyceps Query DSL string against the live CSR graph. All outputs are YAML.

Parameters

  • raw (str, required): DSL query string

  • expand_body (bool, default false): when true returns full body, otherwise body_preview (150 chars)

query_dsl_help returns the full DSL grammar.

DSL quick reference

Query

Example

Purpose

GET

GET functions WHERE name LIKE 'create_*' LIMIT 20

Filtered listing with projections, ORDER BY, LIMIT/OFFSET

SEARCH

SEARCH "sale" IN functions WHERE file_path CONTAINS 'sales'

Fuzzy / regex search

GLOB

GLOB "src/modules/sales/*.py"

File glob

METADATA

METADATA FOR "src/api.py:create_sale"

Full node metadata + callers/callees

IMPACT

IMPACT OF "src/services.py:create_sale" DIRECTION callers DEPTH 2

Blast radius (callers/callees)

PATH

PATH FROM "a.py:foo" TO "b.py:bar"

Shortest dependency path

FLOW

FLOW FOR "src/api.py:create_sale" DEPTH 5

Business-flow tree

STACK

STACK FOR "/api/sales"

Frontend hook โ†’ backend handler trace

STATS

STATS FOR "src/modules/sales"

Module stats (LOC, counts)

CHECK LAYERS

CHECK LAYERS "domain" AGAINST "infra"

Architecture layer violation check

All legacy search / impact / flow / full-stack capabilities are available through query_dsl with the appropriate verb โ€” see query_dsl_help for the complete command reference.


IDE Integration (example kiro ide)

{
  "mcpServers": {
    "cordyceps": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/cordyceps_mcp",
        "run",
        "--python",
        "3.11",
        "python",
        "/path/to/cordyceps_mcp/main.py",
        "/path/to/your workspace"
      ],
      "autoApprove": [
        "query_dsl"
      ]
    }

  }
}

๐Ÿงช Testing

The test coverage covers parsing, synchronization safety, and graph queries. To run tests, use:

uv run python -m pytest

All tests use pytest fixtures defined in conftest.py with custom thread-safety and environment isolated markers.


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Supercharges AI coding agents with a pre-indexed semantic code graph, enabling instant symbol relationships, impact analysis, and context retrieval across 20+ languages.
    113,765
    69,062
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    A high-performance, polyglot code-analysis graph for coding agents that enables cross-language and cross-process code relationship queries in sub-millisecond time.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides semantic code search and code insights via a knowledge graph, enabling AI to understand, navigate, and modify complex projects with deep dependency and architecture analysis.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables LLM agents to efficiently understand and navigate a codebase by providing semantic search over symbols and a reference graph, replacing expensive grep/glob calls with structured tools like definition lookup, caller/callee queries, and change-impact analysis.
    1
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ghassenTn/cordyceps_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server