- Home
- MCP servers
- Wikidata SPARQL
Wikidata SPARQL
- javascript
0
GitHub Stars
javascript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can query Wikidata through a dedicated MCP server that exposes Wikidata’s SPARQL endpoint via a Model Context Protocol interface. This server lets you run SPARQL introspection and data queries over SSE or HTTP, with multiple output formats and built-in timeout protection to keep your queries responsive.
How to use
To use this MCP server, connect with an MCP client that supports HTTP or SSE transport. Choose the transport that fits your workflow: use SSE when you want streaming query results and incremental updates, or use HTTP for standard request/response interactions. You can perform introspection queries to understand the available capabilities, or run full SPARQL queries to retrieve data from Wikidata in your preferred format.
For common tasks, you will typically configure your MCP client to point at either the SSE endpoint or the HTTP endpoint, then send a SPARQL query along with the desired output format and a timeout to prevent long-running queries. Supported formats include JSON, XML, Turtle, and CSV. If a query takes longer than the configured timeout, it will be aborted automatically to protect resources.
How to install
Prerequisites: you need Node.js and npm installed on your machine. You can verify by running node -v and npm -v in your terminal.
Clone the project repository, install dependencies, and start the local server for development.
git clone https://github.com/QuentinCody/wikidata-sparql-mcp-server.git
cd wikidata-sparql-mcp-server
npm install
npm start
Additional sections
Configuration and usage details focus on two main connection methods: an HTTP/SSE endpoint for remote clients and a local development flow for testing. The server supports a unified tool named sparql_query that handles both introspection and data retrieval.
Security and reliability are addressed via query timeouts and validation to prevent malformed queries from overloading the system. If the Wikidata endpoint is temporarily unavailable, the MCP server returns descriptive errors and attempts to recover gracefully.
Examples demonstrate how you can run queries against Wikidata, including retrieving human-related data, programming language information, or Nobel Prize context. Use the supported formats to suit downstream consumers.
Client configuration samples help you wire up common MCP clients. The following configuration blocks show how to connect via an MCP client that supports both http/sse transports.
{
"mcpServers": {
"wikidata_sparql": {
"type": "http",
"name": "wikidata_sparql_http",
"url": "https://wikidata-sparql-mcp-server.<your-account>.workers.dev/sse",
"args": []
}
}
}
{
"mcpServers": {
"wikidata_sparql": {
"type": "stdio",
"name": "wikidata_sparql_local",
"command": "npm",
"args": ["start"]
}
}
}
Available tools
sparql_query
Executes SPARQL queries against the Wikidata knowledge graph with support for both introspection and data retrieval. Allows specifying output format (json, xml, turtle, csv) and a configurable timeout.