MCP (Model Context Protocol) server for Siemens Graph Studio - enables AI agents to interact with knowledge graphs via SPARQL
Project description
Siemens Graph Studio MCP Server
An MCP (Model Context Protocol) server that enables AI agents to interact with Siemens Graph Studio knowledge graphs via SPARQL queries.
Features
- ๐ Execute SPARQL Queries - Run queries against GraphMarts with automatic result formatting
- ๐ Smart Knowledge Discovery - Intelligent property categorization (object vs data properties) for better query generation
- ๐ Manage GraphMarts - Create and modify transformation layers and steps
- ๐ง AI-Powered Queries - Natural language to SPARQL translation (with OpenAI)
- ๐ฆ Ontology Caching - Efficient schema discovery with persistent caching
- ๐๏ธ Modular Architecture - Well-organized tool categories for maintainability
What's New in 0.4.x
- โ
0.4.4:
explanationparameter is now optional in all graphmart layer/step tools โ no longer a required field - ๐ 0.4.3: Fixed REST API HTTP 400 errors by adding missing
Accept: */*header - ๐ฆ 0.4.2: Removed external
anzo-api-wrapperdependency โ replaced with a self-containedAnzoRestClientusing Python stdlib only (no morerequests==2.31.0conflicts) - ๐ 0.4.0: All 11 graphmart tools migrated from SPARQL journal writes to the REST API
See CHANGELOG.md for full details.
VS Code Setup (Recommended)
No API_KEY needed! GitHub Copilot handles natural language โ the MCP server only needs credentials to connect to your Graph Studio instance.
Step 1 โ Install the package
pipx install siemens-graph-studio-mcp-server
# Verify it works:
siemens-graph-studio-mcp --verify
Command not found? See Installation Guide.
Step 2 โ Gather your Graph Studio credentials
You need four connection values from your Graph Studio administrator or the Graph Studio UI:
| Variable | Where to find it | Example |
|---|---|---|
ANZO_SERVER |
Hostname of your Graph Studio server | graphstudio.mycompany.com |
ANZO_PORT |
HTTP/HTTPS port (check with your admin) | 8443 |
ANZO_USERNAME |
Your Graph Studio login username | jsmith |
ANZO_PASSWORD |
Your Graph Studio login password | โขโขโขโขโขโขโขโข |
GRAPHMART_URI |
URI of the target GraphMart (see below) | http://โฆ/Graphmart/abc123 |
How to find your GRAPHMART_URI:
- Open Graph Studio in a browser and log in
- Navigate to the GraphMart you want to use
- Click the GraphMart name to open its detail view
- Copy the URI from the browser address bar โ it looks like:
http://graphstudio.mycompany.com:8443/graphmart/view?datasource=http%3A%2F%2F...%2FGraphmart%2Fabc123 - Decode the
datasource=parameter value โ that decoded URL is yourGRAPHMART_URI:
Alternatively, in Graph Studio go to Settings โ GraphMart Info โ the URI is shown there directly.http://cambridgesemantics.com/Graphmart/abc123
Step 3 โ Create .vscode/mcp.json
In your project root, create the file .vscode/mcp.json:
{
"servers": {
"graph-studio": {
"type": "stdio",
"command": "siemens-graph-studio-mcp",
"env": {
"ANZO_SERVER": "graphstudio.mycompany.com",
"ANZO_PORT": "8443",
"ANZO_USERNAME": "your-username",
"ANZO_PASSWORD": "your-password",
"GRAPHMART_URI": "http://cambridgesemantics.com/Graphmart/your-id"
}
}
}
}
Tip: Auto-generate a template with the correct command path:
cd your-project siemens-graph-studio-mcp --setup-vscode # Then edit .vscode/mcp.json to fill in your real values
Command not in PATH? Use the full absolute path:
"command": "/Users/yourname/.local/bin/siemens-graph-studio-mcp"Find it with:
which siemens-graph-studio-mcp
Step 4 โ Enable MCP in VS Code
- Open Settings (
Cmd+,/Ctrl+,) - Search for
chat.mcp.enabled - Enable the checkbox โ
Step 5 โ Reload and verify
Cmd+Shift+Pโ "Developer: Reload Window"- Open Copilot Chat (
Cmd+Shift+I) - Click the tools icon (wrench) โ you should see Graph Studio tools listed
- Try asking:
- "What ontologies are available in the GraphMart?"
- "Show me classes in the default ontology"
- "Execute: SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 5"
Not working? See Installation Guide for troubleshooting.
Documentation
- Installation Guide - Detailed setup, troubleshooting, and PATH configuration
- Agent System Prompt - Recommended workflow and tool usage for AI agents
- SPARQL Reference - Query patterns, naming conventions, and troubleshooting
- Architecture Guide - Technical architecture overview
- Skills Documentation - Best practices for ontology and linking patterns
Installation
Recommended: pipx or uv (Isolated Environment)
# Using pipx (prevents dependency conflicts)
pipx install siemens-graph-studio-mcp-server
# Or using uv (faster)
uv tool install siemens-graph-studio-mcp-server
Alternative: pip
pip install siemens-graph-studio-mcp-server
Verify Installation
siemens-graph-studio-mcp --verify
Command not found? See Installation Guide for PATH troubleshooting.
Quick Start
1. Configure Environment Variables
export ANZO_SERVER="graph-studio.example.com"
export ANZO_PORT="8443"
export ANZO_USERNAME="your-username"
export ANZO_PASSWORD="your-password"
export GRAPHMART_URI="http://example.com/Graphmart/your-graphmart-id"
# Optional: Only for server-side natural language to SPARQL translation
# NOT needed when using VS Code Copilot (Copilot generates SPARQL for you)
# Basic SPARQL, discovery, and ontology tools work without this
export API_KEY="sk-your-openai-api-key"
2. Run the Server
siemens-graph-studio-mcp
3. Use with VS Code + GitHub Copilot (Recommended)
VS Code with GitHub Copilot provides a powerful way to use the MCP server without requiring an OpenAI API key. Copilot's built-in AI handles natural language understanding.
Step 1: Create a .vscode/mcp.json in your project:
{
"servers": {
"graph-studio": {
"command": "siemens-graph-studio-mcp",
"env": {
"ANZO_SERVER": "graph-studio.example.com",
"ANZO_PORT": "8443",
"ANZO_USERNAME": "your-username",
"ANZO_PASSWORD": "your-password",
"GRAPHMART_URI": "http://example.com/Graphmart/your-graphmart-id"
}
}
}
}
Note: No
API_KEYrequired - GitHub Copilot handles the AI layer.
Step 2: Enable MCP in VS Code settings (Settings โ Extensions โ GitHub Copilot Chat โ Enable MCP).
Step 3: Open Copilot Chat (Ctrl+Shift+I / Cmd+Shift+I) and ask questions like:
- "What classes are available in the GraphMart?"
- "Show me all properties of the Customer class"
- "Write a SPARQL query to find all active projects"
โ ๏ธ Troubleshooting VS Code + Copilot
Command not found in VS Code:
// Use full path in .vscode/mcp.json if command not in PATH:
{
"servers": {
"graph-studio": {
"command": "/full/path/to/siemens-graph-studio-mcp",
// Find path with: siemens-graph-studio-mcp --verify
...
}
}
}
MCP tools not appearing:
- Run "Developer: Reload Window" (
Ctrl+Shift+Pโ Reload) - Check Output panel โ "MCP" for errors
- Verify the command works in terminal:
siemens-graph-studio-mcp --verify
See full troubleshooting guide: docs/INSTALLATION_GUIDE.md
4. Use with Claude Desktop
Add to your ~/.config/claude-desktop/claude_desktop_config.json:
{
"mcpServers": {
"graph-studio": {
"command": "siemens-graph-studio-mcp",
"env": {
"ANZO_SERVER": "graph-studio.example.com",
"ANZO_PORT": "8443",
"ANZO_USERNAME": "your-username",
"ANZO_PASSWORD": "your-password",
"GRAPHMART_URI": "http://example.com/Graphmart/your-graphmart-id",
"API_KEY": "sk-your-openai-api-key"
}
}
}
}
the server to do natural language to SPARQL translation internally. With Claude Desktop, this enables asking questions like "show me all customers" and having the server convert them to SPARQL automatically
Note:
API_KEYis optional. Include it only if you want natural language to SPARQL translation. Basic SPARQL execution, knowledge discovery, and GraphMart management work without it.
Configuration
Environment Variables
| Variable | Required | Description |
|---|---|---|
ANZO_SERVER |
Yes | Graph Studio server hostname |
ANZO_PORT |
Yes | Server port (typically 8443) |
ANZO_USERNAME |
Yes | Authentication username |
ANZO_PASSWORD |
Yes | Authentication password |
GRAPHMART_URI |
Yes | Target GraphMart URI |
API_KEY |
No | OpenAI API key - only needed for NLโSPARQL. All basic operations work without it. |
ENABLE_AGENT_DEBUG |
No | Enable debug output |
ENABLE_LOGGING_DEBUG |
No | Enable detailed logging |
Config File
Alternatively, use a config file:
siemens-graph-studio-mcp --config my-config.json
See examples/config.example.jsonc for a template.
Architecture
The server is organized into focused, maintainable modules:
siemens_graph_studio_mcp/
โโโ server.py # MCP server entry point
โโโ sparql_agent_core.py # Core agent logic
โโโ ontology_discovery.py # Schema extraction
โโโ ontology_cache.py # Persistent caching
โโโ models.py # Pydantic data models
โโโ tools/
โ โโโ discovery/ # Knowledge exploration tools
โ โโโ query/ # SPARQL execution tools
โ โโโ ontology/ # Ontology management tools
โ โโโ graphmart/ # GraphMart construction tools
โ โโโ system/ # System monitoring tools
โโโ utils/ # Shared utilities
Key Components
- SPARQLAgent: The intelligent agent that converts natural language to SPARQL queries
- OntologyDiscovery: Extracts and analyzes ontology schemas from GraphMarts
- OntologyCache: Provides persistent caching for schema information
- Property Detection: Distinguishes between
owl:ObjectProperty(relationships) andowl:DatatypeProperty(attributes) for smarter query generation
Available Tools
System & Monitoring
test_system_connection- Test MCP server and Graph Studio agent statusget_session_logs- Get session logs and interaction history
SPARQL Query Execution
execute_sparql_query- Execute SPARQL directly against GraphMartquery_ags_configuration- Query Graph Studio configurationupdate_ags_configuration- Update Graph Studio configuration
Knowledge Discovery
discover_knowledge_overview- Get overview of available knowledgediscover_available_ontologies- List all available ontologiesdiscover_ontology_classes- List classes in a specific ontologydiscover_class_data_properties- List data properties for a classdiscover_class_object_properties- List object properties for a class
Ontology Management
create_ontology- Create new ontologiesdelete_ontology- Delete ontologiesload_ontology_from_file- Load TTL files into named graphsregister_ontology- Register ontologiesadd_ontology_class/remove_ontology_class- Manage classesadd_ontology_property/remove_ontology_property- Manage propertiesget_ontology_cache_status/clear_ontology_cache/refresh_ontology_cache- Cache management
GraphMart Construction
create_transformation_layer- Create transformation layersadd_transformation_step- Add transformation stepsadd_direct_load_step- Add direct data loading stepsupdate_transformation_layer/delete_transformation_layer- Layer managementlist_transformation_layers/list_transformation_steps- List componentsrefresh_graphmart/reload_graphmart- GraphMart operations
Transport Modes
stdio (default)
For use with Claude Desktop and other MCP clients:
siemens-graph-studio-mcp
SSE (Server-Sent Events)
For web clients:
siemens-graph-studio-mcp --transport sse --port 8000
HTTP Streaming
siemens-graph-studio-mcp --transport streamable-http --port 8000
Programmatic Usage
import asyncio
from siemens_graph_studio_mcp import GraphmartConfig, SPARQLAgent
async def main():
config = GraphmartConfig(
ags_server="graph-studio.example.com",
ags_port=8443,
graphmart_uri="http://example.com/Graphmart/demo",
username="admin",
password="secret"
)
agent = SPARQLAgent(config)
await agent.initialize()
# Now use the agent...
asyncio.run(main())
Development
Setup
git clone https://github.com/siemens/graph-studio-mcp-server.git
cd graph-studio-mcp-server
pip install -e ".[dev]"
Running Tests
pytest
Building for Distribution
pip install build twine
python -m build
Publishing to PyPI
# Test PyPI
twine upload --repository testpypi dist/*
# Production PyPI
twine upload dist/*
Requirements
- Python 3.10+
- Access to a Siemens Graph Studio instance
- Valid user credentials with GraphMart access
License
Apache License 2.0 - See LICENSE for details.
Related
- Model Context Protocol - The MCP specification
- Siemens Graph Studio - Knowledge graph platform
- FastMCP - Python MCP framework
Support
For issues and feature requests, please use the GitHub Issues page.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file siemens_graph_studio_mcp_server-0.4.4.tar.gz.
File metadata
- Download URL: siemens_graph_studio_mcp_server-0.4.4.tar.gz
- Upload date:
- Size: 111.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b2d948701b2ffe654e805e9717989e0a90b4ea83cb33cb570e5b439c742ae99
|
|
| MD5 |
b79888bd60056d54675fb9ad97794a0c
|
|
| BLAKE2b-256 |
dc7ea3a67bd15789a814bd724ca218de4adab8595dfd7f4d974e75d0f76c38a4
|
File details
Details for the file siemens_graph_studio_mcp_server-0.4.4-py3-none-any.whl.
File metadata
- Download URL: siemens_graph_studio_mcp_server-0.4.4-py3-none-any.whl
- Upload date:
- Size: 144.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
472673b2ea3a1b85781f64fb8007b9d48489431322d37d219c94e8e773024c90
|
|
| MD5 |
18d9f0d00dd7688cb300192f19932b35
|
|
| BLAKE2b-256 |
851f1bd7e797786c3198c088550e3f24c81ec7a65590c0c8edc85183594dd6de
|