mcp-server-graphdb
A Model Context Protocol server that provides read only access to graphs in a certain repository in Ontotext GraphDB. This server enables LLMs to execute SPARQL queries.
Documentation

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 execute
- `graph` (string, optional): Specific graph IRI to target
- `format` (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:///repository//classes`)
- Lists all RDF classes found in the repository with counts
- Predicates (`graphdb:///repository//predicates`)
- Lists all predicates (properties) with usage counts
- Statistics (`graphdb:///repository//stats`)
- Provides counts of subjects, predicates, objects, and triples
- Sample Data (`graphdb:///repository//sample`)
- Shows a sample of triples from the repository
- Graph Content (`graphdb:///repository//graph/`)
- 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=passwordAlternatively, you can provide the endpoint and repository as command-line arguments:
node dist/index.js http://localhost:7200 myRepositoryThe 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 buildExample SPARQL Queries
Here are some example SPARQL queries you can run with this server:
1. List all classes in the ontology:
PREFIX rdf:
PREFIX rdfs:
SELECT DISTINCT ?class ?label
WHERE {
{ ?class a rdfs:Class } UNION { ?class a owl:Class }
OPTIONAL { ?class rdfs:label ?label }
}
ORDER BY ?class2. List all properties for a specific class:
PREFIX rdf:
PREFIX rdfs:
SELECT ?property ?label ?range
WHERE {
?property rdfs:domain .
OPTIONAL { ?property rdfs:label ?label }
OPTIONAL { ?property rdfs:range ?range }
}
ORDER BY ?property3. Count instances by class:
PREFIX rdf:
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.
Frequently asked questions
What is mcp-server-graphdb?
mcp-server-graphdb is A Model Context Protocol server that provides read only access to graphs in a certain repository in Ontotext GraphDB. This server enables LLMs to execute SPARQL queries.
How do I install mcp-server-graphdb?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-server-graphdb open source?
Yes — it is hosted on GitHub at https://github.com/keonchennl/mcp-server-graphdb and has 16 stars.
Related MCP tools
🔥 Official Firecrawl MCP Server - Adds powerful web scraping and search to Cursor, Claude and any other LLM clients.
Use any LLMs (Large Language Models) for Deep Research. Support SSE API and MCP server.
Enhanced MCP server for interactive user feedback and command execution in AI-assisted development, featuring dual interface support (Web UI and Desktop Application) with intelligent environment detection and cross-platform compatibility.
A powerful Zotero AI and MCP plugin with ChatGPT, Gemini 3.7, Claude Fable 5, Claude Opus 5, DeepSeek V4, Grok, OpenRouter, Kimi k3, GLM 5.3, SiliconFlow, GPT-oss, Gemma 4, Qwen 3.8
Connect your browser to AI models. Just use Dia on Chrome, Arc or Firefox.
文颜 MCP Server 可以让 AI 自动将 Markdown 文章排版后发布至微信公众号。
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP