MCP server exposing SPARQL query functionalities for LLMs
Project description
mcp-sparql — MCP server exposing SPARQL query functionalities for LLMs.
mcp-name: io.github.daedalus/mcp-sparql
Install
pip install mcp-sparql
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 |
|---|---|
sparql_query |
Execute SPARQL SELECT queries (table or JSON output) |
sparql_ask |
Execute SPARQL ASK queries (boolean result) |
sparql_construct |
Execute SPARQL CONSTRUCT queries (Turtle or JSON-LD) |
sparql_describe |
Execute SPARQL DESCRIBE queries (Turtle or JSON-LD) |
sparql_validate |
Validate SPARQL query syntax without executing |
sparql_list_graphs |
List named graphs on a SPARQL endpoint |
sparql_get_prefixes |
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 | sparql://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/
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 mcp_sparql-0.1.0.tar.gz.
File metadata
- Download URL: mcp_sparql-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
844fc3bb32154672dabb4dca3e83cb280f19d07bef5a9fdcca500e5a340d55a9
|
|
| MD5 |
b23444da6d17f78f60acc8fe3ac9d070
|
|
| BLAKE2b-256 |
301d5a09fefe7e649bb21ca67f7f47aafba9dc45c02583c771d81d93ae43365c
|
Provenance
The following attestation bundles were made for mcp_sparql-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on daedalus/mcp-sparql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_sparql-0.1.0.tar.gz -
Subject digest:
844fc3bb32154672dabb4dca3e83cb280f19d07bef5a9fdcca500e5a340d55a9 - Sigstore transparency entry: 1853957974
- Sigstore integration time:
-
Permalink:
daedalus/mcp-sparql@90602e9827e80777e43aecd9ce9adf4f6617df62 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@90602e9827e80777e43aecd9ce9adf4f6617df62 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcp_sparql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_sparql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e216f303285dc5f07f15313aa955ef9f12cb08dc51cd73247a205e9ddef39f35
|
|
| MD5 |
05844b286da2245b7f51f1a0270e523b
|
|
| BLAKE2b-256 |
8d26dbbc42b56a24a3718e03a05fcacd806d1255ecea0ec1a522bb9cc5f5f2df
|
Provenance
The following attestation bundles were made for mcp_sparql-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on daedalus/mcp-sparql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_sparql-0.1.0-py3-none-any.whl -
Subject digest:
e216f303285dc5f07f15313aa955ef9f12cb08dc51cd73247a205e9ddef39f35 - Sigstore transparency entry: 1853958007
- Sigstore integration time:
-
Permalink:
daedalus/mcp-sparql@90602e9827e80777e43aecd9ce9adf4f6617df62 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@90602e9827e80777e43aecd9ce9adf4f6617df62 -
Trigger Event:
release
-
Statement type: