mcpField
M
mcp-sparql

mcp-sparql

Local
github.com/daedalusDatabases0Updated 19w ago

About mcp-sparql

mcp-sparql is an MCP server for querying SPARQL endpoints, aimed at LLM-based workflows that work with RDF data. It supports several query forms, syntax validation, and endpoint graph and prefix discovery.

Key features

  1. 01Run SELECT queries with table or JSON output
  2. 02Run ASK, CONSTRUCT, and DESCRIBE queries
  3. 03Validate query syntax without execution
  4. 04List named graphs and common prefixes
  5. 05Set timeouts, row limits, and HTTP headers

Use cases

  1. 01Query datasets such as Wikidata
  2. 02Check whether an RDF entity matches a condition
  3. 03Validate SPARQL before running it

MCP support

It exposes SPARQL query and endpoint discovery tools to MCP clients, along with a common-prefix resource.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"daedalus-mcp-sparql": {
"command": "uvx",
"args": [
"mcp-sparql"
]
}
}
}
Run commanduvx mcp-sparql

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypimcp-sparql0.1.0

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

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
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

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/

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.