Skip to directory

CodeGraphContext MCP

CodeGraphContext / Shashank Shekhar Singh (community-maintained)

stdio25+ documented tools11

About CodeGraphContext MCP

A community-maintained local MCP server that indexes source repositories into a graph so an assistant can query symbols, calls, dependencies, complexity, and other code relationships.

What you can use it for

  • Search indexed source code
  • Trace callers/callees and code relationships
  • Review complexity and potential dead code
  • Inspect graph/index jobs and repository metadata
Connection and setup
Hosting
Local stdio process; optional external graph database
Transport
stdio
Endpoint
Local process; no hosted endpoint documented
Authentication
No authentication is required for the default embedded database. If configuring an external Neo4j database, credentials are stored by the setup flow in ~/.codegraphcontext/.env; do not put them in the MCP record or chat.

Requirements

  • Python 3.10 or later and pip, or the documented Docker image.
  • The default setup uses an embedded graph database; optional backends have their own platform requirements.
  • Git is optional for cloning/indexing additional repositories.

Setup steps

  1. Install the maintainer-published package with pip install codegraphcontext.
  2. Run codegraphcontext --help to confirm the CLI installation, then run codegraphcontext mcp setup and select the supported MCP client. The wizard stores database credentials in ~/.codegraphcontext/.env and writes client configuration.
  3. Start the server with codegraphcontext mcp start. If configuring manually, use command codegraphcontext and args [mcp, start].
  4. Index a project before querying its code graph. The repository documents codegraphcontext index . for indexing the current directory.
  5. Reconnect the MCP client and inspect tools/list. The repository documents that indexed paths are sandboxed to the process working directory and CGC_ALLOWED_ROOTS unless the sandbox is explicitly disabled.
Tools 25+

The repository MCP_TOOLS.md enumerates 25 tools for version 0.4.16; the current README identifies version 0.5.1 and another getting-started page reports 21 tools. The 25 names below are a documented inventory, not an observed tools/list result; see source_conflicts.

  • discover_codegraph_contexts

    Find indexed CodeGraphContext databases below a directory.

    Parameters: path, max_depth
    01
  • switch_context

    Select a CodeGraphContext database for the session.

    Parameters: context_path, save
    02
  • add_code_to_graph

    Index a local directory into the graph.

    Parameters: path, is_dependency
    03
  • add_package_to_graph

    Index an installed dependency package.

    Parameters: package_name, language, is_dependency
    04
  • list_indexed_repositories

    List repositories currently indexed in the graph.

    05
  • delete_repository

    Remove an indexed repository from the graph.

    Parameters: repo_path
    06
  • get_repository_stats

    Get file, function, class, and module counts.

    Parameters: repo_path
    07
  • find_code

    Search indexed symbols and content.

    Parameters: query, fuzzy_search, edit_distance, repo_path
    08
  • analyze_code_relationships

    Query callers, callees, imports, hierarchy, and related code.

    Parameters: query_type, target, context, repo_path
    09
  • find_dead_code

    Find candidate unused functions.

    Parameters: exclude_decorated_with, repo_path
    10
  • calculate_cyclomatic_complexity

    Calculate complexity for a function.

    Parameters: function_name, path, repo_path
    11
  • find_most_complex_functions

    Rank functions by cyclomatic complexity.

    Parameters: limit, repo_path
    12
  • load_bundle

    Load a CodeGraphContext bundle.

    Parameters: bundle_name, clear_existing
    13
  • search_registry_bundles

    Search the public bundle registry.

    Parameters: query, unique_only
    14
  • watch_directory

    Index and monitor a directory for changes.

    Parameters: path
    15
  • list_watched_paths

    List active directory watch roots.

    16
  • unwatch_directory

    Stop monitoring a directory.

    Parameters: path
    17
  • list_jobs

    List background indexing and scan jobs.

    18
  • check_job_status

    Check the status of an indexing job.

    Parameters: job_id
    19
  • execute_cypher_query

    Run read-only Cypher against the active graph backend.

    Parameters: cypher_query
    20
  • visualize_graph_query

    Build a graph-browser URL for a query.

    Parameters: cypher_query
    21
  • generate_report

    Generate a Markdown code graph audit report.

    Parameters: output_path, include_java
    22
  • find_java_spring_endpoints

    List indexed Spring HTTP endpoints.

    Parameters: repo_path
    23
  • find_java_spring_beans

    List indexed Spring bean stereotypes.

    Parameters: stereotype, repo_path
    24
  • find_datasource_nodes

    Query indexed datasource architecture nodes.

    Parameters: kind, name, include_columns
    25

This server’s available tools can vary by account, permissions, or configuration. The list shown is not its full runtime catalog.

Limitations and notes
  • The server only has useful repository context after a codebase is indexed.
  • Indexing, watching, bundle loading, context switching, and repository deletion can change local graph/index state; only read-only discovery/search tools are suitable for harmless checks.
  • Path access is sandboxed by default to the process working directory and CGC_ALLOWED_ROOTS.
  • The current README and tool documentation disagree on version/tool inventory; do not label a count exact until tools/list is observed.
  • This is a community project and is not an official GitHub, IDE-vendor, or language-vendor integration.
  • No MCP initialize, tools/list, or representative tool call was performed for this catalog entry.
Source discrepancies
  • The repository’s current README states version 0.5.1, while docs/MCP_TOOLS.md describes version 0.4.16 and 25 tools; a getting-started MCP page also reports 21 tools. The documentation inventory is therefore partial/version-sensitive.
Original sources
  • maintainer documentation

    Project source documents graph indexing, code search, analysis, and repository management tools.

Documentation checked 2026-10-28T00:00:00Z. Connection has not been runtime tested.