mcp-sparql
Provides tools for executing SPARQL queries (SELECT, ASK, CONSTRUCT, DESCRIBE) on Wikidata's SPARQL endpoint, enabling AI agents to retrieve structured data, validate queries, list graphs, and get common prefixes.
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-sparqlquery Wikidata for cities in France"
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-sparql — MCP server exposing SPARQL query functionalities for LLMs.
mcp-name: io.github.daedalus/mcp-sparql
Install
pip install mcp-sparqlRelated MCP server: RDF Explorer
Usage
As an MCP Server
Add to your MCP configuration (e.g., ~/.config/claude/mcp.json):
{
"mcpServers": {
"mcp-sparql": {
"command": "mcp-sparql"
}
}
}Available Tools
Tool | Description |
| Execute SPARQL SELECT queries (table or JSON output) |
| Execute SPARQL ASK queries (boolean result) |
| Execute SPARQL CONSTRUCT queries (Turtle or JSON-LD) |
| Execute SPARQL DESCRIBE queries (Turtle or JSON-LD) |
| Validate SPARQL query syntax without executing |
| List named graphs on a SPARQL endpoint |
| Get common prefixes for a SPARQL endpoint |
Examples
Query Wikidata:
sparql_query:
endpoint: "https://query.wikidata.org/sparql"
query: "SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q5 . ?item rdfs:label ?itemLabel . FILTER(LANG(?itemLabel) = 'en') } LIMIT 5"Check if an entity exists:
sparql_ask:
endpoint: "https://query.wikidata.org/sparql"
query: "ASK { wd:Q42 wdt:P31 wd:Q5 }"Validate a query:
sparql_validate:
query: "SELECT ?s WHERE { ?s ?p ?o }"List named graphs:
sparql_list_graphs:
endpoint: "https://query.wikidata.org/sparql"Get common prefixes:
sparql_get_prefixes:
endpoint: "https://query.wikidata.org/sparql"Resources
Resource | URI | Description |
Common Prefixes |
| Standard SPARQL namespace prefixes |
API
sparql_query
Execute a SPARQL SELECT query.
Parameters:
endpoint(str): SPARQL endpoint URLquery(str): SPARQL SELECT querytimeout(int, default=30): Query timeout in secondsoutput_format(str, default="table"): "table" for Markdown, "json" for JSONheaders(dict, optional): HTTP headers for authenticationmax_rows(int, default=1000): Maximum result rows
sparql_ask
Execute a SPARQL ASK query. Returns "true" or "false".
sparql_construct
Execute a SPARQL CONSTRUCT query. Returns RDF triples.
Additional parameters:
output_format(str, default="turtle"): "turtle" or "json"
sparql_describe
Execute a SPARQL DESCRIBE query. Returns RDF description.
sparql_validate
Validate SPARQL query syntax without executing.
sparql_list_graphs
List available named graphs on a SPARQL endpoint.
sparql_get_prefixes
Get commonly used prefixes for a SPARQL endpoint.
Development
git clone https://github.com/daedalus/mcp-sparql.git
cd mcp-sparql
pip install -e ".[test]"
# run tests
pytest
# format
ruff format src/ tests/
# lint + type check
prospector --with-tool ruff --with-tool mypy --with-tool pylint src/Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityCmaintenanceA Model Context Protocol server that provides read-only access to Ontotext GraphDB, enabling LLMs to explore RDF graphs and execute SPARQL queries.2916GPL 3.0
- Alicense-qualityFmaintenanceThe Model Context Protocol (MCP) server provides a conversational interface for the exploration and analysis of RDF Turtle Knowledge Graph in Local File mode or SPARQL Endpoint.54MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables AI-powered exploration of RDF data and SPARQL querying via RDF4J. It provides tools for executing queries, searching knowledge graph resources, and retrieving schema summaries.131MIT
- AlicenseAqualityAmaintenanceAI-native ontology engineering MCP server for OWL/RDF/SPARQL. Validate, query, diff, lint, version, and govern knowledge graphs via Oxigraph triple store.42341MIT
Related MCP Connectors
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
MCP server for AI dialogue using various LLM models via AceDataCloud
Hosted MCP server for LLM cost estimation, model comparison, and budget-aware routing.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- 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/daedalus/mcp-sparql'
If you have feedback or need assistance with the MCP directory API, please join our Discord server