A Model Context Protocol (MCP) server with Server-Sent Events (SSE) transport that connects Large Language Models to Wikidata's structured knowledge base. This server enables LLMs to search for entities, retrieve metadata, query relationships, and execute SPARQL queries to access factual information from Wikidata.
- SSE Transport: Network-accessible MCP server (vs. stdio in the original version)
- Search for Wikidata entities by name
- Search for Wikidata properties by name
- Retrieve entity metadata (labels, descriptions)
- Get entity properties and their values
- Execute SPARQL queries against Wikidata's endpoint
- Find entity facts with optional property filtering
- Get related entities with optional relation filtering
- Access common property references and SPARQL examples
- Use prompt templates for common Wikidata interaction patterns
The server is deployed and accessible at:
- URL: https://wikidata-mcp-mirror.onrender.com
- SSE Endpoint: https://wikidata-mcp-mirror.onrender.com/messages/
- Health Check: https://wikidata-mcp-mirror.onrender.com/health
To use this server with Claude Desktop:
-
Edit the Claude Desktop configuration file located at:
~/Library/Application Support/Claude/claude_desktop_config.json -
Configure it to use the remote MCP server:
{ "mcpServers": { "Wikidata Knowledge Remote": { "command": "mcp-remote", "args": [ "https://wikidata-mcp-mirror.onrender.com/messages/" ] } } } -
Restart Claude Desktop
-
When using Claude, you can now access Wikidata knowledge through the configured MCP server.
- Python 3.10+
- Virtual environment tool (venv, conda, etc.)
-
Clone the repository:
git clone https://github.com/ebaenamar/wikidata-mcp.git cd wikidata-mcp-server-sse -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the server locally:
python server_sse.py
The server will start on
http://localhost:8000by default.
You can test the server using the included test client:
python test_mcp_client.pyOr manually with curl:
# Connect to SSE endpoint
curl -N -H "Accept: text/event-stream" https://wikidata-mcp-mirror.onrender.com/messages/
# Send a message (replace SESSION_ID with the one received from the SSE endpoint)
curl -X POST "https://wikidata-mcp-mirror.onrender.com/messages/?session_id=YOUR_SESSION_ID" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test-client","version":"0.1.0"}},"id":0}'This server is configured for deployment on Render.com using the render.yaml file.
- Build Command:
pip install -r requirements.txt - Start Command:
gunicorn -k uvicorn.workers.UvicornWorker server_sse:app - Environment Variables:
PORT: 10000
- Health Check Path:
/health
The repository includes a Dockerfile that's used by Render.com for containerized deployment. This allows the server to run in a consistent environment with all dependencies properly installed.
- Fork or clone this repository to your GitHub account
- Create a new Web Service on Render.com
- Connect your GitHub repository
- Render will automatically detect the
render.yamlfile and configure the deployment - Click "Create Web Service"
After deployment, you can access your server at the URL provided by Render.com.
The server is built using:
- FastAPI: For handling HTTP requests and routing
- SSE Transport: For bidirectional communication with clients
- MCP Framework: For implementing the Model Context Protocol
- Wikidata API: For accessing Wikidata's knowledge base
server_sse.py: Main server implementation with SSE transportwikidata_api.py: Functions for interacting with Wikidata's API and SPARQL endpointrequirements.txt: Dependencies for the projectDockerfile: Container configuration for Docker deployment on Renderrender.yaml: Configuration for deployment on Render.comtest_mcp_client.py: Test client for verifying server functionality
The server provides the following MCP tools:
search_wikidata_entity: Search for entities by namesearch_wikidata_property: Search for properties by nameget_wikidata_metadata: Get entity metadata (label, description)get_wikidata_properties: Get all properties for an entityexecute_wikidata_sparql: Execute a SPARQL queryfind_entity_facts: Search for an entity and find its factsget_related_entities: Find entities related to a given entity
This project is licensed under the MIT License - see the LICENSE file for details.
- Based on the Model Context Protocol (MCP) specification
- Uses Wikidata as the knowledge source
- Inspired by the MCP examples from the official documentation