MCP
Compass exposes an MCP (Model Context Protocol) server at /mcp. Any MCP-compatible AI tool can connect and query the knowledge graph using structured tools.
Setup
Claude Code
Add to your project's .mcp.json:
{
"mcpServers": {
"compass": {
"type": "sse",
"url": "http://localhost:8080/mcp"
}
}
}Cursor
Add to Cursor's MCP settings (Settings > MCP Servers):
{
"compass": {
"type": "sse",
"url": "http://localhost:8080/mcp"
}
}Windsurf
Add to Windsurf's MCP configuration:
{
"mcpServers": {
"compass": {
"serverUrl": "http://localhost:8080/mcp"
}
}
}Tools
search_entities
Search the knowledge graph with keyword, semantic, or hybrid mode.
| Parameter | Required | Description |
|---|---|---|
text | Yes | Search query |
types | No | Comma-separated entity types (e.g., table,topic) |
source | No | Filter by source system |
mode | No | keyword, semantic, or hybrid (default: keyword) |
size | No | Max results (default: 10) |
get_context
Get full context about an entity: the entity itself, its relationships, and related entities.
| Parameter | Required | Description |
|---|---|---|
urn | Yes | Entity URN |
depth | No | Traversal depth, 1-5 (default: 2) |
impact
Analyze downstream blast radius — what entities are affected if this entity changes.
| Parameter | Required | Description |
|---|---|---|
urn | Yes | Entity URN |
depth | No | Downstream traversal depth (default: 3) |
get_documents
Get documents (runbooks, annotations, decisions) attached to an entity.
| Parameter | Required | Description |
|---|---|---|
urn | Yes | Entity URN |
assemble_context
Assemble a curated, token-budget-aware context window for an AI agent task. This is the primary tool for agents — it replaces the pattern of calling search, context, impact, and documents separately.
| Parameter | Required | Description |
|---|---|---|
query | Yes | What you're trying to accomplish |
seed_urns | No | Comma-separated entity URNs to start from |
intent | No | Task intent: debug, build, analyze, govern, general (default: general) |
token_budget | No | Max tokens in response (default: 4000) |
depth | No | Graph traversal depth, 1-5 (default: 2) |
The tool works in five phases:
- Seed resolution — If
seed_urnsare given, uses those. Otherwise, runs hybrid search to find the most relevant entities. - Graph expansion — Walks edges bidirectionally from each seed up to the configured depth.
- Document fetching — Retrieves attached documents for seed and top-ranked related entities.
- Intent-aware ranking — Scores all entities by relevance. The
intentparameter adjusts weights:debugprioritizes upstream lineage,analyzeprioritizes metrics and dashboards,buildprioritizes downstream consumers,governprioritizes policies and ownership. - Budget packing — Packs the highest-value context into the token budget. If the budget is exceeded, lower-ranked items are omitted and
Truncated: yesis indicated.
Returns structured markdown with seed entities, related entities, relationships, documents, and provenance metadata.
Usage Patterns
Quick Start: Use assemble_context
For most agent tasks, assemble_context is the only tool you need:
assemble_context(query: "debug the user sessions pipeline", intent: "debug")
assemble_context(query: "what metrics come from this table", seed_urns: "table:user_sessions", intent: "analyze")Composable Tools
For fine-grained control, agents can compose the individual tools:
- Discover —
search_entitiesto find relevant entities - Understand —
get_contextto see relationships and neighbors - Assess risk —
impactto evaluate downstream effects - Get knowledge —
get_documentsfor runbooks and decisions