Skip to main content
Glama
OKFGraph MCP Server
by ywateba
NOTE

MCP-First & Zero Cloud API Bills: OKFGraph runs 100% locally on NetworkX + inverted BM25 (no Docker, no Neo4j, no paid LLM pipeline required). Your existing IDE/Host LLM (Antigravity, Cursor, Claude Desktop) or local Ollama/LM Studio drives graph creation and reasoning directly through OKFGraph's MCP tools.


What it does

Software requirements live in .docx/.pptx/Markdown specs, delivery history lives in Jira/GitHub/GitLab/Azure DevOps tickets, and the actual behavior lives in source code. Plain vector RAG chunks text blindly and loses the structural connections between them.

OKFGraph deterministically ingests all three domains into a single local Knowledge Graph, links business rules and tickets directly to classes, methods, and commits, and serves it through:

  1. A Model Context Protocol (MCP) server (okfgraph mcp) for AI coding agents.

  2. An interactive offline HTML Documentation Portal + Knowledge Graph Map (okfgraph serve).

flowchart LR
    subgraph Sources["Data Sources"]
        T["🎫 Tickets\nJira · GitHub · GitLab\nAzure DevOps · CSV/JSON/MD"]
        D["📄 Business Docs\n.docx · .pptx · .md · .txt\nGDrive · OneDrive · Confluence"]
        C["💻 Source Code\nPython AST · JS/TS/React\nCustom Language Plugins"]
    end

    subgraph Engine["OKFGraph Local Engine (Zero Cloud API Cost)"]
        B["Graph Builder & Cross-Domain Linker\nFile · imports · inherits · contains · calls\nimplements · applies_to · mentions_entity"]
        R["SOTA GraphRAG Retriever (~10 ms)\n4-Way RRF · Inverted BM25\n2-Hop PPR · Louvain Communities"]
    end

    subgraph Outputs["Interfaces"]
        M["🔌 MCP Server\nAntigravity · Cursor · Claude\nOllama · LM Studio"]
        P["🗺️ Offline HTML Portal\nSearchable Docs +\nInteractive Graph Map"]
    end

    T --> B
    D --> B
    C --> B
    B --> R
    R --> M
    B --> P

Related MCP server: Symbra

Features


Benchmarks

All localization scores use the strict LocAgent / Agentless protocol (zero partial credit — 1 iff all ground-truth modified files or (file, leaf_function) pairs appear in the top-k predictions).

1. Turn-1 Zero-LLM Retrieval (benchmarks/run_strict_loc_eval.py)

Dataset

Engine

N

File Acc@1

File Acc@3

File Acc@5

Func Acc@5

Func Acc@10

SWE-bench Lite (django)

Flat Keyword (TF-IDF)

114

15.8%

28.9%

34.2%

6.9%

9.9%

SWE-bench Lite (django)

OKFGraph SOTA (Zero-LLM)

114

39.5%

58.8%

65.8%

25.7%

31.7%

Loc-Bench_V1 (django)

Flat Keyword (TF-IDF)

35

14.3%

22.9%

28.6%

5.9%

8.8%

Loc-Bench_V1 (django)

OKFGraph SOTA (Zero-LLM)

35

42.9%

68.6%

74.3%

47.1%

47.1%

Loc-Bench_V1 (dask)

Flat Keyword (TF-IDF)

20

10.0%

25.0%

35.0%

15.0%

30.0%

Loc-Bench_V1 (dask)

OKFGraph SOTA (Zero-LLM)

20

55.0%

60.0%

60.0%

45.0%

60.0%

Loc-Bench_V1 (sklearn)

Flat Keyword (TF-IDF)

19

5.3%

10.5%

15.8%

5.3%

10.5%

Loc-Bench_V1 (sklearn)

OKFGraph SOTA (Zero-LLM)

19

26.3%

36.8%

42.1%

21.1%

21.1%

2. 2-Turn LLM + OKFGraph vs. Published Baselines (Loc-Bench_V1, django/django)

Pairing OKFGraph's graph tools with just 2 turns of a local 4B–8B model or a frontier Host LLM via MCP closes the vocabulary gap without needing a 10-turn custom agent:

System / Mode

LLM Backbone

Turns / Cost

Scope

File Acc@1

File Acc@5

Func Acc@5

Func Acc@10

