by zzaebok
mcp-wikidata is a server implementation for the Wikidata API using the Model Context Protocol (MCP), providing tools to interact with Wikidata for searching, extracting metadata, and executing SPARQL queries.
mcp-wikidata is a server implementation that allows interaction with the Wikidata API through the Model Context Protocol (MCP). It provides a set of tools to programmatically access and retrieve information from Wikidata, making it easier to integrate Wikidata's vast knowledge base into applications.
Via Smithery:
npx -y @smithery/cli install @zzaebok/mcp-wikidata --client claude
Manually:
uv
:$ curl -LsSf https://astral.sh/uv/install.sh | sh
$ git clone https://github.com/zzaebok/mcp-wikidata.git
$ cd mcp-wikidata
$ uv sync
# if you want to run client example together
$ uv sync --extra example
$ uv run src/server.py
# in another shell
$ uv run src/client.py
mcp-wikidata provides the following tools for interacting with Wikidata:
search_entity(query: str)
: Search for a Wikidata entity ID using a query string.search_property(query: str)
: Search for a Wikidata property ID using a query string.get_properties(entity_id: str)
: Retrieve all properties associated with a given Wikidata entity ID.execute_sparql(sparql_query: str)
: Execute a SPARQL query directly on Wikidata.get_metadata(entity_id: str, language: str = "en")
: Get the English label and description for a specified Wikidata entity ID.Q: What is the Model Context Protocol (MCP)? A: The Model Context Protocol (MCP) is a framework that allows models (like large language models) to interact with external tools and services. mcp-wikidata implements this protocol to enable seamless communication between AI models and the Wikidata API.
Q: Can I use mcp-wikidata with other AI frameworks?
A: While the example shows integration with langchain-mcp-adapters
, the underlying MCP design aims for broader compatibility, allowing integration with various AI frameworks that support external tool calls.
Q: What kind of queries can I perform with mcp-wikidata? A: You can perform entity and property searches, retrieve associated properties, and execute complex SPARQL queries, giving you extensive control over the data you retrieve from Wikidata.
Q: Is there a client example available?
A: Yes, a simple client example is provided (src/client.py
) that demonstrates how to use the tools to answer questions, such as recommending a movie directed by a specific person, by interacting with an LLM and Wikidata.
A server implementation for Wikidata API using the Model Context Protocol (MCP). This project provides tools to interact with Wikidata, such as searching identifiers (entity and property), extracting metadata (label and description) and executing sparql query.
To install Wikidata MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @zzaebok/mcp-wikidata --client claude
Install uv
if it is not installed yet.
$ curl -LsSf https://astral.sh/uv/install.sh | sh
Then, install dependencies.
$ git clone https://github.com/zzaebok/mcp-wikidata.git
$ cd mcp-wikidata
$ uv sync
# if you want to run client example together
$ uv sync --extra example
Run the server with:
$ uv run src/server.py
If you want to test it with a simple client code (with langchain-mcp-adapters
), run the client with:
# in another shell
$ uv run src/client.py
The LLM extracts valid entity and property identifiers, executes a sparql query, and finally recommend a movie directed by Bong Joon-ho.
{
"messages": [
HumanMessage(
content="Can you recommend me a movie directed by Bong Joonho?",
),
AIMessage(
tool_calls=[
{
"name": "search_entity",
"args": {"query": "Bong Joon-ho"},
}
],
),
ToolMessage(
content="Q495980",
name="search_entity",
),
AIMessage(
tool_calls=[
{
"name": "get_properties",
"args": {"entity_id": "Q495980"},
}
],
),
ToolMessage(
content='["P345", "P244", "P214", "P227", ...]',
name="get_properties",
),
AIMessage(
tool_calls=[
{
"name": "search_property",
"args": {"query": "director"},
}
],
),
ToolMessage(
content="P57",
name="search_property",
),
AIMessage(
tool_calls=[
{
"name": "execute_sparql",
"args": {
"sparql_query": 'SELECT ?film ?filmLabel WHERE {\n ?film wdt:P57 wd:Q495980.\n SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }\n} LIMIT 1'
},
}
],
),
ToolMessage(
content='[{"film": {"type": "uri", "value": "http://www.wikidata.org/entity/Q483761"}, "filmLabel": {"xml:lang": "en", "type": "literal", "value": "Mother"}}]',
name="execute_sparql",
),
AIMessage(
content='I recommend the movie "Mother," which was directed by Bong Joon-ho.',
),
]
}
The following tools are implemented in the server:
Tool | Description |
---|---|
search_entity(query: str) |
Search for a Wikidata entity ID by its query. |
search_property(query: str) |
Search for a Wikidata property ID by its query. |
get_properties(entity_id: str) |
Get the properties associated with a given Wikidata entity ID. |
execute_sparql(sparql_query: str) |
Execute a SPARQL query on Wikidata. |
get_metadata(entity_id: str, language: str = "en") |
Retrieve the English label and description for a given Wikidata entity ID. |
MIT License
Please log in to share your review and rating for this MCP.
Discover more MCP servers with similar functionality and use cases
by danny-avila
Provides a customizable ChatGPT‑like web UI that integrates dozens of AI models, agents, code execution, image generation, web search, speech capabilities, and secure multi‑user authentication, all open‑source and ready for self‑hosting.
by ahujasid
BlenderMCP integrates Blender with Claude AI via the Model Context Protocol (MCP), enabling AI-driven 3D scene creation, modeling, and manipulation. This project allows users to control Blender directly through natural language prompts, streamlining the 3D design workflow.
by pydantic
Enables building production‑grade generative AI applications using Pydantic validation, offering a FastAPI‑like developer experience.
by GLips
Figma-Context-MCP is a Model Context Protocol (MCP) server that provides Figma layout information to AI coding agents. It bridges design and development by enabling AI tools to directly access and interpret Figma design data for more accurate and efficient code generation.
by mcp-use
Easily create and interact with MCP servers using custom agents, supporting any LLM with tool calling and offering multi‑server, sandboxed, and streaming capabilities.
by sonnylazuardi
This project implements a Model Context Protocol (MCP) integration between Cursor AI and Figma, allowing Cursor to communicate with Figma for reading designs and modifying them programmatically.
by lharries
WhatsApp MCP Server is a Model Context Protocol (MCP) server for WhatsApp that allows users to search, read, and send WhatsApp messages (including media) through AI models like Claude. It connects directly to your personal WhatsApp account via the WhatsApp web multi-device API and stores messages locally in a SQLite database.
by idosal
GitMCP is a free, open-source remote Model Context Protocol (MCP) server that transforms any GitHub project into a documentation hub, enabling AI tools to access up-to-date documentation and code directly from the source to eliminate "code hallucinations."
by Klavis-AI
Klavis AI provides open-source Multi-platform Control Protocol (MCP) integrations and a hosted API for AI applications. It simplifies connecting AI to various third-party services by managing secure MCP servers and authentication.