Skip to content

MCP Server

Context Chain exposes its knowledge graph through an MCP server with 9 tools. Any MCP-compatible coding AI can query design decisions while writing code.

Tools

get_context_for_code

The main entry point. Five-slot retrieval for a piece of code.

ParameterTypeDescription
file_pathstringCurrent file being edited
function_namestring(Optional) Specific function
code_snippetstring(Optional) Code fragment for semantic matching

Queries all five slots in priority order: code anchor → keywords → decision links → semantic fallback, with metadata filtering throughout. Returns ranked decision summaries; request full content with a follow-up call.

search_decisions_by_keyword

Direct keyword search against the inverted index. Catches business terms ("refund", "auth", "rate limiting") that don't appear in code.

ParameterTypeDescription
keywordsstring[]Terms to search
repostring(Optional) Scope to a repo

search_decisions_semantic

Vector similarity search. Useful when the decision's wording differs from the search — e.g., searching "prevent duplicate charges" finds decisions about "idempotency design".

ParameterTypeDescription
querystringNatural language query
limitnumber(Optional) Max results

get_decision_relationships

Explore causal, dependency, and conflict chains from a decision.

ParameterTypeDescription
decision_idstringStarting decision
depthnumber(Optional) How many hops to follow

get_code_structure

List functions in a file or service.

ParameterTypeDescription
pathstringFile path or service name
typestringFilter: function, file, service

get_callers

Upstream dependencies — who calls a given function.

ParameterTypeDescription
function_namestringFunction to look up
repostringRepository scope

get_callees

Downstream dependencies — what a function calls.

ParameterTypeDescription
function_namestringFunction to look up
repostringRepository scope

get_cross_repo_dependencies

Cross-service API dependencies. Shows how services connect through API calls, shared packages, and message queues.

ParameterTypeDescription
repostringRepository to check

report_context_usage

Feedback loop — report which decisions were actually useful during a coding session. Improves retrieval ranking over time.

ParameterTypeDescription
decision_idsstring[]Decisions that were used
session_contextstring(Optional) What you were working on

Starting the Server

bash
npm run mcp

Communicates over stdio, as expected by MCP clients. Usually started automatically by Claude Code via .mcp.json.

Connection

See Claude Code Setup for configuration.

Released under the Apache 2.0 License.