The Model Context Protocol (MCP) server provides a conversational interface for the exploration and analysis of RDF Turtle Knowledge Graph in Local File mode or SPARQL Endpoint.
A Model Context Protocol (MCP) server that provides conversational interface for the exploration and analysis of RDF (Turtle) based Knowledge Graph in Local File mode or SPARQL Endpoint mode. This server facilitates communication between AI applications (hosts/clients) and RDF data, making graph exploration and analyzing graph data through SPARQL queries. A perfect tool for knowledge graph research and AI data preparation.
The server implements SPARQL queries and search functionality:
execute_on_endpoint
endpoint
(str): The SPARQL endpoint URL to query.query
(str): The SPARQL query to execute.ctx
(Context): The FastMCP context object.sparql_query
query
(str): The SPARQL query to execute.ctx
(Context): The FastMCP context object.use_service
(bool): Whether to use a SERVICE clause for federated queries in local mode (default: True).graph_stats
ctx
(Context): The FastMCP context object.count_triples
ctx
(Context): The FastMCP context object.full_text_search
search_term
(str): The term to search for.ctx
(Context): The FastMCP context object.health_check
ctx
(Context): The FastMCP context object.get_mode
ctx
(Context): The FastMCP context object.The server exposes the following resources:
schema://all
: Retrieve schema information (classes and properties) from the graph.
queries://{template_name}
: Retrieve a predefined SPARQL query template by name.
explore://{query_name}
: Execute an exploratory SPARQL query by name and return results in JSON.
query_name
(str): The name of the exploratory query (e.g., 'classes', 'relationships/URI').explore://report
: Generate a Markdown report of exploratory queries.
The server exposes the following prompts:
analyze_graph_structure
: Initiate an analysis of the graph structure with schema data.
find_relationships
: Generate a SPARQL query to find relationships for a given subject.
text_to_sparql
: Convert a text prompt to a SPARQL query and execute it, with token limit checks.
prompt
(str): The text prompt to convert to SPARQL.Before starting make sure Claude Desktop is installed.
Go to: Settings > Developer > Edit Config
Add the following to your claude_desktop_config.json
:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
To use with a local RDF Turtle file, use this version with --triple-file
args
{ "mcpServers": { "rdf_explorer": { "command": "C:\\path\\to\\venv\\Scripts\\python.exe", "args": ["C:\\path\\to\\server.py", "--triple-file", "your_file.ttl"] } } }
To use with a SPARQL Endpoint, use this version with --sparql-endpoint
args
{ "mcpServers": { "rdf_explorer": { "command": "C:\\path\\to\\venv\\Scripts\\python.exe", "args": ["C:\\path\\to\\server.py", "--sparql-endpoint", "https://example.com/sparql"] } } }
Restart Claude Desktop and start querying and exploring graph data.
Prompt: "what mode is RDF Explorer running?"
Here are examples of how you can explore RDF data using natural language:
You can ask questions like:
You can ask questions like:
# clone the repository
git clone https://github.com/emekaokoye/mcp-rdf-explorer.git
cd mcp-rdf-explorer
# setup a virtual environment
python -m venv venv
source venv/bin/activate
# windows: venv\Scripts\activate
# install development dependencies
pip install -r requirements.txt
# run tests
pytest test_rdf_explorer.py -v
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the license file in the project repository.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!