MODEL CONTEXT PROTOCOL
Connect your agents
to structured memory
The MCP server exposes your Konnektr Graph as tools. Claude, Cursor, and custom agents can create entities, build relationships, and query the graph through natural conversation.
Connect in minutes
Every Konnektr Graph instance includes a hosted MCP server. Just add the httpUrl to your client config with your resource ID.
{
"mcpServers": {
"konnektr-memory": {
"httpUrl": "https://mcp.graph.konnektr.io/mcp?resource_id={resource_id}"
}
}
}16 tools for graph operations
Your agent gets a complete toolkit for creating, querying, and managing entities in the knowledge graph.
Search & Query
search_digital_twinsSemantic search across all entities using embeddings.
{ "search_text": "authentication", "limit": 10 }search_modelsFind DTDL models by name or description.
{ "search_text": "user module" }query_digital_twinsExecute Cypher queries for graph traversal.
{ "query": "MATCH (n:Twin) RETURN n LIMIT 5" }Create & Update
create_or_replace_digital_twinCreate or update an entity with validated properties.
{ "twin_id": "sensor-1", "model_id": "dtmi:...", "properties": {...} }create_or_replace_relationshipCreate typed relationships between entities.
{ "source_id": "room-1", "target_id": "sensor-1", "relationship_name": "contains" }update_digital_twinPatch entity properties using JSON Patch operations.
{ "twin_id": "sensor-1", "patch": [{"op": "replace", "path": "/value", "value": 72}] }Schema & Models
create_modelDefine new DTDL models with properties and relationships.
{ "model": { "@id": "dtmi:example:Sensor;1", ... } }get_modelGet full model definition including inherited properties.
{ "model_id": "dtmi:example:Sensor;1" }list_modelsList all models in the graph with summaries.
{}Real-world patterns
See how agents use these tools to build and query knowledge graphs.
Semantic search for context
Use vector embeddings stored on entities to find semantically similar content. Filter by model type and limit results.
The search tool combines keyword matching with embedding similarity, giving you the best of both approaches.
// Semantic search for relevant context
await session.call_tool("search_digital_twins", {
"search_text": "user authentication JWT validation",
"model_id": "dtmi:code:Module;1", // Optional filter
"limit": 10
});
// Returns entities ranked by semantic similarity
// [
// { "$dtId": "jwt-validator", "path": "src/auth/jwt.ts", ... },
// { "$dtId": "session-handler", "path": "src/auth/session.ts", ... }
// ]Traverse relationships
Use Cypher to navigate the graph structure. Find dependencies, trace lineage, or explore connections between entities.
Variable-length path matching lets you explore N-hop relationships without knowing the exact depth.
// Traverse graph relationships with Cypher
await session.call_tool("query_digital_twins", {
"query": `
MATCH (root:Twin {name: 'api-gateway'})
MATCH (root)-[:imports*1..3]->(dep:Twin)
WHERE dep.\`$metadata\`.\`$model\` = 'dtmi:code:Module;1'
RETURN DISTINCT dep.path, dep.description
ORDER BY dep.path
`
});
// Find all modules within 3 hops of api-gatewayHybrid graph + vector queries
Combine structural graph queries with vector similarity ranking. Find entities that match a pattern AND are semantically similar.
This is the power of Konnektr: structural constraints from the graph with semantic ranking from embeddings.
// Combine vector search with graph traversal
await session.call_tool("query_digital_twins", {
"query": `
MATCH (m:Twin)-[:imports]->(dep:Twin)
WHERE dep.name = 'auth-service'
RETURN m.path, m.description
ORDER BY l2_distance(m.embedding, $query_vector)
LIMIT 5
`
});
// Find modules that import auth-service, ranked by similarity to queryBuild custom agents
Use the Python MCP library to build agents that maintain their own knowledge graphs. Perfect for codebase understanding, document processing, or any domain where relationships matter.
pip install mcpThe official MCP Python library handles connection management and authentication automatically.
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async def build_codebase_knowledge(repo_path: str):
url = "https://mcp.graph.konnektr.io/mcp?resource_id={resource_id}"
async with streamablehttp_client(url) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# Create a module entity in the graph
result = await session.call_tool(
"create_or_replace_digital_twin",
arguments={
"twin_id": "module-auth-service",
"model_id": "dtmi:code:Module;1",
"properties": {
"path": "src/auth/service.ts",
"description": "Authentication service",
"embedding": embedding_vector
}
}
)
# Query for related modules
deps = await session.call_tool(
"query_digital_twins",
arguments={
"query": """
MATCH (m:Twin)-[:imports]->(auth:Twin)
WHERE auth.`$dtId` = 'module-auth-service'
RETURN m.path, m.description
"""
}
)Ready to connect your agents?
Deploy a graph and get MCP credentials in minutes.