Model Context Protocol (MCP) server for Anzo Graph Database with 45+ tools and comprehensive documentation
Project description
Anzo MCP Server
Enterprise-grade Model Context Protocol (MCP) server for Anzo Graph Database - Connect AI assistants to your knowledge graphs with 45+ tools and 10 comprehensive prompts for semantic data operations.
๐ Why Anzo MCP Server?
Transform AI assistants into powerful knowledge graph operators with:
- ๐ Plug-and-play Integration: Works with Claude Desktop, Cursor IDE, and any MCP-compatible client
- ๐ ๏ธ 45+ Production-Ready Tools: Complete graphmart lifecycle management
- ๐ 10 Expert Prompts: Pre-built workflows for common graph operations
- ๐ Enterprise Security: Environment-based credential management
- โก Dual Transport: stdio for desktop apps, HTTP/SSE for web applications
- ๐ฏ SPARQL-First: Native query execution with validation and optimization
๐ฆ Installation
From PyPI (Recommended)
pip install ags-mcp-server
From Source
git clone https://github.com/cambridgesemantics/anzo-mcp-server.git
cd anzo-mcp-server
pip install -e .
๐ Quick Start
1. Set Up Credentials
Create a .env file in your project directory:
# Option 1: Copy the example template
curl -O https://raw.githubusercontent.com/cambridgesemantics/anzo-mcp-server/main/.env.example
mv .env.example .env
# Option 2: Create manually
cat > .env << 'EOF'
# Anzo Server Configuration
ANZO_HTTP_BASE=https://your-anzo-server.com
ANZO_PORT=443
ANZO_USERNAME=your-username
ANZO_PASSWORD=your-password
# GraphMart Configuration (optional)
ANZO_GRAPHMART_IRI=http://cambridgesemantics.com/Graphmart/YOUR-GRAPHMART-ID
# Client Configuration (optional)
REQUEST_TIMEOUT=30.0
MAX_RETRIES=3
LOG_LEVEL=INFO
EOF
๐ Security Note: Never commit .env files to version control. The file is automatically excluded via .gitignore.
2. Start the Server
For Claude Desktop (stdio transport):
ags-mcp-stdio
For Cursor IDE / Web Apps (HTTP/SSE transport):
ags-mcp-http
The HTTP server starts on http://127.0.0.1:8000 by default.
3. Verify Connection
The server logs will confirm successful startup:
[info] anzo_client_initialized base_url=https://your-anzo-server.com
[info] mcp_tools_registered
[info] starting_mcp_server tools_count=45
๐ง Client Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"anzo-graphmart": {
"command": "ags-mcp-stdio",
"env": {
"ANZO_HTTP_BASE": "https://your-anzo-server.com",
"ANZO_USERNAME": "your-username",
"ANZO_PASSWORD": "your-password"
}
}
}
}
Cursor IDE
Create .cursor/mcp.json in your workspace:
{
"mcpServers": {
"anzo-graphmart": {
"url": "http://localhost:8000/sse"
}
}
}
Then start the server separately:
ags-mcp-http
Custom MCP Client
stdio Transport
import subprocess
import json
process = subprocess.Popen(
["ags-mcp-stdio"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
env={"MCP_TRANSPORT": "stdio"}
)
# Send MCP requests via stdin, receive responses via stdout
HTTP/SSE Transport
import requests
# Connect to SSE endpoint
response = requests.get("http://localhost:8000/sse", stream=True)
# Send tool requests
requests.post("http://localhost:8000/messages/", json={
"method": "tools/call",
"params": {
"name": "list_graphmarts",
"arguments": {}
}
})
๐ ๏ธ Available Tools
Graphmart Management (11 tools)
| Tool | Description |
|---|---|
list_graphmarts |
List all accessible graphmarts |
get_graphmart_info |
Get detailed graphmart metadata |
create_graphmart |
Create new graphmart with configuration |
modify_graphmart |
Update graphmart properties |
delete_graphmart |
Remove graphmart and all data |
activate_graphmart |
Start graphmart for queries |
deactivate_graphmart |
Stop graphmart |
refresh_graphmart |
Reload changed layers |
reload_graphmart |
Full reload of all layers |
retrieve_graphmart_status |
Check activation state |
retrieve_graphmart_layers |
List graphmart layers |
Layer Operations (10 tools)
| Tool | Description |
|---|---|
list_layers |
List all layers |
get_layer_info |
Get layer details |
create_layer |
Create transformation layer |
modify_layer |
Update layer configuration |
delete_layer |
Remove layer |
get_layer_contents |
Retrieve layer RDF data |
list_layer_steps |
List transformation steps |
create_layer_step |
Add transformation step |
modify_layer_step |
Update step configuration |
delete_layer_step |
Remove step |
Ontology Tools (8 tools)
| Tool | Description |
|---|---|
list_ontologies |
List all ontologies |
get_ontology_info |
Get ontology details |
create_ontology |
Create new ontology |
create_ontology_class |
Add class to ontology |
create_ontology_property |
Add property to ontology |
add_ontology_import |
Import external ontology |
validate_ontology |
Check ontology consistency |
delete_ontology |
Remove ontology |
Dataset Operations (6 tools)
| Tool | Description |
|---|---|
list_datasets |
List all datasets |
get_dataset_info |
Get dataset metadata |
upload_dataset |
Upload RDF data |
modify_dataset |
Update dataset properties |
delete_dataset |
Remove dataset |
get_dataset_contents |
Retrieve dataset data |
Pipeline Management (5 tools)
| Tool | Description |
|---|---|
list_pipelines |
List all pipelines |
create_pipeline |
Create data pipeline |
execute_pipeline |
Run pipeline |
get_pipeline_status |
Check execution status |
delete_pipeline |
Remove pipeline |
Query Execution (5 tools)
| Tool | Description |
|---|---|
execute_sparql_query |
Run SPARQL query |
validate_sparql_query |
Check query syntax |
explain_query_plan |
Get query execution plan |
query_with_inference |
Execute with reasoning |
federated_query |
Query across graphmarts |
๐ Available Prompts
1. Knowledge Graph Linking Overview
Complete methodology index and conceptual guide for knowledge graph linking.
Usage:
Ask Claude: "Show me the knowledge graph linking overview"
2. Ontology & Data Layer Best Practices
Step-by-step guide for building ontologies from data layers.
Usage:
Ask Claude: "How do I create an ontology from my data layer?"
3. SPARQL Query Guide
Comprehensive SPARQL syntax reference with optimization techniques.
Usage:
Ask Claude: "Help me write a SPARQL query to find..."
4. Graphmart Workflow
Complete workflow for creating and managing graphmarts.
Usage:
Ask Claude: "Walk me through creating a new graphmart"
5. Layer Management
Best practices for layer operations and ordering.
Usage:
Ask Claude: "How do I organize my transformation layers?"
6. Dataset Operations
Data upload and management workflows.
Usage:
Ask Claude: "How do I upload CSV data to my graphmart?"
7. AGS Query Lens Guide
Interactive graph visualization and exploration.
Usage:
Ask Claude: "Show me how to visualize my knowledge graph"
8. Cross-Domain Linking
Connecting entities across multiple knowledge domains.
Usage:
Ask Claude: "How do I link customer data with product catalogs?"
9. Internal Linking Guide
Fixing "islands" within a single domain.
Usage:
Ask Claude: "How do I connect isolated entities in my dataset?"
10. Troubleshooting Guide
Common issues and solutions.
Usage:
Ask Claude: "My graphmart won't activate, what's wrong?"
๐ก Usage Examples
Example 1: List All Graphmarts
Natural language request:
"List all available graphmarts"
AI Assistant uses:
{
"tool": "list_graphmarts",
"arguments": {
"expand": "*"
}
}
Response:
[
{
"uri": "http://cambridgesemantics.com/Graphmart/abc123",
"name": "Customer Knowledge Graph",
"status": "ONLINE",
"layers": 5,
"created": "2024-01-15T10:30:00Z"
}
]
Example 2: Execute SPARQL Query
Natural language request:
"Find all customers in New York"
AI Assistant generates and executes:
PREFIX schema: <http://schema.org/>
SELECT ?customer ?name
WHERE {
?customer a schema:Customer ;
schema:name ?name ;
schema:address ?address .
?address schema:addressRegion "NY" .
}
LIMIT 100
Tool call:
{
"tool": "execute_sparql_query",
"arguments": {
"query": "PREFIX schema: <http://schema.org/> ...",
"graphmart_uri": "http://cambridgesemantics.com/Graphmart/abc123"
}
}
Example 3: Create Ontology Class
Natural language request:
"Create a Product class in the ontology"
AI Assistant uses:
{
"tool": "create_ontology_class",
"arguments": {
"ontology_uri": "http://example.com/ontology/retail",
"class_name": "Product",
"label": "Product",
"description": "A product offered for sale"
}
}
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ AI Assistant โโโโโโโโโโบโ Anzo MCP Server โ
โ (Claude/Copilotโ MCP โ (stdio/HTTP) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
โ
โ REST API
โ pyanzo
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Anzo GraphDB โ
โ Knowledge Graph โ
โโโโโโโโโโโโโโโโโโโโ
Components
- MCP Server: Exposes tools and prompts via MCP protocol
- Anzo Client: REST API wrapper for graph operations
- pyanzo: Native SPARQL query execution
- Transport Layer: stdio for desktop, HTTP/SSE for web
๐ Security Best Practices
Credential Management
โ DO:
- Store credentials in
.envfiles (automatically excluded from git) - Use environment variables in production
- Rotate passwords regularly
- Use service accounts with minimal permissions
โ DON'T:
- Hardcode credentials in code
- Commit
.envfiles to git - Share credentials in chat logs
- Use admin accounts for MCP access
Pre-Release Security Check
Always run before publishing:
python check_credentials.py
Verifies:
- No credentials in source code
.envfiles properly excluded- Configuration templates are clean
Production Deployment
Docker:
FROM python:3.11-slim
WORKDIR /app
RUN pip install ags-mcp-server
# Use secrets management
ENV ANZO_HTTP_BASE=${ANZO_HTTP_BASE}
ENV ANZO_USERNAME=${ANZO_USERNAME}
ENV ANZO_PASSWORD=${ANZO_PASSWORD}
CMD ["ags-mcp-http"]
Kubernetes:
apiVersion: v1
kind: Secret
metadata:
name: anzo-credentials
type: Opaque
stringData:
ANZO_USERNAME: your-username
ANZO_PASSWORD: your-password
---
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- name: anzo-mcp
image: ags-mcp-server:latest
envFrom:
- secretRef:
name: anzo-credentials
๐ Troubleshooting
Server Won't Start
Issue: ANZO_USERNAME environment variable must be set
Solution:
# Verify .env file exists
ls -la .env
# Check contents
cat .env
# Ensure server reads .env
cd /path/to/project
ags-mcp-http
Connection Timeout
Issue: Max retries exceeded with url: /api/graphmarts
Solutions:
- Verify Anzo server is reachable:
curl -u username:password https://your-anzo-server.com/api/graphmarts
- Check firewall/VPN settings
- Increase timeout in
.env:REQUEST_TIMEOUT=60.0 MAX_RETRIES=5
Claude Desktop Not Finding Tools
Issue: Tools don't appear in Claude Desktop
Solutions:
- Restart Claude Desktop completely
- Check config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- Verify JSON syntax:
python -m json.tool < claude_desktop_config.json
SPARQL Query Fails
Issue: SPARQL query failed: ParseException
Solutions:
- Validate query syntax:
Ask Claude: "Validate this SPARQL query: [your query]" - Check prefix declarations
- Verify graphmart is activated:
{"tool": "retrieve_graphmart_status", "arguments": {"graphmart_uri": "..."}}
๐ Documentation
- GitHub Repository: https://github.com/cambridgesemantics/anzo-mcp-server
- Anzo Documentation: https://docs.cambridgesemantics.com/anzo/
- MCP Specification: https://modelcontextprotocol.io/
- PyPI Package: https://pypi.org/project/ags-mcp-server/
๐ค Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Setup
# Clone repository
git clone https://github.com/cambridgesemantics/anzo-mcp-server.git
cd anzo-mcp-server
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Run security check
python check_credentials.py
# Format code
black ags_mcp/
# Type checking
mypy ags_mcp/
๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
๐ Acknowledgments
- Anzo Graph Database by Cambridge Semantics
- Model Context Protocol by Anthropic
- FastMCP framework
- pyanzo SPARQL client
๐ง Support
- Issues: https://github.com/cambridgesemantics/anzo-mcp-server/issues
- Discussions: https://github.com/cambridgesemantics/anzo-mcp-server/discussions
- Email: support@cambridgesemantics.com
๐บ๏ธ Roadmap
- Additional SPARQL optimization hints
- Bulk data upload operations
- GraphQL query support
- Real-time change notifications
- Multi-tenant isolation
- Performance metrics and monitoring
- Integration tests with live Anzo instance
- Docker Compose quickstart
- Helm chart for Kubernetes
Made with โค๏ธ by the Cambridge Semantics team
Project details
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 ags_mcp_server-1.1.0.tar.gz.
File metadata
- Download URL: ags_mcp_server-1.1.0.tar.gz
- Upload date:
- Size: 52.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd4fb634ea79ef7b7097ebc0363b9912c294d684e35f38e13e199aef7afe74a5
|
|
| MD5 |
bb6e0a8921900443c0afb1e2177895c6
|
|
| BLAKE2b-256 |
1e4d0528e4251a86e696205f5a86831c9d51d7141ac498e57317e771cdbee915
|
File details
Details for the file ags_mcp_server-1.1.0-py3-none-any.whl.
File metadata
- Download URL: ags_mcp_server-1.1.0-py3-none-any.whl
- Upload date:
- Size: 50.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0083b0f35a18331a2b2745c6351636003bdacfce24d3f4b7a9e83d75ecca3f7d
|
|
| MD5 |
d2eb31e18f3b459f9737452fba54ef84
|
|
| BLAKE2b-256 |
d8028a7ef8648af2b3e81138d8e1adf20960d9621c28a9042cb23b5c869d7976
|