Skip to main content

mcp-sparql — MCP server exposing SPARQL query functionalities for LLMs.

PyPI Python Ruff

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 URL
  • query (str): SPARQL SELECT query
  • timeout (int, default=30): Query timeout in seconds
  • output_format (str, default="table"): "table" for Markdown, "json" for JSON
  • headers (dict, optional): HTTP headers for authentication
  • max_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/

Metadata

Release files for mcp-sparql 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-sparql 0.1.0
File Size Uploaded Provenance Actions
mcp_sparql-0.1.0.tar.gz 9.4 kB With provenance Details for mcp_sparql-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-sparql 0.1.0
File Interpreter ABI Platform Actions
mcp_sparql-0.1.0-py3-none-any.whl Python 3 none any Details for mcp_sparql-0.1.0-py3-none-any.whl

Total release size: 21.1 kB

Release files / mcp_sparql-0.1.0.tar.gz

Download URL mcp_sparql-0.1.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
844fc3bb32154672dabb4dca3e83cb280f19d07bef5a9fdcca500e5a340d55a9
BLAKE2b-256 checksum
How to use checksums
301d5a09fefe7e649bb21ca67f7f47aafba9dc45c02583c771d81d93ae43365c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.

Transparency log

Release files / mcp_sparql-0.1.0-py3-none-any.whl

Download URL mcp_sparql-0.1.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e216f303285dc5f07f15313aa955ef9f12cb08dc51cd73247a205e9ddef39f35
BLAKE2b-256 checksum
How to use checksums
8d26dbbc42b56a24a3718e03a05fcacd806d1255ecea0ec1a522bb9cc5f5f2df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.

Transparency log

Security for mcp-sparql 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcp_sparql-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page