Wikidata knowledge graph via @cyanheads/wikidata-mcp-server — entity search, SPARQL, statements, sitelinks, external ID resolution
@cyanheads/wikidata-mcp-server v0.10.9 — verified recipe
Install: npm install @cyanheads/wikidata-mcp-server @modelcontextprotocol/sdk Entry: node node_modules/@cyanheads/wikidata-mcp-server/dist/index.js Transport: stdio | Auth: none (Wikidata public API) | Node: >=22 works (warns >=24)
7 tools discovered
| Tool | Purpose |
|---|---|
wikidata_search_entities | Text search for items or properties, returns QIDs/PIDs with descriptions |
wikidata_get_entity | Fetch full entity by QID/PID, with field and language filtering |
wikidata_get_labels | Batch-resolve multiple QIDs/PIDs to human-readable labels + descriptions |
wikidata_get_statements | Fetch property claims with qualifiers and label resolution |
wikidata_get_sitelinks | Get Wikipedia/Wikimedia article URLs for an entity |
wikidata_sparql_query | Execute arbitrary SPARQL queries against Wikidata Query Service |
wikidata_resolve_external_id | Look up entities by external ID (DOI, ORCID, ISBN, etc.) |
Verified calls (21 successful data returns across 26 total calls, 0 crashes)
Search: "Istanbul" → Q406 (largest city in Turkey) | "Claude AI" → Q118876059 (LLM family by Anthropic) | property search "instance of" → P31 | nonexistent query → graceful empty result.
Entity: Q406 (Istanbul) full → 269 labels, 232 sitelinks | Q406 filtered fields:["labels","descriptions"], languages:["en","tr"] → en: Istanbul, tr: İstanbul | Q5 (human) → 312 labels | P31 (instance of) property → data type wikibase-item.
Labels batch: ids:["Q406","Q5","Q64","P31"] → Istanbul, human, Berlin, instance of — all resolved with descriptions in one call.
Statements: Q406 properties:["P17","P625","P1082"] with resolve_labels:true → country: Turkey (Q43) since 1923-10-29, prior: Ottoman Empire since 1453, Byzantine Empire since 1260; population claims; coordinates | Q5 properties:["P279"] → subclass of: person, omnivore, natural person, Homo sapiens.
Sitelinks: Q406 wikis_only → 232 Wikipedia editions | Q406 sites:["enwiki","trwiki","dewiki"] → 3 filtered links with URLs.
SPARQL: Turkey cities by population → Ankara 5.8M, Bursa 2.9M, Antalya 2.4M, Konya 2.2M | Count female scientists (Q3320743) → 1,555 | AI companies → Xinity AI, Therml, etc. | COUNT all humans → expected 30s timeout with graceful error and recovery hint.
External ID resolution: P356 (DOI) and P496 (ORCID) tested — returns "no match" for entries not in Wikidata (correct behavior, not all external IDs are indexed).
Gotchas
- Array params required:
fields,ids,properties,sites,languagesmust be JSON arrays, NOT comma-separated strings. Passing strings returns a clear validation error (not a crash). env: { LOG_LEVEL: "error" }keeps stderr clean- SPARQL has 30s timeout — heavy aggregations (COUNT all humans) will timeout. Add LIMIT or narrow WHERE clauses.
- Node >=24 engine field is advisory; works fine on Node 22
resolve_external_iddepends on Wikidata indexing — many valid DOIs/ORCIDs won't resolve if the corresponding paper/person has no Wikidata entryresolve_labels: trueon statements adds ~200ms but makes output human-readable
{ "surface": "@cyanheads/wikidata-mcp-server", "version": "0.10.9", "transport": "stdio", "command": "node node_modules/@cyanheads/wikidata-mcp-server/dist/index.js", "tools": ["wikidata_search_entities", "wikidata_get_entity", "wikidata_get_labels", "wikidata_get_statements", "wikidata_get_sitelinks", "wikidata_sparql_query", "wikidata_resolve_external_id"], "sample_calls": [ { "tool": "wikidata_search_entities", "args": { "query": "Istanbul", "limit": 3 }, "result_excerpt": "Q406 Istanbul — largest city in Turkey", "latency_ms": 555 }, { "tool": "wikidata_get_labels", "args": { "ids": ["Q406", "Q5", "Q64", "P31"], "languages": ["en"] }, "result_excerpt": "Istanbul, human, Berlin, instance of — all with descriptions", "latency_ms": 285 }, { "tool": "wikidata_get_statements", "args": { "id": "Q406", "properties": ["P17", "P625", "P1082"], "resolve_labels": true }, "result_excerpt": "country: Turkey Q43 since 1923; Ottoman Empire since 1453; 38 total statements", "latency_ms": 857 }, { "tool": "wikidata_sparql_query", "args": { "query": "SELECT ?city ?cityLabel ?pop WHERE { ?city wdt:P31 wd:Q515 . ?city wdt:P17 wd:Q43 . ?city wdt:P1082 ?pop . SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' } } ORDER BY DESC(?pop) LIMIT 5" }, "result_excerpt": "Ankara 5803482, Bursa 2901396, Antalya 2426356, Konya 2232374", "latency_ms": 6724 }, { "tool": "wikidata_get_sitelinks", "args": { "id": "Q406", "sites": ["enwiki", "trwiki", "dewiki"] }, "result_excerpt": "3 sitelinks: en, tr, de Wikipedia articles for Istanbul", "latency_ms": 323 } ], "total_calls": 26, "successful_data_returns": 21, "graceful_errors": 5, "expected_timeouts": 1, "crashes": 0, "p50_ms": 350 }