The Kibi Model Context Protocol (MCP) server is the primary interface for LLM agents. The server operates over stdio and receives JSON-RPC 2.0 requests.
The public MCP surface is intentionally curated. Agents can call exact lookup, discovery/reporting, mutation, and validation tools through MCP.
Retrieve entities by type, id, tags, or sourceFile. Supports limit and offset pagination.
Parameters:
type(optional): Entity type (req,scenario,test,adr,flag,event,symbol,fact)id(optional): Entity ID (exact match)tags(optional): Tag list for filteringsourceFile(optional): Source-file substring filterlimit(optional): Maximum number of resultsoffset(optional): Number of results to skip
Returns: Array of matching entities with deterministic ordering.
Example:
{
"type": "req",
"sourceFile": "src/auth/login.ts",
"limit": 20
}Search entities by metadata and markdown body text for exploratory discovery.
Parameters:
query(required): Free-text querytype(optional): Entity type filterlimit(optional): Maximum number of ranked resultsoffset(optional): Number of results to skip
Returns: Ranked results with match reasons and optional snippets.
Example:
{
"query": "login flow",
"type": "req",
"limit": 10
}Return branch, snapshot, and freshness metadata for the attached KB.
Returns: Branch name, snapshot ID, sync state, dirty flag, and KB path metadata.
Example:
{}Run curated missing/present relationship analysis over KB entities.
Parameters:
type(optional): Entity type filtermissingRelationships(optional): Required-to-be-absent relationship typespresentRelationships(optional): Required-to-be-present relationship typestags(optional): Tag filtersourceFile(optional): Source-file substring filterlimit/offset(optional): Pagination controls
Returns: Matching rows, relationship counts, and status metadata.
Example:
{
"type": "req",
"missingRelationships": ["specified_by", "verified_by"],
"sourceFile": "src/auth"
}Generate curated coverage reports.
Parameters:
by(optional):req,symbol, ortypetags(optional): Tag filterincludePassing(optional): Include fully covered rows in report contexts that support itincludeTransitive(optional): Include transitive symbol coveragelimit/offset(optional): Pagination controls
Returns: Coverage summary rows and status metadata.
For requirement coverage, summaries distinguish evaluated must-priority requirements from rows marked notApplicable.
Example:
{
"by": "req",
"includePassing": false,
"includeTransitive": true
}Run bounded graph traversal from one or more seed IDs.
Parameters:
seedIds(required): Starting IDsrelationships(optional): Relationship filterdirection(optional):outgoing,incoming, orbothdepth(optional): Maximum traversal depthentityTypes(optional): Filter returned nodes by typemaxNodes/maxEdges(optional): Traversal bounds
Returns: Nodes, edges, truncation flag, and status metadata.
Example:
{
"seedIds": ["REQ-001"],
"direction": "both",
"depth": 2,
"maxNodes": 100,
"maxEdges": 200
}Create or update a single entity and optional relationships in one call.
Parameters:
type: Entity type enumid: Entity IDproperties: Entity fields, including requiredtitleandstatus(status values depend on entity type; legacy values may still be accepted for compatibility)relationships(optional): Relationship rows with enum-backedtype,from, andto
Returns: Confirmation of entity creation/update and relationship creation counts.
Delete one or more entities by ID. Deletion is blocked when dependents still reference the target.
Parameters:
ids: Array of entity IDs to delete
Returns: Confirmation of deletion, or an error describing blocked dependents.
Run KB validation rules after mutations.
Parameters:
rules(optional): Validation rule subset (must-priority-coverage,symbol-coverage,symbol-traceability,no-dangling-refs,no-cycles,required-fields,deprecated-adr-no-successor,domain-contradictions)
Returns: Validation report with any violations found and suggested fixes.
- MCP clients discover available tools through
tools/list. - Allowed static values are encoded directly in each tool's
inputSchemaenums. - There are no separate runtime listing tools for entity or relationship types.
- The server attaches to the active git branch automatically at startup.
- If the active branch KB does not exist, the server copies from the previously active branch KB when available; otherwise it creates an empty branch KB.
- Branch KBs are revalidated and updated automatically on branch change—no server restart is required for normal branch operations.
- You can override the branch selection by setting the
KIBI_BRANCHenvironment variable before starting the server. - Branch garbage collection is not part of the public MCP interface. Use
kibi gcor automation hooks instead.
- Gather Context: Use
kb_searchfor discovery andkb_queryfor exact follow-up. - Inspect Freshness: Use
kb_statuswhen branch or stale-state confidence matters. - Analyze: Use
kb_find_gaps,kb_coverage, andkb_graphfor curated reporting. - Execute Changes: Use
kb_upsertto create/update entities and relationships. - Validate: Run
kb_checkafter structural changes. - Clean Up: Use
kb_deleteonly for intentional removals after validating dependencies.
The MCP server returns structured errors for:
- Invalid parameters (missing required fields, invalid enum values)
- Referential integrity violations (attempting to delete entities with dependents)
- Branch KB startup/attach failures
- Validation failures
Always check error responses before proceeding with more mutations.
- Query results are sorted and de-duplicated for consistency
- MCP responses use explicit field names and fixed shapes
- Validation output is stable across repeated runs on unchanged KB state