Get the FREE Ultimate OpenClaw Setup Guide →

mcp-wikidata

A server implementation for Wikidata API using the Model Context Protocol (MCP).

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio zzaebok-mcp-wikidata uvx zzaebok/mcp-wikidata \
  --env UV_ENV_PLACEHOLDER="Set up environment variables if required by the uvx runtime"

How to use

The Wikidata MCP Server exposes tools to interact with Wikidata through the Model Context Protocol (MCP). It provides a set of tools to search for Wikidata identifiers, fetch metadata, and run SPARQL queries against Wikidata. Specifically, you can use: search_entity(query: str) to find entity IDs, search_property(query: str) to locate property IDs, get_properties(entity_id: str) to retrieve an entity's properties, execute_sparql(sparql_query: str) to run custom SPARQL queries, and get_metadata(entity_id: str, language: str = "en") to obtain the English label and description. Clients using MCP can chain these tools to, for example, identify an entity, inspect its properties to determine a suitable property for a query, and fetch results or metadata for presentation. The server supports practical workflows such as extracting a label/description in English for display and running SPARQL to fetch related entities or attributes.

How to install

Prerequisites:

  • git
  • Python environment (recommended) or uv runtime as per your setup
  • Internet access to install dependencies from Wikidata and PyPI

Manual installation steps:

  1. Clone the repository:
git clone https://github.com/zzaebok/mcp-wikidata.git
cd mcp-wikidata
  1. Install runtime (example using uv) if not already installed:
# On macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Install dependencies (Python project setup assumed by uv workflow):
uv sync
  1. Run the server (as shown in the README example):
uv run src/server.py

If you want to test with a sample client:

uv run src/client.py

Alternative: If you prefer Smithery for automated deployment, install via Smithery:

npx -y @smithery/cli install @zzaebok/mcp-wikidata --client claude

Additional notes

Notes and tips:

  • The server relies on Wikidata’ s public API for search, properties, and SPARQL execution. Ensure network access is allowed to wikidata.org.
  • If you encounter language-specific metadata, try get_metadata with language set to the desired ISO language code (default is en).
  • When testing SPARQL, keep queries simple to avoid long runtimes and to ensure reliable responses in client workflows.
  • If using the uv-based run method, ensure uv is properly installed and available in your PATH. The README provides a quick install script for uv.
  • The MCP tool list includes: search_entity, search_property, get_properties, execute_sparql, get_metadata. These can be composed in a client pipeline to perform end-to-end tasks such as finding a director, pulling their entity, and querying for related films.

Related MCP Servers

Sponsor this space

Reach thousands of developers