Sponsored by Deepsite.site

MCP GraphDB

Created By
keonchennl9 months ago
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. #database
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 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=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`:

```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

```sh

Clone the repository

git clone https://github.com/yourname/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:

  1. List all classes in the ontology: ```sparql 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 ?class ```

  2. List all properties for a specific class: ```sparql PREFIX rdf: PREFIX rdfs: SELECT ?property ?label ?range WHERE { ?property rdfs:domain . OPTIONAL { ?property rdfs:label ?label } OPTIONAL { ?property rdfs:range ?range } } ORDER BY ?property ```

  3. Count instances by class: ```sparql 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 MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
ChatWiseThe second fastest AI chatbot™
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
WindsurfThe new purpose-built IDE to harness magic
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Serper MCP ServerA Serper MCP Server
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
CursorThe AI Code Editor
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Playwright McpPlaywright MCP server
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Tavily Mcp
Amap Maps高德地图官方 MCP Server