OKFGraph SOTA (Turn-1)

None (Zero-LLM)

1 (~10 ms)

Django (N=5 blind)

40.0%

60.0%

40.0%

40.0%

OKFGraph + gemma-4-e4b

Local 4B (LM Studio)

2 ($0)

Django (N=5 blind)

60.0%*

80.0%

40.0%

40.0%

OKFGraph + llama3.1:8b

Local 8B (Ollama)

2 ($0)

Django (N=5 blind)

60.0%*

80.0%

60.0%

60.0%

OKFGraph + Host LLM (MCP)

Frontier Host LLM

2 (MCP)

Django (N=5 blind)

60.0%*

100.0%

80.0%

80.0%

Published Agentless (ref.)

GPT-4o / Claude-3.5

~4–6 (Paid)

Full SWE / Loc-Bench

—

~78–82%

~55–65%

~62–70%

Published LocAgent (ref.)

Qwen-2.5-32B (FT)

~10 (GPU)

Full Loc-Bench (560)

—

~84–88%

~65–70%

~70–74%

Published LocAgent (ref.)

Claude-3.5-Sonnet

~10 (Paid)

Full Loc-Bench (560)

~70–75%

~90–93%

~70–75%

~75–80%

*On the 5-issue blind slice, 2 issues modify 2 files simultaneously, so the theoretical ceiling for strict File Acc@1 is 60.0% (3/5). Evaluated against a Django HEAD graph snapshot; see Run the Benchmarks Yourself to reproduce on larger slices (N=35+) with any local or external LLM.


Quickstart

Requires Python 3.10+ (and optionally Node.js 18+ if indexing JS/TS repositories with Graphify).

1. Install & Verify

# Clone and install in editable mode with dev/test dependencies
git clone https://github.com/ywateba/okfgraph.git
cd okfgraph
python -m venv .venv

# Windows (PowerShell):  .venv\Scripts\Activate.ps1
# macOS / Linux:         source .venv/bin/activate
pip install -e ".[dev]"

# Run the test suite (96 tests)
pytest -q

Or install directly into another project:

pip install git+https://github.com/ywateba/okfgraph.git

2. Initialize, Build, and Explore Any Project

cd /path/to/my-project

# 1. Scaffold project.yaml (schema v2), llm_config.json, and .env
okfgraph init --name "My Project"

# 2. Build the Knowledge Graph & cross-domain links
okfgraph build

# 3. Export & launch the offline HTML portal + interactive Knowledge Graph map
okfgraph export --format html
okfgraph serve --port 8080          # Open http://localhost:8080/graph.html

# 4. Query or trace call chains from the CLI
okfgraph chat "Which service handles payment authorizations and refunds?"
okfgraph trace "ProcessPayment" --depth 4
# project.yaml (schema v2)
schema_version: 2
project_name: "My Project"
project_folder: "."

tickets:
  output_dir: "inputs/tickets"
  scan_git_log: true
  sources:
    - name: main
      type: github                  # jira | github | gitlab | azure_devops | file | python
      options:
        owner: "your-org"
        repo: "your-repo"
      auth:
        token: "${GITHUB_TOKEN}"

inputs:
  source_code:
    repository_path: "./src"
    file_extensions: [".py", ".ts", ".js"]
  business:
    business_docs_dir: "inputs/business_docs"
    structuring_mode: "deterministic"   # deterministic | hybrid | llm

artifacts:
  knowledge_graph_json: "artifacts/knowledge_graph_nodes_edges.json"
  exported_html_dir: "artifacts/exported_html"
{
  "active_provider": "mcp",
  "enforce_mcp_only": true,
  "embedding_provider": "ollama",
  "providers": {
    "mcp": {
      "description": "All LLM interactions are routed through the OKFGraph MCP Server",
      "active": true
    },
    "ollama": {
      "chat_model": "llama3.1",
      "embedding_model": "nomic-embed-text",
      "base_url": "http://localhost:11434",
      "active": false
    }
  }
}

MCP Server

Add okfgraph to your IDE or AI client MCP configuration (.mcp.json, Antigravity, Cursor, Claude Desktop, or LM Studio):

{
  "mcpServers": {
    "okfgraph": {
      "command": "python",
      "args": ["-m", "okfgraph.query.mcp_server", "--project", "project.yaml"],
      "env": {
        "OKFGRAPH_MCP_ONLY": "true",
        "PYTHONUTF8": "1"
      }
    }
  }
}

Or run over local HTTP SSE (pass --read-only to disable mutation tools, or --disable-plugins for core-only mode):

okfgraph mcp --project project.yaml --transport sse --port 8765 --read-only

GraphRAG Query & Reasoning Tools

  • query_subgraph — 4-way RRF + Personalized PageRank + minimum-cost semantic paths + Louvain communities

  • graph_summary / graph_communities — Topology overview and domain clusters

  • search_nodes / get_node_details / get_neighbors — Direct node & edge inspection

  • find_path — Shortest semantic reasoning path between any two nodes

  • trace_call_hierarchy — Upstream callers and downstream callees with depth control

  • get_ticket — Canonical ticket details + connected graph neighborhood

  • read_code_snippet — Symbol-grounded source code snippets (with path-containment & secret-file guards)

  • list_plugins — Lists installed okfgraph.code_extractors and loaded okfgraph.mcp_plugins

Graph Creation & Mutation Tools (disabled in --read-only mode)

  • migrate_project_config — Upgrades legacy project.yaml to schema v2

  • sync_tickets — Pulls & normalizes tickets into TicketStore

  • extract_raw_documents / get_raw_document_text / submit_structured_document — MCP-driven document structuring

  • extract_code_ast — Runs built-in (python / graphify) or installed okfgraph.code_extractors plugins

  • upsert_graph_knowledge / build_and_reload_graph — Live graph updates with hot-reloaded BM25 index


Plugin Architecture

OKFGraph is a generic core extensible via 4 standard Python entry-point groups — install any plugin package alongside okfgraph with zero core edits.

Want to build your own plugin? Follow the step-by-step guide (package layout, pyproject.toml, CodeExtractor, MCP tools, security & verification): Plugin Authoring & Architecture Guide → docs/plugin_architecture.md.

Entry-Point Group

Base Contract

What It Extends

okfgraph.code_extractors

CodeExtractor ABC

Custom language AST extractors (e.g., Rust, Go, Java, proprietary DSLs)

okfgraph.mcp_plugins

register_mcp_tools(server, ctx)

Domain-specific MCP tools with live access to graph, retriever & read-only state

okfgraph.ticket_connectors

TicketConnector ABC

Custom issue trackers (built-ins: jira, github, gitlab, azure_devops, file)

okfgraph.doc_connectors

DocumentConnector ABC

Remote document sources (built-ins: gdrive, onedrive, confluence, http)

# In your external plugin package's pyproject.toml
[project.entry-points."okfgraph.code_extractors"]
mylang = "okfgraph_mylang:MyLangExtractor"

[project.entry-points."okfgraph.mcp_plugins"]
mylang = "okfgraph_mylang.mcp:register_mcp_tools"

Run the Benchmarks Yourself

1. Built-In Offline Golden Benchmark (No Downloads Required)

python benchmarks/run_benchmark.py

2. Index Any Python Repo & Run the Strict Turn-1 Scorecard

import json
from pathlib import Path
from okfgraph.ingestion.code.python_ast import extract_python_repo_graph

kg = extract_python_repo_graph("path/to/django/django")
Path("benchmarks/external/django_kg.json").write_text(json.dumps(kg), encoding="utf-8")
python benchmarks/run_strict_loc_eval.py

3. LocAgent-Protocol N-Turn Runner (Local or External LLM)

Run benchmarks/run_locagent_bench.py with any --turns N and any OpenAI-compatible endpoint (File@1/3/5, Mod@5/10, Func@5/10, latency & token telemetry):

Local Ollama (http://localhost:11434/v1):

python benchmarks/run_locagent_bench.py \
  --dataset benchmarks/external/locbench_v1.jsonl \
  --kg benchmarks/external/django_kg.json \
  --repo django/django --pkg-prefix django \
  --turns 3 --limit 35 \
  --base-url http://localhost:11434/v1 \
  --model llama3.1:latest \
  --out benchmarks/external/report_ollama_3t.json

Local LM Studio (http://localhost:1234/v1):

python benchmarks/run_locagent_bench.py \
  --dataset benchmarks/external/locbench_v1.jsonl \
  --kg benchmarks/external/django_kg.json \
  --repo django/django --pkg-prefix django \
  --turns 3 --limit 35 --max-tokens 2048 \
  --base-url http://localhost:1234/v1 \
  --model google/gemma-4-e4b \
  --out benchmarks/external/report_gemma4_3t.json

External OpenAI-Compatible API (requires explicit --allow-external):

export OPENAI_API_KEY="sk-..."
python benchmarks/run_locagent_bench.py \
  --dataset benchmarks/external/locbench_v1.jsonl \
  --kg benchmarks/external/django_kg.json \
  --repo django/django --pkg-prefix django \
  --turns 5 --limit 35 \
  --base-url https://api.openai.com/v1 \
  --model gpt-4o \
  --api-key-env OPENAI_API_KEY \
  --allow-external \
  --out benchmarks/external/report_gpt4o_5t.json

Reference & Security

Command

Arguments

Description

okfgraph init

[--name NAME] [--path PATH] [--force]

Scaffolds project.yaml (v2), llm_config.json, and .env

okfgraph migrate-config

[project.yaml] [--dry-run] [--no-backup]

Migrates legacy project.yaml to schema v2

okfgraph build

[--project PATH] [--start 1-6] [--stop 1-6]

Runs extraction, AST parsing, and cross-domain graph linking

okfgraph export

--format html|docx|all [--project PATH]

Exports offline HTML portal (+ Graph Map) and/or Word docs

okfgraph serve

[--port PORT] [--project PATH]

Serves the local HTML portal & Knowledge Graph map

okfgraph mcp

[--transport stdio|sse] [--port PORT] [--read-only]

Starts the extensible MCP server

okfgraph chat

"<query>" [--project PATH]

Answers questions via Multi-Hop GraphRAG

okfgraph trace

"<symbol>" [--depth N] [--upstream]

Traces downstream callees or upstream callers

okfgraph tickets

list-connectors | test | sync | new-connector

Manages pluggable ticket connectors

okfgraph docs

list-connectors | sync | new-connector

Manages remote document connectors

okfgraph/
├── src/okfgraph/
│   ├── cli.py                            # Unified CLI (`okfgraph`)
│   ├── core/                             # Config loader, security guards, LLM/MCP factory
│   ├── ingestion/
│   │   ├── business/                     # Spec extraction (.docx/.pptx/.md) & structuring
│   │   ├── code/                         # 4-edge Python AST, Graphify & CodeExtractor registry
│   │   └── documents/                    # Remote doc connectors (GDrive, OneDrive, Confluence, HTTP)
│   ├── tickets/                          # Canonical TicketStore & connectors (Jira/GH/GL/ADO/File)
│   ├── graph/                            # Knowledge Graph builder & cross-domain linker
│   ├── docs/export/                      # Offline HTML portal, interactive Graph Map & Word export
│   ├── query/                            # SOTA RRF/BM25/PPR retriever, MCP server & MCP plugin loader
│   └── pipeline/                         # 6-phase pipeline orchestrator
├── benchmarks/                           # Golden, strict Loc-Bench/SWE-bench & N-turn runners
├── docs/
│   ├── brand/                            # Light/dark SVG logos & icon
│   └── plugin_architecture.md            # Official 4-pillar plugin standard
├── tests/                                # 96 unit, security, plugin & connector contract tests
├── AGENTS.md                             # MCP-first agent operational rules
├── SECURITY.md                           # Security architecture & threat model
├── LICENSE                               # MIT License
└── pyproject.toml
  • Security: Path-containment checks, SSRF protection, secret-file filtering, HTML XSS sanitization, and read-only MCP enforcement are built in — see SECURITY.md.

  • License: Licensed under the MIT License. Copyright (c) 2026 ywateba.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI coding agents to query a local, continuously updated symbol graph of a codebase, providing ranked search, caller/callee exploration, dependency paths, and git-diff impact analysis through MCP tools.
      9 npm
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables coding agents to query a local, multi-repo code graph for symbol exploration, blast radius analysis, co-change mining, and durable code-anchored memory via MCP tools.
      247 npm
      16
      Business Source 1.1
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to retrieve hyper-targeted, token-efficient context from a codebase by querying a locally built AST knowledge graph, and to persist cross-session agent memory through 17 MCP tools. All indexing and retrieval run entirely offline, so proprietary code never leaves the machine.
      18 PyPI
      2
      MIT