1. Conduid
  2. Developer Tools
  3. Wikidata SPARQL
MCP server · Developer Tools

Wikidata SPARQL

Unofficial REMOTE MCP server for Wikidata's SPARQL endpoint, providing access to structured knowledge data, entity relationships, and semantic queries for research and data analysis.

Unclaimed devtools
39Low

Scored 5 hours ago · breakdown

About Wikidata SPARQL

Wikidata SPARQL is an MCP server published by QuentinCody in the Developer Tools category: unofficial REMOTE MCP server for Wikidata's SPARQL endpoint, providing access to structured knowledge data, entity relationships, and semantic queries for research and data analysis.

The repository has 3 stars and 0 forks, with the last commit 4 months ago. Recent commit activity is the strongest signal that reported issues will get attention.

Install

From source
git clone https://github.com/QuentinCody/wikidata-sparql-mcp-server

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (5)

federated_sparql_queryExecute a federated SPARQL query spanning the main and scholarly Wikidata graphs. Use internal subgraph federation: SERVICE wdsubgraph:wikidata_main { ... } or SERVICE wdsubgraph:scholarly_articles { ... }. If a federated query is slow, add `hint:Query hint:optimizer

Parameters not published.

fetch_results_pageFetch a page of a previously staged SPARQL result. When sparql_query / federated_sparql_query return a resultId (because the result was large), pass it here to page through the rows.

Parameters not published.

get_entity_infoGet a compact, readable summary of a Wikidata entity by ID: label, description, aliases, and its statements with property/value IDs resolved to labels. Far smaller than the raw entity dump. Use this (not SPARQL) when you already know the Q-id or P-id.

Parameters not published.

search_entitiesSearch Wikidata for items or PROPERTIES by name/label. Returns a compact list of matching IDs with labels and descriptions — much faster than SPARQL for resolving a name to an ID. To discover a property

Parameters not published.

sparql_queryExecute a SPARQL query against Wikidata and get back a compact results table (URIs shortened to wd:/wdt: form). For finding an entity or property by name, prefer search_entities. Tip: add SERVICE wikibase:label { bd:serviceParam wikibase:language

Parameters not published.

Ask AI

✦

Ask AI about Wikidata SPARQL

Powered by Claude · Grounded in docs

I know everything about Wikidata SPARQL. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository 5 hours ago. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • !License declaredNo license file. Legally you have no right to use it in a product.
  • ✓Tests presentA test suite exists in the repository.
  • ✓Dependencies pinnedA lockfile pins dependency versions.
  • ✓No dynamic code executionSource scan found no eval, dynamic Function, or shell execution.
  • !Scoped permissionsDoesn't declare a permission scope. Assume it can do anything its process can.

README

Wikidata SPARQL MCP Server

A Model Context Protocol (MCP) server providing access to the Wikidata knowledge graph via SPARQL queries. This server runs on Cloudflare Workers and supports both Server-Sent Events (SSE) and standard HTTP transport for remote MCP deployments.

Features

  • Single Unified Tool: One powerful sparql_query tool that handles both introspection and data queries
  • Comprehensive SPARQL Support: Execute any SPARQL query against Wikidata's knowledge graph
  • Multiple Output Formats: JSON, XML, Turtle, and CSV result formats
  • Timeout Protection: Configurable query timeouts (1-60 seconds) to prevent runaway queries
  • Remote Deployment: Deployed on Cloudflare Workers for global accessibility
  • Dual Transport Support: Both SSE and HTTP endpoints for maximum compatibility

Quick Start

Deploy to Cloudflare Workers

Deploy to Workers

This will deploy your MCP server to a URL like: wikidata-sparql-mcp-server.<your-account>.workers.dev/sse

Alternatively, clone and deploy manually:

git clone https://github.com/QuentinCody/wikidata-sparql-mcp-server.git
cd wikidata-sparql-mcp-server
npm install
npm run deploy

Local Development

npm install
npm start  # Runs on http://localhost:8787

MCP Tool Reference

sparql_query

Execute SPARQL queries against the Wikidata knowledge graph with support for both introspection and data retrieval.

Parameters:

  • query (string, required): The SPARQL query to execute
  • format (enum, optional): Output format - "json" (default), "xml", "turtle", or "csv"
  • timeout (number, optional): Query timeout in seconds (1-60, default: 30)

Example Queries:

Introspection Examples

# Describe what a human is in Wikidata
DESCRIBE wd:Q5

# Get all properties available for humans
SELECT DISTINCT ?property ?propertyLabel WHERE {
  wd:Q5 ?property ?value .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}

Data Query Examples

# Get 10 famous scientists
SELECT ?scientist ?scientistLabel ?birthDate WHERE {
  ?scientist wdt:P31 wd:Q5 ;           # instance of human
             wdt:P106 wd:Q901 ;         # occupation: scientist
             wdt:P569 ?birthDate .      # birth date
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
} 
ORDER BY ?birthDate
LIMIT 10

# Find all programming languages and their creators
SELECT ?language ?languageLabel ?creator ?creatorLabel WHERE {
  ?language wdt:P31 wd:Q9143 ;         # instance of programming language
            wdt:P178 ?creator .         # developer
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
LIMIT 20

Boolean Check Examples

# Check if humans are living beings
ASK { wd:Q5 wdt:P279 wd:Q35120 }

# Check if a specific person exists
ASK { wd:Q937 ?p ?o }  # Albert Einstein

Client Configuration

Claude Desktop

Add this configuration to Claude Desktop's MCP settings:

{
  "mcpServers": {
    "wikidata-sparql": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://wikidata-sparql-mcp-server.<your-account>.workers.dev/sse"
      ]
    }
  }
}

Cloudflare AI Playground

  1. Go to https://playground.ai.cloudflare.com/
  2. Enter your deployed server URL: wikidata-sparql-mcp-server.<your-account>.workers.dev/sse
  3. Start querying the Wikidata knowledge graph!

Generic MCP Client

For any MCP client supporting HTTP/SSE transport:

  • SSE Endpoint: https://your-domain.workers.dev/sse
  • HTTP Endpoint: https://your-domain.workers.dev/mcp

SPARQL Query Examples by Use Case

Research & Academia

# Find Nobel Prize winners in Physics
SELECT ?winner ?winnerLabel ?year WHERE {
  ?award wdt:P31 wd:Q7191 ;            # Nobel Prize in Physics
         wdt:P585 ?year ;              # point in time
         wdt:P1346 ?winner .           # winner
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY DESC(?year)
LIMIT 10

Geography & Demographics

# Countries and their capitals
SELECT ?country ?countryLabel ?capital ?capitalLabel WHERE {
  ?country wdt:P31 wd:Q3624078 ;       # sovereign state
           wdt:P36 ?capital .          # capital
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
LIMIT 50

Technology & Innovation

# Software companies founded after 2000
SELECT ?company ?companyLabel ?founded WHERE {
  ?company wdt:P31 wd:Q936518 ;        # software company
           wdt:P571 ?founded .         # inception
  FILTER(YEAR(?founded) > 2000)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY DESC(?founded)
LIMIT 20

Error Handling

The server provides comprehensive error handling:

  • Timeout Protection: Queries exceeding the timeout limit are automatically aborted
  • SPARQL Validation: Invalid queries return descriptive error messages
  • Network Resilience: Handles Wikidata endpoint unavailability gracefully
  • Format Validation: Ensures output format compatibility

Architecture

  • Base: Cloudflare Workers with Durable Objects
  • MCP Framework: Model Context Protocol SDK with Cloudflare Agents
  • Transport: SSE (Server-Sent Events) and HTTP support
  • Query Engine: Direct integration with Wikidata's SPARQL endpoint

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with various SPARQL queries
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Related Resources

README fetched from the repository 5 hours ago. The original is authoritative.

Questions

About Wikidata SPARQL

How do I install Wikidata SPARQL?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Wikidata SPARQL safe to use with an AI agent?

Its trust score is 39 out of 100 (low). It passes 4 of the 6 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Wikidata SPARQL still maintained?

Yes — the last commit was 4 months ago. The repository has 3 stars and 0 forks and 1 open issues.