Build a Business Twin with MCP
How to Build a Self-Updating "Business Twin" with Konnektr and MCP
This guide demonstrates how to turn Konnektr into a live, validated "Memory" for your AI agents.
Using the Model Context Protocol (MCP), you can connect AI agents (like Claude or Gemini) directly to your Konnektr Graph. This turns your database from a passive storage bucket into an active participant in your business workflows.
In this example, we will model a Smart Equipment System, tracking Employees and their assigned High-Value Assets.
Prerequisites
- A Konnektr Graph instance. The MCP server is available on "Standard" and higher tiers.
- An MCP Client (e.g., Claude CLI, Claude Desktop, Gemini) that supports OAuth 2.1 or the
npxcommand-line tool.
Part 1: Connecting to the Hosted MCP Server
Your Konnektr Graph instance is accessible via the shared, secure MCP endpoint.
1. Identify Your Endpoint
The MCP server is hosted at:
https://mcp.graph.konnektr.io/mcp?resource_id={your-resource-id}
You must replace {your-resource-id} with the actual ID of your Konnektr Graph instance.
2. Configure Your Client
The MCP Server uses OAuth 2.1 with Dynamic Client Registration. You don't need to provide a client_id or client_secret. Your client will guide you through a one-time browser login to authorize access.
For Claude CLI:
claude mcp add konnektr-graph --transport http https://mcp.graph.konnektr.io/mcp?resource_id=your-resource-idFor Claude Desktop (and similar clients):
Edit your claude_desktop_config.json (or equivalent) with this simplified configuration:
{
"mcpServers": {
"konnektr": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.graph.konnektr.io/mcp?resource_id=your-resource-id"]
}
}
}Part 2: Prompt Engineering for Twins
The true power of Konnektr + MCP is that you don't need to write the code; you just need to guide the AI. By providing the right context, the LLM will design the schemas and populate the graph for you.
Task 1: Generate the "Constitution" (DTDL Models)
Instead of manually writing JSON, ask the AI to design it. This ensures the data model is tailored to your specific needs.
User Prompt:
"I want to track our internal equipment. We have Employees (name, department) and Smart Assets (description, status, embedding).
Assets can be 'active', 'maintenance', or 'retired'. An employee can have up to 5 assigned assets.
Please generate the DTDL models and upload them using
create_models."
AI Action: The AI will generate valid DTDL (Digital Twins Definition Language) and call the MCP tool. It knows that Konnektr enforces these schemas strictly—if it tries to add a property not in the model, the system will reject it.
Task 2: Populate the Graph Semantically
User Prompt:
"Register a new asset: a 'NVIDIA DGX Station A100' for the AI Research team. It's active. Assign it to Dr. Sarah Conner in the R&D department.
First, check if the models exist, then create the twins and the relationship. Use meaningful IDs like 'asset-dgx-01' and 'emp-sarah-c'."
AI Action:
- Calls
get_modelsto verify the schema. - Calls
create_or_replace_digital_twintwice. - Calls
create_or_replace_relationshipto link them.
Part 3: Advanced Graph Queries
The LLM can also perform complex analysis by writing Cypher queries. However, it needs to know the "rules of the graph" first to generate optimized queries.
The Query Workflow
- Understand the Schema: The LLM should first understand the structure of the graph by calling
list_models. - Execute: The LLM then writes and runs the query using
query_digital_twins(the documentation for the tool includes the query rules).
User Prompt:
"Who in the R&D department is holding high-performance computing assets? Search for assets mentioning 'DGX' or 'Computing'."
AI Action (Tool Call):
{
"tool": "query_digital_twins",
"arguments": {
"query": "MATCH (emp:Twin)-[:assignedAsset]->(asset:Twin) WHERE emp.department = 'R&D' AND (asset.description CONTAINS 'DGX' OR asset.description CONTAINS 'Computing') RETURN emp.name, asset.description"
}
}Summary
By connecting your AI directly to Konnektr via MCP, you create a Self-Updating Knowledge Graph.
- Validated: The AI follows the DTDL "Constitution".
- Semantic: Vector embeddings allow for hybrid search.
- Persistent: Identities are stable across conversations.
This is the foundation for a truly autonomous "Digital Twin of Organization".