Mcp Sparql

io.github.daedalusPublished by GitHub account daedalusv0.1.0Updated Oct 25, 2026

MCP server exposing SPARQL query functionalities for LLMs

Overview

AI-generated overview

A local MCP server that lets an assistant run SPARQL queries against RDF endpoints such as Wikidata and return results as tables or JSON.

What you can do
Run SELECT queries against a SPARQL endpoint and get Markdown tables or JSON, with timeout and row limits. Run ASK queries for true/false checks and CONSTRUCT or DESCRIBE queries for RDF triples in Turtle or JSON-LD. Validate SPARQL syntax without executing it. List named graphs and fetch common prefixes for an endpoint, plus a built-in resource of standard namespace prefixes.
When to use it
Useful when you want an assistant to explore linked-data or RDF sources like Wikidata, check whether an entity or fact exists, or draft and syntax-check SPARQL before running it.
Requirements
A local Python environment with the mcp-sparql package installed from PyPI, launched as a stdio process. Network access to whichever SPARQL endpoint you query; no accounts or keys are declared, though endpoints may need HTTP headers passed per call.
Before you install
Queries are sent to third-party SPARQL endpoints you name, so the query text and any headers you supply go to that host. Authentication headers can be passed per call, so avoid putting secrets in queries or logs. Large or expensive queries can be slow or rate-limited by the endpoint; row and timeout limits apply.

Installation

In SourceWeft

  1. Open Mcp Sparql in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

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

[PyPI] [Python] [Ruff]

mcp-name: io.github.daedalus/mcp-sparql

Install

bash
pip install mcp-sparql

Usage

As an MCP Server

Add to your MCP configuration (e.g., ~/.config/claude/mcp.json):

json
{  "mcpServers": {    "mcp-sparql": {      "command": "mcp-sparql"    }  }}

Available Tools

ToolDescription
sparql_queryExecute SPARQL SELECT queries (table or JSON output)
sparql_askExecute SPARQL ASK queries (boolean result)
sparql_constructExecute SPARQL CONSTRUCT queries (Turtle or JSON-LD)
sparql_describeExecute SPARQL DESCRIBE queries (Turtle or JSON-LD)
sparql_validateValidate SPARQL query syntax without executing
sparql_list_graphsList named graphs on a SPARQL endpoint
sparql_get_prefixesGet 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

ResourceURIDescription
Common Prefixessparql://common-prefixesStandard 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

bash
git clone https://github.com/daedalus/mcp-sparql.gitcd mcp-sparqlpip install -e ".[test]"
# run testspytest
# formatruff format src/ tests/
# lint + type checkprospector --with-tool ruff --with-tool mypy --with-tool pylint src/

Source: README.md at commit 093080a

Tools

0
SourceWeft has not started this package in its sandbox yet, so its tools are not known.

Version history

1
  1. v0.1.0LatestSep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts