Skip to main content
ClaudeWave
cyanheads avatar
cyanheads

wikidata-mcp-server

View on GitHub

Search and fetch Wikidata entities, execute SPARQL queries, and resolve external identifiers via MCP. STDIO or Streamable HTTP.

MCP ServersOfficial Registry2 stars1 forksTypeScriptApache-2.0Updated 2d ago
ClaudeWave Trust Score
87/100
Trusted
Passed
  • Open-source license (Apache-2.0)
  • Actively maintained (<30d)
  • Clear description
  • Topics declared
Last scanned: 6/11/2026
Install in Claude Code / Claude Desktop
Method: Manual
Claude Code CLI
git clone https://github.com/cyanheads/wikidata-mcp-server
claude_desktop_config.json (Claude Desktop)
{
  "mcpServers": {
    "wikidata": {
      "command": "node",
      "args": ["/path/to/wikidata-mcp-server/dist/index.js"]
    }
  }
}
1. Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
2. Replace any <placeholder> values with your API keys or paths.
3. Restart Claude. The MCP server and its tools appear automatically.
💡 Clone https://github.com/cyanheads/wikidata-mcp-server and follow its README for install instructions.
Use cases

MCP Servers overview

<div align="center">
  <h1>@cyanheads/wikidata-mcp-server</h1>
  <p><b>Search and fetch Wikidata entities, execute SPARQL queries, and resolve external identifiers via MCP. STDIO or Streamable HTTP.</b>
  <div>7 Tools • 1 Resource</div>
  </p>
</div>

<div align="center">

