KM

keonchennl/mcp-server-graphdb

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

17 stars 8 forks 质量 65 趋势 21GPL-3.0

Ontotext GraphDB中的某个寄存器中只提供读取图形的模型上下文协议服务器. 此服务器允许 LLMs 执行 SPARQL 查询 .

概览

一个只提供 Ontotext GraphDB 读取权限的模型上下文协议服务器. 此服务器允许 LLMs 探索 RDF 图形, 并针对 GraphDB 实例执行 SPARQL 查询 。 - 对连接的GraphDB寄存器执行 SPARQL 查询 - 输入: - 查询(字符串):执行的 SPARQL 查询 - 图表(字符串,可选): 目标 - 格式(字符串,可选): 回复格式(json, xml, csv) - 所有查询以只读模式执行 - 列出仓库中可用的所有图表 - 不需要输入参数 服务器提供寄存器数据的多视图 : - (graphdb:///repository//classes) - 列出存储库中发现的所有RDF类,并计数 - (graphdb:///repository//pricates) - 列出所有上游(财产),并列出使用量 - (graphdb:///repository//stats) - 提供主体、上游、物体和三重计数 - (graphdb:///repository//sample) - 从寄存器中显示一个三重样本

概述(AI 翻译)

一个只提供 Ontotext GraphDB 读取权限的模型上下文协议服务器. 此服务器允许 LLMs 探索 RDF 图形, 并针对 GraphDB 实例执行 SPARQL 查询 。

□ 组件

QQ 工具

  • sparql查询

  • 对相连的GraphDB仓库执行 SPARQL 查询

  • 输入:

  • [[T0] (字符串): 要执行的 SPARQL 查询

  • [[T1] (字符串,可选): 要瞄准的具体图表 IRI

  • [[T2] (字符串,可选): 反应格式(json、xml、csv)

  • 所有查询都以只读模式执行

  • 列表页

  • 列出存储库中可用的所有图表

  • 不需要输入参数

资源

服务器提供寄存器数据的多视图 :

  • ** 分类清单**([T3])

  • 列出在仓库中找到的所有RDF类,并列出计数

  • ** 预测**([T4])

  • 列出所有上游(财产)和使用情况

  • ** 统计**([T5])

  • 提供主体、上游、物体和三重物的计数

  • ** 抽样数据**([T6])

  • 从存储器中显示一个三重样本

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

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:

{
  "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:

  1. List all classes in the ontology:
PREFIX rdf:
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "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" } } } }