GraphDB Explorer
STDIOModel Context Protocol server providing read-only access to Ontotext GraphDB for LLMs.
Model Context Protocol server providing read-only access to Ontotext GraphDB for LLMs.
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.
sparqlQuery
query
(string): The SPARQL query to executegraph
(string, optional): Specific graph IRI to targetformat
(string, optional): Response format (json, xml, csv)listGraphs
The server provides multiple views of the repository data:
Class List (graphdb://<host>/repository/<repo>/classes
)
Predicates (graphdb://<host>/repository/<repo>/predicates
)
Statistics (graphdb://<host>/repository/<repo>/stats
)
Sample Data (graphdb://<host>/repository/<repo>/sample
)
Graph Content (graphdb://<host>/repository/<repo>/graph/<graphUri>
)
You can configure the server using environment variables by creating a .env
file:
GRAPHDB_ENDPOINT=http://localhost:7200
GRAPHDB_REPOSITORY=myRepository
GRAPHDB_USERNAME=username
GRAPHDB_PASSWORD=password
Alternatively, you can provide the endpoint and repository as command-line arguments:
node dist/index.js http://localhost:7200 myRepository
The command-line arguments take precedence over environment variables.
To use this server with the Claude Desktop app, add the following configuration to the "mcpServers" section of your claude_desktop_config.json
:
{ "mcpServers": { "graphdb": { "command": "node", "args": [ "/path/to/mcp-server-graphdb/dist/index.js" ], "env": { "GRAPHDB_ENDPOINT": "http://localhost:7200", "GRAPHDB_REPOSITORY": "myRepository", "GRAPHDB_USERNAME": "username", "GRAPHDB_PASSWORD": "password" } } } }
Replace the values with your specific GraphDB configuration.
# Clone the repository git clone https://github.com/keonchennl/mcp-server-graphdb.git cd mcp-server-graphdb # Install dependencies yarn install # Build the project yarn build
Here are some example SPARQL queries you can run with this server:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?class ?label WHERE { { ?class a rdfs:Class } UNION { ?class a owl:Class } OPTIONAL { ?class rdfs:label ?label } } ORDER BY ?class
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?property ?label ?range WHERE { ?property rdfs:domain <http://example.org/YourClass> . OPTIONAL { ?property rdfs:label ?label } OPTIONAL { ?property rdfs:range ?range } } ORDER BY ?property
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?class (COUNT(?instance) AS ?count) WHERE { ?instance a ?class } GROUP BY ?class ORDER BY DESC(?count)
This MCP server is licensed under the GPL-3.0 License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the GNU GPL-3.0 License.