Wikidata MCP Server
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.
Installation
Installing via Smithery
To install Wikidata MCP Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @zzaebok/mcp-wikidata --client claude
Installing Manually
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
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.
See the execution output
{
"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.',
),
]
}
Wikidata MCP Tools
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. |
License
MIT License
Metadata
Release files for iflow-mcp_mcp-wikidata 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iflow_mcp_mcp_wikidata-0.1.1.tar.gz | 5.4 kB | Without provenance | Details for iflow_mcp_mcp_wikidata-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iflow_mcp_mcp_wikidata-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for iflow_mcp_mcp_wikidata-0.1.1-py3-none-any.whl |
Total release size: 11.7 kB
Release files / iflow_mcp_mcp_wikidata-0.1.1.tar.gz
| Download URL | iflow_mcp_mcp_wikidata-0.1.1.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9851cd1ed7f342fa048c925c3af13dc2babed289cbbc7e3405b1ef556d411e1
|
|
BLAKE2b-256 checksum How to use checksums |
30b6dbaab6ab57b6cf1bbbcc719cc5a0b569a65a79ac29011610c6d6ac5e2c34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.9
|
Release files / iflow_mcp_mcp_wikidata-0.1.1-py3-none-any.whl
| Download URL | iflow_mcp_mcp_wikidata-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5bc106634ade9885b8128726cd00085f7effe1cb58c8f57de607f7ef8dd4f1c4
|
|
BLAKE2b-256 checksum How to use checksums |
5d96cb24a8ba909128f525f05b7af8ec8f34fe89a11a99728f68acbd5b8e7228
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.9
|
Security for iflow-mcp_mcp-wikidata 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.