Wikidata + Google Knowledge Graph MCP#
An open-source MCP server and CLI that lets AI agents search Wikidata, read selected facts and link their own records to Wikidata QIDs, with evidence you can inspect and explicit answers when the evidence is not enough.
Use it as a Wikidata MCP server in Claude Code, Cursor, Codex or any MCP client that starts local stdio servers. Wikidata needs no account or key. The Google Knowledge Graph Search API is optional.
Install it in two minutes · Source on GitLab
What you get#
3 candidates by default (5 at most) with name, place and type match flags, not 50 raw hits.
Only the properties you ask for; ranks, qualifiers and references on request.
Entity resolution and entity linking with kind-specific rules and closed-vocabulary evidence codes instead of a model's guess.
HOLD, AMBIGUOUS and NO_CANDIDATE are real answers, never a silent pick.
Exact id joins (/m/ = P646, /g/ = P2671), reported apart from identity proof.
A resumable JSONL resolver with request budgets and an auditable evidence bundle.
Why bounded evidence matters#
An agent that links records to a knowledge graph mostly needs one answer: which entity is mine? Doing that through raw search results and full statement dumps costs context and invites mistakes. "Fox Theatre" matches more than a hundred Wikidata items; a model reading the first page of hits tends to pick the top one.
This project moves the decision into deterministic code:
- the search result is small and says why each candidate matched;
- the resolver needs a local anchor you supplied (an official website, coordinates, an
address, a date plus a venue, a creator) before it returns
AUTO_MATCH; - a name plus a city is usually
HOLD, and two candidates that both fit areAMBIGUOUS; - agreement between Google and Wikidata is recorded as provider concordance, which says the two providers describe the same thing, not that the thing is yours.
See Entity resolution for the rules and Benchmark for measured sizes and a recorded demo.
A 30-second example#
uvx --from wikidata-google-knowledge-mcp==0.2.1 wdkg resolve "Fox Theatre" --kind place --city Atlanta
# decision HOLD, reasons [NO_LOCAL_ANCHOR], candidate_ids [Q1440190, Q3080199]
uvx --from wikidata-google-knowledge-mcp==0.2.1 wdkg resolve "Fox Theatre" --kind place --city Atlanta \
--url https://www.foxtheatre.org
# decision AUTO_MATCH, wikidata_qid Q1440190, local anchors [CITY_MATCH, OFFICIAL_HOST_EXACT]
These are the results of a recorded live run against Wikidata.
MCP tools and CLI#
| task | MCP tool | CLI |
|---|---|---|
| candidates for a name | kg_search |
wdkg search |
| selected facts of one QID | kg_entity |
wdkg entity |
| one bounded relationship | kg_related |
wdkg related |
| identity of one local record | kg_resolve |
wdkg resolve |
| hundreds or thousands of records | — | wdkg resolve-batch, wdkg export-evidence |
| configuration and credential presence | kg_status |
wdkg status |
The MCP tools are for interactive, one-entity work inside an agent session. Corpora go through the CLI, which streams JSONL, checkpoints and caps provider requests. One Python core serves both, plus a portable Agent Skill that tells the agent which to use.
What it is not#
- Not official Wikimedia or Google software, and not affiliated with either.
- Not an export of the Google Knowledge Graph and not a places or maps API.
- Not an identity oracle:
AUTO_MATCHmeans a documented rule passed on the evidence you gave, and every other outcome is reported as such. - Read-only: it never edits Wikidata, Google or your data.