mcp-server-sparql
Allows interaction with Amazon Neptune SPARQL endpoints (part of AWS), enabling querying and updating RDF datasets using SPARQL SELECT, ASK, CONSTRUCT, DESCRIBE, and UPDATE operations, plus graph management and SHACL validation.
Allows interaction with Apache Jena Fuseki SPARQL endpoints, enabling querying and updating RDF datasets using SPARQL SELECT, ASK, CONSTRUCT, DESCRIBE, and UPDATE operations, plus graph management and SHACL validation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-sparqllist all named graphs"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-sparql
A generic Model Context Protocol (MCP) server that connects AI agents to any SPARQL 1.1 endpoint.
Works with Apache Jena Fuseki · GraphDB · Stardog · Virtuoso · Amazon Neptune · Blazegraph — or any endpoint that speaks SPARQL 1.1.
Tools
Tool | Description |
| Execute a SELECT query → tabular rows; paginate with |
| Execute an ASK query → boolean; fast existence/reachability checks |
| Execute a CONSTRUCT query → RDF graph string |
| DESCRIBE a resource URI → all triples about it |
| Any SPARQL 1.1 Update: INSERT DATA, DELETE, CLEAR, DROP, LOAD, COPY, MOVE, ADD |
| List all named graphs with triple counts |
| Fetch a named graph as Turtle; paginated |
| Replace a named graph (inline content or remote URL via server-side LOAD) |
| Append to a named graph |
| Delete a named graph |
| Validate RDF against SHACL shapes — pure function, no endpoint needed |
| Check connectivity; returns response time and configured URLs |
Connection is configured once at the server level via environment variables. Tools take no connection parameters — the same pattern used by mcp-server-postgres and mcp-server-sqlite.
Related MCP server: Ontology MCP
Quickstart
git clone https://github.com/Kashif-Rabbani/mcp-server-sparql.git
cd mcp-server-sparql
pip install -e .
cp .env.example .env
# edit .env — set SPARQL_ENDPOINT (or the three explicit URL vars)
python server.pyServer starts on http://0.0.0.0:8000. The SSE endpoint is at /sse.
Configuration
Copy .env.example to .env and set one of:
Option A — single base URL (Fuseki / Stardog):
SPARQL_ENDPOINT=http://localhost:3030/myDatasetThis auto-derives /query, /update, and /data suffixes.
Option B — explicit URLs (GraphDB, Virtuoso, Neptune, etc.):
SPARQL_QUERY_URL=http://localhost:7200/repositories/myrepo
SPARQL_UPDATE_URL=http://localhost:7200/repositories/myrepo/statements
SPARQL_GRAPH_STORE_URL=http://localhost:7200/repositories/myrepo/rdf-graphs/serviceAuth (optional):
SPARQL_USERNAME=admin
SPARQL_PASSWORD=secretEndpoint-specific notes
Endpoint | Option | Query URL pattern |
Apache Jena Fuseki | A |
|
Stardog | A |
|
GraphDB | B |
|
Amazon Neptune | B |
|
Virtuoso | B |
|
Blazegraph | B |
|
Connect to an MCP client
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"sparql": {
"command": "uvicorn",
"args": ["server:app", "--host", "0.0.0.0", "--port", "8000"],
"cwd": "/path/to/mcp-server-sparql",
"env": {
"SPARQL_ENDPOINT": "http://localhost:3030/myDataset"
}
}
}
}Vectara Agent Platform
Register the server as an MCP Tool Server pointing at the public SSE URL (use ngrok for local development):
ngrok http 8000
# then register https://<id>.ngrok-free.app/sse as an MCP tool server in VectaraRequirements
Python 3.11+
A running SPARQL 1.1 endpoint
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kashif-Rabbani/mcp-server-sparql'
If you have feedback or need assistance with the MCP directory API, please join our Discord server