MCP Wikidata Server
Enables configuration through environment variables stored in a .env file for customizing API request parameters, rate limits, caching, and language preferences.
Uses Git for version control and initial project installation through the git clone command.
Offers repository access for installation via git clone from GitHub, with contribution workflows mentioned in the documentation.
Provides specific integration paths for macOS, including configuration file locations for Claude Desktop integration.
Provides access to Wikidata knowledge base through five specialized tools: entity search, detailed entity retrieval, custom SPARQL query execution, entity relation exploration, and property-value searches.
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., "@MCP Wikidata Server search for Albert Einstein and get his birth date and notable works"
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.
MCP Wikidata Server
Un serveur Model Context Protocol (MCP) qui fournit un accès aux données Wikidata pour les Large Language Models.
🔧 Fonctionnalités
5 outils MCP pour interagir avec Wikidata :
search_entities: Recherche textuelle d'entitésget_entity: Récupération détaillée d'entités par IDsparql_query: Exécution de requêtes SPARQL personnaliséesget_relations: Exploration des relations d'entitésfind_by_property: Recherche par propriété-valeur
APIs supportées :
Wikibase API (recherche et récupération d'entités)
SPARQL Query Service (requêtes complexes)
Support multilingue et cache intelligent
Related MCP server: Wikidata MCP Server
📋 Prérequis
Python 3.10+
uv (gestionnaire de paquets Python moderne)
📦 Installation
1. Cloner le projet
git clone https://github.com/joelgombin/mcp-wikidata.git
cd mcp-wikidata2. Installer les dépendances
uv sync3. Tester l'installation
uv run python test_connection.py⚙️ Configuration avec Claude Desktop
Configuration recommandée (portable)
Ajoutez cette configuration à votre fichier Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json sur macOS) :
{
"mcpServers": {
"mcp-wikidata": {
"command": "/path/to/your/mcp-wikidata/run_mcp_wikidata.sh",
"args": []
}
}
}Important : Remplacez /path/to/your/mcp-wikidata/ par le chemin absolu vers votre dossier d'installation.
Alternative avec uv direct
Si vous préférez une configuration sans script wrapper :
{
"mcpServers": {
"mcp-wikidata": {
"command": "uv",
"args": ["run", "mcp-wikidata"],
"cwd": "/path/to/your/mcp-wikidata",
"env": {
"PATH": "/usr/local/bin:/usr/bin:/bin:~/.local/bin"
}
}
}
}🧪 Tests et vérification
Test avec MCP Inspector
npx @modelcontextprotocol/inspector uv run mcp-wikidataTests manuels des APIs
uv run python test_manual.pyTest client MCP complet
uv run python test_mcp_client.py🔧 Utilisation des outils
search_entities
Recherche d'entités par texte :
{
"query": "Einstein",
"language": "en",
"limit": 5,
"type": "item"
}get_entity
Récupération d'entité par ID :
{
"entity_id": "Q937",
"language": "en",
"simplified": true
}sparql_query
Requête SPARQL personnalisée :
{
"query": "SELECT ?item ?itemLabel WHERE { ?item wdt:P31 wd:Q5 . SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\" . } } LIMIT 10",
"format": "json"
}get_relations
Relations d'une entité :
{
"entity_id": "Q937",
"relation_type": "outgoing",
"limit": 20
}find_by_property
Recherche par propriété :
{
"property": "P106",
"value": "physicist",
"limit": 10
}⚙️ Configuration avancée
Variables d'environnement
Créez un fichier .env basé sur .env.example :
# User-Agent pour les requêtes API
WIKIDATA_USER_AGENT=MCP-Wikidata/0.1.0
# Limitation du taux de requêtes (par minute)
WIKIDATA_RATE_LIMIT=60
# Timeout des requêtes en secondes
WIKIDATA_TIMEOUT=30
# TTL du cache en secondes
WIKIDATA_CACHE_TTL=3600
# Nombre maximum de résultats par requête
WIKIDATA_MAX_RESULTS=50
# Langue par défaut
WIKIDATA_DEFAULT_LANGUAGE=enLogs de debug
Pour diagnostiquer des problèmes :
uv run mcp-wikidata --log-level DEBUG🔧 Dépannage
Erreur "server disconnected" dans Claude Desktop
Vérifiez l'installation d'uv :
which uv # Doit retourner un chemin comme /Users/username/.local/bin/uvTestez le script wrapper :
./run_mcp_wikidata.sh --helpVérifiez les permissions :
chmod +x run_mcp_wikidata.shRedémarrez Claude Desktop après modification de la configuration
Erreur "spawned uv ENOENT"
Cette erreur indique que Claude Desktop ne trouve pas la commande uv. Le script wrapper run_mcp_wikidata.sh résout automatiquement ce problème en cherchant uv dans plusieurs emplacements courants.
Logs de diagnostic
Les logs détaillés sont disponibles dans :
Console de MCP Inspector
Fichiers de log Claude Desktop (selon votre OS)
Sortie stderr du serveur MCP
📁 Structure du projet
mcp-wikidata/
├ mcp_wikidata/ # Package principal
├ __init__.py
├ server.py # Serveur MCP principal
├ config.py # Configuration
├ tools.py # Définitions des outils MCP
└ wikidata_client.py # Client API Wikidata
├ tests/ # Tests
├ run_mcp_wikidata.sh # Script wrapper (recommandé)
├ test_*.py # Scripts de test
├ pyproject.toml # Configuration du projet
├ .env.example # Variables d'environnement
└ README.md🤝 Contribution
Les contributions sont bienvenues ! N'hésitez pas à :
Signaler des bugs
Proposer des améliorations
Ajouter de nouveaux outils MCP
Améliorer la documentation
📄 Licence
MIT License - voir le fichier LICENSE pour plus de détails.
📚 Ressources utiles
Généré avec Claude Code 🚀
Available Tools
5 toolsfind_by_propertyC
Find entities by property and value
Inputs: property (required), value (required), language, limit.
get_entityB
Get detailed information about a Wikidata entity
Inputs: entity_id (required), language, properties, simplified.
get_relationsC
Get relations of a Wikidata entity
Inputs: entity_id (required), relation_type, property_filter, limit.
search_entitiesB
Search for entities in Wikidata by text query
Inputs: query (required), language, limit, type.
sparql_queryC
Execute a SPARQL query against Wikidata
Inputs: query (required), format, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: find_by_property targets property-value pairs, get_entity retrieves entity details, get_relations focuses on entity relationships, search_entities handles text-based queries, and sparql_query allows custom SPARQL queries. The descriptions reinforce these distinct roles, making tool selection unambiguous.
All tool names follow a consistent verb_noun pattern (e.g., find_by_property, get_entity, get_relations, search_entities, sparql_query), using snake_case uniformly. The verbs (find, get, search, execute) are appropriate to their actions, creating a predictable and readable naming convention throughout the set.
With 5 tools, this server is well-scoped for interacting with Wikidata, covering essential operations like entity retrieval, searching, and querying without being overly complex. Each tool earns its place by addressing a core need in the domain, making the count appropriate for the server's purpose.
The tool surface provides strong coverage for querying and retrieving Wikidata data, including basic CRUD-like operations (e.g., get and search) and advanced querying via SPARQL. A minor gap exists in write operations (e.g., create or update entities), but agents can work around this given Wikidata's read-heavy nature, and the tools support most common workflows.
Maintenance
Related MCP Connectors
Search and fetch Wikidata entities, execute SPARQL queries, and resolve external identifiers.
Read-only Wikidata tools and identity evidence. Local optional Google KG; bounded public remote.
Machine-readable entity discovery with provenance, trust and verified source evidence.
Wikidata MCP — wraps Wikidata API (wikidata.org/w/api.php)
Related MCP Servers
- AlicenseAqualityDmaintenanceA server implementation for interacting with Wikidata API using the Model Context Protocol, providing tools for searching identifiers, extracting metadata, and executing SPARQL queries.549MIT
- FlicenseNot gradedqualityDmaintenanceConnects LLMs to Wikidata's structured knowledge base using a hybrid architecture that optimizes for both fast entity searches and complex relational queries. It provides tools for entity and property retrieval, metadata lookups, and direct SPARQL execution to ground AI responses in verified data.2-
- AlicenseNot gradedqualityBmaintenanceEnables searching and fetching Wikidata entities, executing SPARQL queries, and resolving external identifiers via the Model Context Protocol.214 npm3Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables querying Wikidata via SPARQL, with convenience tools for instances, subclasses, properties, and geo-spatial queries.274 npm1MIT