- Explore MCP Servers
- mcp-graphdb
Mcp Graphdb
What is Mcp Graphdb
mcp-graphdb is a Model Context Protocol server that provides read-only access to graphs stored in Ontotext GraphDB. It allows Large Language Models (LLMs) to execute SPARQL queries to explore RDF graphs.
Use cases
Use cases for mcp-graphdb include querying RDF data for research purposes, integrating data from various sources into a unified view, exploring ontologies and their relationships, and providing data insights for applications utilizing LLMs.
How to use
To use mcp-graphdb, configure the server by setting environment variables in a .env file or by providing command-line arguments. You can execute SPARQL queries using the ‘sparqlQuery’ tool and list available graphs with the ‘listGraphs’ tool.
Key features
Key features of mcp-graphdb include executing SPARQL queries in read-only mode, listing available graphs, providing multiple views of repository data (such as class lists, predicates, statistics, sample data, and graph content), and easy configuration through environment variables or command-line arguments.
Where to use
mcp-graphdb can be used in fields that require semantic data management, such as knowledge graphs, data integration, semantic web applications, and any scenario where RDF data needs to be queried and analyzed.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Graphdb
mcp-graphdb is a Model Context Protocol server that provides read-only access to graphs stored in Ontotext GraphDB. It allows Large Language Models (LLMs) to execute SPARQL queries to explore RDF graphs.
Use cases
Use cases for mcp-graphdb include querying RDF data for research purposes, integrating data from various sources into a unified view, exploring ontologies and their relationships, and providing data insights for applications utilizing LLMs.
How to use
To use mcp-graphdb, configure the server by setting environment variables in a .env file or by providing command-line arguments. You can execute SPARQL queries using the ‘sparqlQuery’ tool and list available graphs with the ‘listGraphs’ tool.
Key features
Key features of mcp-graphdb include executing SPARQL queries in read-only mode, listing available graphs, providing multiple views of repository data (such as class lists, predicates, statistics, sample data, and graph content), and easy configuration through environment variables or command-line arguments.
Where to use
mcp-graphdb can be used in fields that require semantic data management, such as knowledge graphs, data integration, semantic web applications, and any scenario where RDF data needs to be queried and analyzed.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
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:
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.
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:
{
"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.
Installation
# 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
Example SPARQL Queries
Here are some example SPARQL queries you can run with this server:
- List all classes in the ontology:
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
- List all properties for a specific 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
- Count instances by class:
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)
License
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.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.











