Wikidata MCP Server

Integrations

  • Provides access to the project repository for installation via git clone from GitHub.

  • Enables integration with LangChain through langchain-mcp-adapters, allowing AI agents to interact with Wikidata's knowledge graph through the Model Context Protocol.

  • Provides tools for interacting with Wikidata, including searching for entity and property identifiers, retrieving entity metadata (labels and descriptions), accessing entity properties, and executing SPARQL queries against the Wikidata knowledge base.

위키데이터 MCP 서버

모델 컨텍스트 프로토콜(MCP)을 사용하는 Wikidata API 서버 구현입니다. 이 프로젝트는 식별자(엔터티 및 속성) 검색 , 메타데이터(레이블 및 설명) 추출 , SparQL 쿼리 실행 등 Wikidata와 상호작용하는 도구를 제공합니다.


설치

아직 설치되지 않았다면 uv 설치하세요.

지엑스피1

그런 다음 종속성을 설치합니다.

$ 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

간단한 클라이언트 코드( langchain-mcp-adapters 사용)로 테스트하려면 다음을 사용하여 클라이언트를 실행합니다.

# in another shell $ uv run src/client.py

LLM은 유효한 엔터티 및 속성 식별자를 추출하고, sparql 쿼리를 실행한 후, 마지막으로 봉준호 감독의 영화를 추천합니다.

{ "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.', ), ] }

위키데이터 MCP 도구

서버에는 다음 도구가 구현되어 있습니다.

도구설명
search_entity(query: str)쿼리로 Wikidata 엔터티 ID를 검색합니다.
search_property(query: str)쿼리로 Wikidata 속성 ID를 검색합니다.
get_properties(entity_id: str)주어진 Wikidata 엔터티 ID와 연관된 속성을 가져옵니다.
execute_sparql(sparql_query: str)Wikidata에 SPARQL 쿼리를 실행합니다.
get_metadata(entity_id: str, language: str = "en")주어진 Wikidata 엔터티 ID에 대한 영어 라벨과 설명을 검색합니다.

특허

MIT 라이센스

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

모델 컨텍스트 프로토콜을 사용하여 Wikidata API와 상호작용하기 위한 서버 구현으로, 식별자 검색, 메타데이터 추출, SPARQL 쿼리 실행을 위한 도구를 제공합니다.

  1. Installation
    1. Run
      1. Wikidata MCP Tools
        1. License
      ID: hm1c5dex3y