Skip to main content
Glama
keonchennl

GraphDB MCP Server

GraphDB MCP サーバー

Ontotext GraphDBへの読み取り専用アクセスを提供するモデルコンテキストプロトコルサーバー。このサーバーにより、LLMはRDFグラフを探索し、GraphDBインスタンスに対してSPARQLクエリを実行できるようになります。

コンポーネント

ツール

  • スパーククエリ

    • 接続されたGraphDBリポジトリに対してSPARQLクエリを実行する

    • 入力:

      • query (文字列): 実行するSPARQLクエリ

      • graph (文字列、オプション): 対象となる特定のグラフ IRI

      • format (文字列、オプション):レスポンス形式(json、xml、csv)

    • すべてのクエリは読み取り専用モードで実行されます

  • リストグラフ

    • リポジトリで利用可能なすべてのグラフを一覧表示します

    • 入力パラメータは不要

リソース

サーバーはリポジトリ データの複数のビューを提供します。

  • クラスリスト( graphdb://<host>/repository/<repo>/classes )

    • リポジトリ内で見つかったすべてのRDFクラスとその数を一覧表示します

  • 述語( graphdb://<host>/repository/<repo>/predicates )

    • すべての述語(プロパティ)とその使用回数を一覧表示します

  • 統計( graphdb://<host>/repository/<repo>/stats )

    • 主語、述語、目的語、およびトリプルの数を提供します

  • サンプルデータ( graphdb://<host>/repository/<repo>/sample )

    • リポジトリからのトリプルのサンプルを表示します

  • グラフコンテンツ( graphdb://<host>/repository/<repo>/graph/<graphUri> )

    • 特定のグラフからのサンプルデータをメタデータとともに提供します

Related MCP server: mcp-graphql

構成

.envファイルを作成することにより、環境変数を使用してサーバーを構成できます。

GRAPHDB_ENDPOINT=http://localhost:7200
GRAPHDB_REPOSITORY=myRepository
GRAPHDB_USERNAME=username
GRAPHDB_PASSWORD=password

あるいは、エンドポイントとリポジトリをコマンドライン引数として指定することもできます。

node dist/index.js http://localhost:7200 myRepository

コマンドライン引数は環境変数よりも優先されます。

Claude Desktopでの使用

このサーバーを Claude Desktop アプリで使用するには、 claude_desktop_config.jsonの「mcpServers」セクションに次の構成を追加します。

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

値を特定の GraphDB 構成に置き換えます。

インストール

# 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

SPARQLクエリの例

このサーバーで実行できる SPARQL クエリの例を次に示します。

  1. オントロジー内のすべてのクラスを一覧表示します。

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
  1. 特定のクラスのすべてのプロパティを一覧表示します。

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
  1. クラス別にインスタンスをカウントします。

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)

ライセンス

このMCPサーバーはGPL-3.0ライセンスに基づいてライセンスされています。つまり、GNU GPL-3.0ライセンスの条件に従って、ソフトウェアを自由に使用、改変、配布することができます。

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/keonchennl/mcp-graphdb'

If you have feedback or need assistance with the MCP directory API, please join our Discord server