Skip to main content

8. Artifact Bridge & MCP Integration

8.1 Bridge Modes

The Artifact Bridge provides multiple access modes:

Figure 11: Bridge Modes - Flowchart showing the dual-mode operation of the Artifact Bridge (REST API and MCP server).

8.2 REST API Endpoints

EndpointMethodDescription
/indexesGETList all indexes
/indexes/{index_id}GETGet specific index metadata
/index-metaGETCurrent index metadata
/artifactsGETList registered artifacts
/artifacts/{artifact_type}GETRetrieve artifacts by type
/artifacts/{artifact_type}/contentGETArtifact content by path
/file-contentGETFile content with BSG enrichment
/statsGETRegistry statistics
/patchesGETList patch operations
/patches/{operation_id}GETPatch operation detail
/snapshots/diffGETDiff two snapshots (base + new)

Example: Get File Content with BSG Enrichment

curl "http://localhost:8080/file-content?path=src/services/user.py"

Response:

{
"file_path": "src/services/user.py",
"content": "# File content...",
"entities": [
{
"id": "UserService",
"type": "CLASS",
"start_line": 10,
"end_line": 50
}
]
}

8.3 MCP Server Capabilities

The MCP server exposes Batho's graph as a model context provider for LLMs:

ToolDescription
bridge_list_indexesList all available index IDs and timestamps
bridge_get_indexGet metadata for a specific index
bridge_list_artifactsList artifact records, optionally filtered
bridge_get_artifactLoad full JSON content for an artifact type
bridge_get_artifact_by_pathLoad artifact content by exact logical path
bridge_search_artifactsFuzzy search artifacts by logical path
bridge_get_statsReturn registry statistics

MCP Usage Example

# In an MCP client
tools = await mcp.list_tools()
indexes = await mcp.call_tool("bridge_list_indexes")
artifact = await mcp.call_tool("bridge_get_artifact_by_path", {
"artifact_type": "bsg",
"path": "bsg.json"
})

8.4 Transport Modes

ModeCommandUse Case
stdiobatho bridge serve --transport stdioMCP client integration
SSEbatho bridge serve --transport sse --port 8080Web-based LLM access

8.5 Configuration

# batho.yaml
bridge:
rest:
enabled: true
port: 8080
host: "0.0.0.0"
mcp:
enabled: true
transport: "stdio" # or "sse"