mcp -sparql
An MCP server for querying SPARQL endpoint.
claude mcp add --transport stdio ekzhu-mcp-server-sparql uvx mcp-server-sparql --endpoint https://query.wikidata.org/sparql
How to use
This MCP server provides a SPARQL querying interface for a configured SPARQL endpoint. The example uses the Wikidata SPARQL endpoint, enabling you to run SPARQL queries against a live data source via the MCP framework. The server exposes a tool named 'query' that accepts a SPARQL query string and returns results in JSON format. To use it, start the server with the uvx runner and then invoke the query tool with your SPARQL string to retrieve results.
Once running, you can send a SPARQL query to the endpoint, for example by passing a valid SELECT query to the query tool. The MCP layer handles communicating with the endpoint, performing the query, and returning the JSON results, so you don’t need to manage endpoint connections directly in your client code.
How to install
Prerequisites
- Python 3.8+ installed on your system
- Access to install Python packages (pip or pipx)
Installation steps
- Install the uvx runner (example using pipx):
pipx install uvx
- Verify installation:
uvx --version
-
Create the MCP configuration file (optional but recommended to document endpoints). You can reuse the example from the README or adapt the endpoint as needed. Save as mcp-config.json (or another name you prefer).
-
Run the MCP server using the configuration. With the provided endpoint example, you can start the server as:
uvx mcp-server-sparql --endpoint https://query.wikidata.org/sparql
- Interact with the server via its tools (e.g., the 'query' tool) by supplying a SPARQL string. For example:
SELECT ?item WHERE { ?item a ?type } LIMIT 10
Notes:
- Ensure the endpoint URL is reachable from your network and supports SPARQL over HTTP/HTTPS.
- You may need to add environment variables for authentication or quotas if your endpoint requires them.
Additional notes
Tips and common considerations:
- Endpoint stability: Public SPARQL endpoints may rate-limit or throttle queries; plan for retry/backoff in client apps.
- Timeout handling: SPARQL queries can be long-running; configure timeouts appropriately for production use.
- Endpoint security: Use HTTPS endpoints when possible and avoid sending sensitive queries over unsecured networks.
- Environment variables: If your deployment environment requires, you can pass additional options or credentials via environment variables supported by uvx or your runtime configuration.
- Documentation: Keep the mcp-server-sparql endpoint updated in your config if the remote endpoint changes (e.g., different query URL or parameters).
- Debugging: If queries fail, test the endpoint directly with a simple curl or a SPARQL client to isolate issues between the MCP layer and the endpoint.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP