GraphDB MCP Server
A Model Context Protocol server that provides read-only access to Ontotext GraphDB. This server enables LLMs to explore RDF graphs and execute SPARQL queries against a GraphDB instance.
Components
Tools
- sparqlQuery
- Execute SPARQL queries against the connected GraphDB repository
- Input:
query
(string): The SPARQL query to executegraph
(string, optional): Specific graph IRI to targetformat
(string, optional): Response format (json, xml, csv)
- All queries are executed in read-only mode
- listGraphs
- Lists all graphs available in the repository
- No input parameters required
Resources
The server provides multiple views of the repository data:
- Class List (
graphdb://<host>/repository/<repo>/classes
)- Lists all RDF classes found in the repository with counts
- Predicates (
graphdb://<host>/repository/<repo>/predicates
)- Lists all predicates (properties) with usage counts
- Statistics (
graphdb://<host>/repository/<repo>/stats
)- Provides counts of subjects, predicates, objects, and triples
- Sample Data (
graphdb://<host>/repository/<repo>/sample
)- Shows a sample of triples from the repository
- Graph Content (
graphdb://<host>/repository/<repo>/graph/<graphUri>
)- Provides sample data from specific graphs along with metadata
Configuration
You can configure the server using environment variables by creating a .env
file:
Alternatively, you can provide the endpoint and repository as command-line arguments:
The command-line arguments take precedence over environment variables.
Usage with Claude Desktop
To use this server with the Claude Desktop app, add the following configuration to the "mcpServers" section of your claude_desktop_config.json
:
Replace the values with your specific GraphDB configuration.
Installation
Example SPARQL Queries
Here are some example SPARQL queries you can run with this server:
- List all classes in the ontology:
- List all properties for a specific class:
- Count instances by class:
License
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.
This server cannot be installed
A Model Context Protocol server that provides read-only access to Ontotext GraphDB, enabling LLMs to explore RDF graphs and execute SPARQL queries.