Wikidata MCP
Provides entity resolution and knowledge graph grounding against a local Wikidata Truthy QLever SPARQL endpoint, enabling retrieval of curated entity triples, cross-links, inbound relations, and execution of read-only SPARQL queries for OSINT and executive brief enrichment.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Wikidata MCP ground entities in this brief: NATO, Russia, Black Sea, and summarize key links"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Wikidata MCP
Model Context Protocol (MCP) server for local Wikidata Truthy knowledge grounding, entity resolution, and Executive Intelligence Brief (EIB) enrichment.
Designed as an MCP companion to the MacronX OSINT pipeline and the self-hosted local-wikidata QLever instance (~2.93B best-rank triples on localhost:7001/sparql).
What It Does
wikidata-mcp transitions the manual, prompt-heavy wikidata-brief-enrich skill into a fast, deterministic, batch-oriented knowledge graph server:
Single-Shot Brief Grounding (
ground_entities): Resolves all named entity mentions in an article or SITREP, retrieves curated outbound triples, discovers direct and shared connections (alliances, conflicts, water bodies), and pulls inbound rosters in a single composite call.Layered Deterministic Disambiguation (
resolve_entities): Matches exact labels, short names (P1813), and official names (P1448), filters against curatedP31domain class presets and 1-hopP279subclasses, filters Wikimedia noise (disambiguation pages, taxa, scholarly articles, songs), and computes disambiguation fingerprints (head of state, inception, HQ, country) to resolve homonyms deterministically without LLM hallucination.Batched Label Hydration &
@en/@mulDeduplication: Structural graph queries never join multipleOPTIONAL { ?x rdfs:label ?label }clauses inline. A dedicatedLabelHydratorbatch-resolves QIDs into clean English labels with an in-memory TTL cache, prioritizing@enover@muland eliminating row duplication.Sports & Entertainment Hub Filtering: Strips recurring athletic tournaments, curling championships, and cups when discovering shared
P710conflict/event hubs so sovereign states and leaders cross-reference only geopolitical summits, treaties, and conflicts.Guarded SPARQL Escape Hatch (
query_sparql): Allows agents to run custom read-onlySELECT/ASKqueries with auto-injected standard prefixes (wd:,wdt:,rdfs:,xsd:), enforced row limits (max 500), and automated QID/PID label hydration.Editorial Prompts & Schema Resources: Includes MCP prompts (
enrich_brief,verify_claims,extract_and_ground_entities) and resources (wikidata://schema/predicates,wikidata://schema/domains,wikidata://entities/{qid}) that instruct any connected agent to produce MacronX-compliant flat-bullet executive briefs with inline`QID`tags and▸ Wikidata grounding:lines.
Related MCP server: utopia-mcp
Installation & Build
cd /Users/leonid/src/wikidata-mcp
npm install
npm run build
npm testEnvironment Configuration
Variable | Required | Default | Description |
| No |
| URL of the local QLever SPARQL endpoint (e.g. |
| No |
| Per-query HTTP timeout in milliseconds. |
| No |
| When |
| No |
| In-memory label cache TTL in milliseconds (5 minutes). Set to |
MCP Client Configuration
1. Antigravity IDE / Claude Desktop / Cursor
Add to your mcpServers configuration:
{
"mcpServers": {
"wikidata": {
"command": "node",
"args": ["/Users/leonid/src/wikidata-mcp/dist/index.js"],
"env": {
"WIKIDATA_SPARQL_URL": "http://100.96.219.81:7001/sparql"
}
}
}
}2. Claude Code CLI
claude mcp add wikidata \
-e WIKIDATA_SPARQL_URL=http://100.96.219.81:7001/sparql \
-- node /Users/leonid/src/wikidata-mcp/dist/index.js3. OpenCode (opencode.json)
{
"mcp": {
"wikidata": {
"command": "node",
"args": ["/Users/leonid/src/wikidata-mcp/dist/index.js"],
"env": {
"WIKIDATA_SPARQL_URL": "http://100.96.219.81:7001/sparql"
}
}
}
}MCP Surface Reference
Tools (7 Domain Tools)
check_health: Verifies connectivity to the local QLever SPARQL endpoint and reports total indexed triples (~2.93B) and query latency.ground_entities: Single composite tool for brief enrichment: resolves a batch of entity mentions, retrieves curated outbound triples, discovers direct links and shared alliances/conflicts, and pulls inbound rosters.resolve_entities: Resolves free-text mentions to Wikidata QIDs using label matching (rdfs:label,P1813,P1448), domain class filtering (country,person,company,conflict,geographic_feature,infrastructure,military,organization, etc.), and disambiguation fingerprints.get_entity_triples: Retrieves curated outbound triples for one or more entity QIDs with human-readable property and object labels (covering 48 OSINT predicates across all MacronX sectors).find_cross_links: Identifies direct edges (A -> P -> B) and shared group/conflict hubs between a set of resolved entities while filtering out sports and entertainment competitions.get_inbound_relations: Retrieves inbound rosters (e.g. member countries viaP463, conflict participants viaP710, basin countries viaP205) with accurate total counts and truncation flags.query_sparql: Executes arbitrary read-only SPARQLSELECTorASKqueries with auto-injected prefixes, row limit clamping (max 500), and automated QID/PID label annotation.
Resources (wikidata://)
wikidata://schema/predicates— JSON catalog of all 48 default OSINT predicates and the ~200-property static English label dictionary.wikidata://schema/domains— JSON catalog of supported domain presets and their mapped root Wikidata class QIDs.wikidata://guidelines/brief-enrichment— Full editorial guidelines and formatting rules for grounding executive intelligence briefs.wikidata://entities/{qid}— Live outbound triple profile for any Wikidata entity QID.
Guided Workflow Prompts
enrich_brief(brief_text,eib_flat_bullets) — Guides the agent through extracting mentions, callingground_entities, preserving wording verbatim, tagging first mentions inline (Russia `Q159`), and placing▸ Wikidata grounding:lines following MacronX flat-bullet rules.extract_and_ground_entities(text) — Generates a structured knowledge catalog (entities, outbound triples, cross-links, unmapped items) from a source document.verify_claims(claims_text) — Fact-checks specific claims (memberships, alliances, borders, leadership, ownership) against the local Wikidata knowledge store.
Development & Testing
# Typecheck
npm run typecheck
# Run unit and end-to-end test suite (vitest)
npm test
# Build production bundles (tsup)
npm run buildLicense
MIT © 2026 Leonid Medovyy leonid@macron1.io
Available Tools
7 toolscheck_healthA
Verify connectivity to the local QLever Wikidata Truthy SPARQL endpoint and return the total indexed triple count and query latency.
Inputs: no named parameters.
find_cross_linksA
Discover direct relationships and shared hubs (alliances, conflicts, parent entities, shared bodies of water) between a set of resolved Wikidata entities, filtering out irrelevant entertainment/sports hubs.
Inputs: qids (required), max_shared_hubs, max_direct_edges.
get_entity_triplesB
Retrieve curated outbound Wikidata triples for one or more entity QIDs. Returns grouped, deduplicated facts with human-readable predicate and object labels.
Inputs: qids (required), predicates, include_unwhitelisted, max_values_per_predicate.
get_inbound_relationsA
Retrieve inbound relations for target entities (e.g. alliance members via P463, conflict participants via P710, basin countries via P205, corporate owners via P127). Includes accurate total counts and truncation flags.
Inputs: target_qids (required), predicates, subject_domain, limit_per_relation, +2 more.
ground_entitiesB
Single composite tool to ground a brief: resolves all mentions to Wikidata QIDs, retrieves curated outbound triples, discovers inter-entity cross-links and shared hubs, and retrieves key inbound rosters.
Inputs: entities (required), predicates.
query_sparqlA
Execute an arbitrary read-only SPARQL SELECT or ASK query against the local QLever Wikidata endpoint. Auto-declares standard prefixes (wd:, wdt:, rdfs:, xsd:) and enforces query limits.
Inputs: query (required), limit, hydrate_labels.
resolve_entitiesB
Resolve a batch of named entity mentions to Wikidata QIDs using deterministic label matching, domain P31/P279 class filtering, homonym scoring, and disambiguation fingerprints.
Inputs: entities (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Most tools clearly target distinct actions or resource views, but ground_entities is a composite that deliberately overlaps resolve_entities, get_entity_triples, find_cross_links, and get_inbound_relations. That overlap is explicitly described, though an agent still has to decide between the composite and granular tools.
All seven tools use snake_case with a predictable verb_noun or verb-object pattern (check_health, resolve_entities, get_entity_triples, query_sparql). The conventions are consistent throughout the set.
Seven tools is well within the appropriate range for a focused Wikidata access server and each tool covers a meaningful operation. The composite ground_entities adds redundancy, but the overall count remains well-scoped rather than bloated.
The set covers the read-only research lifecycle well: health checking, entity resolution, outbound facts, inbound relations, cross-links, composite grounding, and arbitrary SPARQL. Minor gaps such as dedicated property/class metadata lookup or explicit pagination are largely mitigated by query_sparql and truncation flags.
Maintenance
Related MCP Connectors
Machine-readable entity discovery with provenance, trust and verified source evidence.
Live Wikidata entity search, claims, sitelinks, summaries, and B2B company identifiers.
Search and fetch Wikidata entities, execute SPARQL queries, and resolve external identifiers.
Knowledge graph for AI agents. Query concepts, walk edges, get advisories.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables MCP-compatible clients to search and query a team knowledge graph, retrieve document context, upload files for indexing, explore entities and connections, and monitor workspace usage and server health.MIT
- AlicenseNot gradedqualityDmaintenanceEnables agents to query a single-source ontology of types, entities, statements, evidence, and controlled vocabulary, including bitemporal "as of" and "as recorded" fact lookups. Supports writing by letting agents propose candidate statements while keeping approval, review transitions, and authoritative reasoning restricted to approved facts.MIT
- AlicenseNot gradedqualityBmaintenanceEnables agents to perform federated cited search and heuristic grounding across a governed versioned wiki and indexed files, inspect citation spans, and read or write scoped knowledge through HTTP or stdio MCP.Apache 2.0
- AlicenseAqualityBmaintenanceEnables LLM hosts to query the WikiPathways and AOP-Wiki SPARQL endpoints without guessing their vocabulary, by serving live schema cards, entity resolution, curated example queries, and guarded read-only query execution with repair advice. Each response reports the dataset's release version, date, and licence.5MIT