Documentation
¶
Overview ¶
Package mcp exposes the knowing knowledge graph as MCP (Model Context Protocol) tools over stdio and HTTP transports.
The server registers 23 tools organized into six planes:
Execution plane (write operations):
- index_repo: trigger indexing of a repository
- cross_repo_callers: find transitive callers across all repos
- graph_query: search nodes by qualified name prefix
- repo_graph: list all files in a repository
Intelligence plane (read-only analytics):
- blast_radius: compute all transitive callers of a symbol, grouped by repo
- trace_dataflow: follow all transitive callees from a symbol
- stale_edges: find edges invalidated by file changes
- snapshot_diff: raw structural diff between two snapshots
- semantic_diff: enriched diff with summary statistics
- pr_impact: blast radius analysis of all symbols changed between snapshots
- ownership: list files and their symbols for code ownership analysis
Runtime plane (runtime trace queries, requires SQLiteStore):
- runtime_traffic: query runtime-observed edges by service and route
- dead_routes: find route symbols with no recent observations
- trace_stats: aggregate statistics about runtime-derived edges
Context plane (graph-aware context packing):
- context_for_task: generate token-budgeted context for a task description
- context_for_files: generate blast-radius context for changed files
Feedback plane (agent learning loop):
- feedback: record/query symbol usefulness for ranking improvement
Discovery plane (exploration and planning):
- test_scope: find affected tests for changed files
- flow_between: find all paths between two symbols via BFS
- plan_turn: suggest relevant knowing tools for a task description
- communities: Louvain modularity-based graph clustering
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Examples ¶
func Examples(values ...string) mcp.PropertyOption
Examples returns a PropertyOption that sets JSON Schema "examples" on the property. This satisfies mcp-assert W103 which requires enum, pattern, example, or default.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an MCP server that exposes graph queries as tools. It holds a reference to the GraphStore for executing queries and delegates transport handling to the mcp-go library.
func NewServer ¶
func NewServer(store types.GraphStore) *Server
NewServer creates a new MCP server backed by the given GraphStore. It registers all tools, prompts, and resources.
func (*Server) ServeHTTP ¶
ServeHTTP runs the MCP server over HTTP at the given address until ctx is cancelled.
func (*Server) ServeStdio ¶
ServeStdio runs the MCP server over stdin/stdout until ctx is cancelled.
func (*Server) SetResultCache ¶ added in v0.3.0
func (s *Server) SetResultCache(c *cache.SubgraphCache)
SetResultCache attaches a SubgraphCache for memoizing blast_radius and test_scope results. When set, handlers check the cache before computing and store results after a miss. Pass nil to disable caching.
func (*Server) SetSnapshotManager ¶ added in v0.3.0
func (s *Server) SetSnapshotManager(sm *snapshot.SnapshotManager)
SetSnapshotManager attaches a SnapshotManager so MCP handlers can access the most recently computed HierarchicalTree for subgraph cache keying. Call this before Start if you want cache-aware blast_radius and test_scope.