Skip to main content
Glama
DeepakJangra239

Knowledge Graph MCP Server

kgraph 🧠

Knowledge Graph for Codebases

kgraph is a powerful Model Context Protocol (MCP) server that indexes your codebase into a knowledge graph, enabling semantic search, precise code navigation, and impact analysis for LLM agents.

Unlike simple text search or grep, kgraph understands the structure of your code—classes, functions, imports, and calls—allowing agents to answer complex questions like "Who calls this function?" or "What happens if I change this class?".

✨ Features

  • Semantic Search: Find code by meaning ("auth middleware") not just keywords. Uses LanceDB for vector search.

  • Precise Navigation: Jump to definitions and find references with 100% accuracy using Tree-sitter parsing.

  • Structure Analysis: Understand file outlines (classes, methods, hooks) instantly.

  • Impact Analysis: validate_edit tool checks for syntax errors and breaking changes before you apply edits.

  • React/TypeScript Support: First-class support for modern web frameworks (Components, Hooks, JSX).

  • Multi-Language: Supports Python, JavaScript, TypeScript, Java, and more.

Related MCP server: MCP Indexer

🚀 Installation

Prerequisites

  • Python 3.10 or higher

  • uv (recommended) or pip

# Install directly from source
uv tool install --force --editable .

Install with pip

pip install .

⚡ Quick Start

  1. Start the Server: Run the server using an MCP client (see below) or directly for testing:

    kgraph
  2. Index Your Codebase: The first time you use kgraph on a project, you must index it:

    • Use the reindex_codebase tool with the path to your project.

    • Example: reindex_codebase(root_path="/path/to/my/project")

🛠️ MCP Tools

kgraph exposes the following tools to MCP clients:

🔍 Search & Navigation

  • search_code(query, limit=5, file_type="")

    • Performs a hybrid search (Semantic + Keyword) to find relevant code snippets.

    • Great for: "Find the user authentication logic" or "Where is the payment processed?"

  • find_definitions(name)

    • Locates where a class, function, or component is defined.

    • Returns file path, line number, and docstring.

  • find_references(name)

    • Finds all usages of a symbol (calls, imports, inheritance).

    • Essential for refactoring and understanding dependencies.

📄 Code Understanding

  • get_structure(file_path)

    • Returns a structured outline of a file: imports, classes, functions, and methods.

    • Supports React components, hooks, and event handlers.

  • get_usage_context(symbol)

    • Retrieves a 360° view of a symbol: Definition + References + Outgoing Calls.

    • Optimized for LLMs to get full context in one shot.

  • get_file_summary(file_path)

    • Returns a token-efficient summary of a file (signatures and docstrings only).

🛡️ Validation

  • validate_edit(file_path, new_content)

    • Validates a proposed code edit before applying it.

    • Checks for:

      1. Syntax Errors: Ensures code is valid (supports JSX/TSX).

      2. Breaking Changes: Warns if you remove a function used by other files.

      3. Signature Changes: Warns if you change a function signature used elsewhere.

⚙️ Management

  • reindex_codebase(root_path)

    • Scans and indexes the codebase. Run this initially and after major changes.

    • Creates a .kgraph directory in your project root.

🔌 MCP Client Configuration

Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "kgraph": {
      "command": "uv",
      "args": [
        "tool",
        "run",
        "kgraph"
      ]
    }
  }
}

Cursor / Other Clients

If your client supports stdio MCP servers, use:

  • Command: uv

  • Args: tool run kgraph

🏗️ Architecture

kgraph uses a hybrid storage approach:

  • SQLite: Stores the structural graph (Nodes: Files, Functions, Classes; Edges: IMPORTS, CALLS, DEFINES).

  • LanceDB: Stores vector embeddings of code snippets for semantic search.

  • Tree-sitter: Used for robust, error-tolerant parsing of source code.

📝 License

MIT

Install Server
A
license - permissive license
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    Enables semantic code search across projects using AI embeddings to find code by meaning rather than just text matching. Provides fast intelligent search, symbol analysis, and code similarity detection with multi-language support.
    Last updated
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    Enables semantic code search across multiple repositories using natural language queries. Provides intelligent code discovery, symbol lookups, and cross-repo dependency analysis for AI coding agents.
    Last updated
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    Enables fast semantic code search and analysis across 15+ programming languages. Supports searching for functions and classes, tracing code usage, detecting syntax errors, and analyzing code quality and structure.
    Last updated
    120
    32
    GPL 3.0

View all related MCP servers

Related MCP Connectors

  • Enterprise code intelligence for M&A, security audits, and tech debt. Hosted server with 200k free.

  • AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).

  • Give your AI agent a persistent map of your project's structure, dependencies, and bugs.

View all MCP Connectors

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/DeepakJangra239/kgraph'

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