
zzaebok/mcp-wikidata 是从 https://github.com/zzaebok/mcp-wikidata. 导入的 MCP 服务器候选服务器。
概览
zzaebok/mcp-wikidata 是从 https://github.com/zzaebok/mcp-wikidata. 导入的 MCP 服务器候选服务器。
概述(AI 翻译)
维基数据 MCP 服务器
基于模型上下文协议(MCP)的维基数据API服务器实现。 该项目提供与维基数据交互的工具,如搜索标识符(实体和属性)、提取元数据(标签和描述)以及执行sparql查询。
安装
通过Smithery安装
通过Smithery自动安装Claude Desktop的Wikidata MCP Server:
手动安装
如果还没安装,请安装uv。
然后,安装依赖。
跑
运行服务器时有:
如果你想用简单的客户端代码(langchain-mcp-adapters)测试,可以用以下方式运行客户端:
LLM提取有效的实体和属性标识符,执行sparql查询,最终推荐一部由奉俊昊执导的电影。
参见执行输出
维基数据 MCP 工具
服务器中实现了以下工具:
| 工具 | 描述 |
|---|---|
search_entity(query: str) |
通过查询搜索维基数据实体ID。 |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
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.
{
"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"}}]',
安装
npx -y @smithery/cli install @zzaebok/mcp-wikidata --client claude