[![Version](https://img.shields.io/badge/Version-0.1.13-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/wikidata-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/wikidata-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/wikidata-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.2-blueviolet.svg?style=flat-square)](https://bun.sh/)

</div>

<div align="center">

[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/wikidata-mcp-server/releases/latest/download/wikidata-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=wikidata-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvd2lraWRhdGEtbWNwLXNlcnZlciJdfQ==) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22wikidata-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fwikidata-mcp-server%22%5D%7D)

[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)

</div>

<div align="center">

**Public Hosted Server:** [https://wikidata.caseyjhand.com/mcp](https://wikidata.caseyjhand.com/mcp)

</div>

---

## Tools

7 tools for working with Wikidata's knowledge graph:

| Tool | Description |
|:---|:---|
| `wikidata_search_entities` | Search for items or properties by text query, returning QIDs/PIDs with labels, descriptions, and match metadata |
| `wikidata_get_entity` | Fetch a full entity by QID or PID with optional field and language filtering |
| `wikidata_get_labels` | Batch-resolve up to 50 QIDs or PIDs to human-readable labels and descriptions |
| `wikidata_get_statements` | Fetch property claims for an entity with qualifier detail and QID label resolution |
| `wikidata_get_sitelinks` | Fetch Wikipedia and Wikimedia project article URLs for a Wikidata item |
| `wikidata_sparql_query` | Execute a SPARQL SELECT query against the Wikidata Query Service |
| `wikidata_resolve_external_id` | Look up a Wikidata entity by an external identifier (DOI, PubMed ID, ORCID, OpenAlex ID, etc.) |

### `wikidata_search_entities`

Search Wikidata for items or properties by text query.

- Searches labels, aliases, and descriptions
- `type="item"` for real-world concepts (people, places, works); `type="property"` for predicate P-IDs
- Language-aware results (BCP 47 language codes)
- Offset-based pagination, up to 50 results per call
- Returns match metadata indicating whether the hit was on a label or alias

---

### `wikidata_get_entity`

Fetch a Wikidata entity by QID or PID with field selection.

- Q-IDs (e.g. `Q76`) fetch items; P-IDs (e.g. `P31`) fetch properties — endpoint routing is automatic
- `fields` parameter trims the response to `labels`, `descriptions`, `aliases`, `statements`, or `sitelinks`
- `languages` parameter filters multilingual maps to specific language codes
- Full entity payload always fetched from the API; field/language filtering is client-side

---

### `wikidata_get_labels`

Batch-resolve QIDs/PIDs to human-readable labels and descriptions.

- Up to 50 IDs per call, batched via the MediaWiki `wbgetentities` API
- Supports multiple language codes per request
- Reports `found` count and `notFound` IDs for partial-result handling
- Designed for the common agent pattern: run a SPARQL query, then humanize the QID results

---

### `wikidata_get_statements`

Fetch property claims for a Wikidata entity with full qualifier and reference detail.

- `properties` parameter fetches only specific P-IDs — omit to return all statements
- Value QIDs are resolved to human-readable labels by default via a batched label call
- Set `resolve_labels=false` for raw QIDs only (faster, smaller payload)
- Preferred-rank statements represent the most current values
- Designed for fact verification: "what does Wikidata say about this entity's {property}?"

---

### `wikidata_get_sitelinks`

Fetch Wikipedia and Wikimedia project article URLs for a Wikidata item.

- Maps site codes (e.g., `enwiki`) to article titles and URLs
- `sites` parameter filters to specific site codes
- `wikis_only=true` returns only Wikipedia links (excludes Wiktionary, Wikiquote, Wikisource, etc.)
- Major items can have 300+ sitelinks across languages
- Only Q-IDs (items) have sitelinks — P-IDs are not supported

---

### `wikidata_sparql_query`

Execute a SPARQL SELECT query against the Wikidata Query Service (Blazegraph).

- Full graph power: multi-hop traversals, aggregations, subqueries, OPTIONAL, FILTER, UNION, BIND
- Standard Wikidata prefixes (`wd:`, `wdt:`, `p:`, `ps:`, `pq:`, `wikibase:`, `bd:`) are auto-injected
- `wikibase:label` SERVICE auto-injected when `language` is set and the query uses `?<var>Label` variables
- Results in SPARQL 1.1 JSON format: each binding is `{ type, value, "xml:lang"? }`
- Hard server timeout is 60s; client-side `timeout` parameter (1–55s) applies earlier
- Rate-limited at 60 requests/min and 5 concurrent requests per IP

---

### `wikidata_resolve_external_id`

Look up a Wikidata entity by an external identifier.

- Common use cases: CrossRef DOI → QID (P356), PubMed PMID → QID (P698), ORCID → author QID (P496), OpenAlex ID → entity QID (P10283), IMDb ID (P345)
- Automatic value normalization: DOIs uppercased, PMID prefixes stripped, ORCID hyphens normalized
- Returns `match=null` when not found
- Returns `multipleMatches` when a Wikidata data integrity issue causes more than one entity to claim the same external ID
- Designed for cross-server joins with pubmed-mcp-server, crossref-mcp-server, and openalex-mcp-server

## Resource

| Type | Name | Description |
|:---|:---|:---|
| Resource | `wikidata://entity/{id}` | Compact markdown summary of a Wikidata entity — labels, English description, instance-of, Wikipedia link, image, and statement count |

All resource data is also reachable via tools.

## Features

Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):

- Declarative tool definitions — single file per tool, framework handles registration and validation
- Unified error handling across all tools
- Pluggable auth (`none`, `jwt`, `oauth`)
- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`
- Structured logging with optional OpenTelemetry tracing
- Runs locally (stdio/HTTP) from the same codebase

Wikidata-specific:

- Wikidata REST API v1 for entity and statement fetches — no SPARQL overhead for lookup operations
- MediaWiki `wbgetentities` API for efficient batch label resolution
- Wikidata Query Service (Blazegraph) for SPARQL with auto-injected prefix headers and label SERVICE
- Configurable `User-Agent` per Wikimedia policy
- Separate timeout configuration for REST and SPARQL endpoints

Agent-friendly output:

- `wikidata_get_labels` designed to follow SPARQL result sets — run the query, then humanize in one call
- `wikidata_resolve_external_id` handles DOI/PMID/ORCID normalization transparently, with `multipleMatches` for data integrity edge cases
- `wikidata_get_statements` resolves QID values to labels in the same call, with `resolve_labels=false` escape hatch for raw payloads
- All tools echo input parameters in the response for traceability

## Getting started

### Self-Hosted / Local

Add the following to your MCP client configuration file.

```json
{
  "mcpServers": {
    "wikidata-mcp-server": {
      "type": "stdio",
      "command": "bunx",
      "args": ["@cyanheads/wikidata-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}
```

Or with npx (no Bun required):

```json
{
  "mcpServers": {
    "wikidata-mcp-server": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@cyanheads/wikidata-mcp-server@latest"],
      "env": {
        "MCP_TRANSPORT_TYPE": "stdio",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}
```

Or with Docker:

```json
{
  "mcpServers": {
    "wikidata-mcp-server": {
      "type": "stdio",
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/wikidata-mcp-server:latest"]
    }
  }
}
```

For Streamable HTTP, set the transport and start the server:

```sh
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcp
```

### Prerequisites

- [Bun v1.3.0](https://bun.sh/) or higher (or Node.js ≥ 24.0.0).

### Installation

1. **Clone the repository:**

```sh
git clone https://github.com/cyanheads/wikidata-mcp-server.git
```

2. **Navigate into the directory:**

```sh
cd wikidata-mcp-server
```

3. **Install dependencies:**

```sh
bun install
```

## Configuration

All configuration is validated at startup via Zod schemas. Key environment variables:

| Variable | Description | Default |
|:---|:--
ai-agentbuncyanheadsknowledge-graphlinked-datamcpmcp-servermodel-context-protocolsparqltypescriptwikibasewikidata

What people ask about wikidata-mcp-server

What is cyanheads/wikidata-mcp-server?

+

cyanheads/wikidata-mcp-server is mcp servers for the Claude AI ecosystem. Search and fetch Wikidata entities, execute SPARQL queries, and resolve external identifiers via MCP. STDIO or Streamable HTTP. It has 2 GitHub stars and was last updated 2d ago.

How do I install wikidata-mcp-server?

+

You can install wikidata-mcp-server by cloning the repository (https://github.com/cyanheads/wikidata-mcp-server) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.

Is cyanheads/wikidata-mcp-server safe to use?

+

Our security agent has analyzed cyanheads/wikidata-mcp-server and assigned a Trust Score of 87/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.

Who maintains cyanheads/wikidata-mcp-server?

+

cyanheads/wikidata-mcp-server is maintained by cyanheads. The last recorded GitHub activity is from 2d ago, with 0 open issues.

Are there alternatives to wikidata-mcp-server?

+

Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.

Deploy wikidata-mcp-server to your cloud

Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.

Maintain this repo? Add a badge to your README

Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.

Featured on ClaudeWave: cyanheads/wikidata-mcp-server
[![Featured on ClaudeWave](https://claudewave.com/api/badge/cyanheads-wikidata-mcp-server)](https://claudewave.com/repo/cyanheads-wikidata-mcp-server)
<a href="https://claudewave.com/repo/cyanheads-wikidata-mcp-server"><img src="https://claudewave.com/api/badge/cyanheads-wikidata-mcp-server" alt="Featured on ClaudeWave: cyanheads/wikidata-mcp-server" width="320" height="64" /></a>

More MCP Servers

wikidata-mcp-server alternatives