mcp-server-sparql

mcp-server-sparql

A generic MCP server that connects AI agents to any SPARQL 1.1 endpoint, enabling querying and updating RDF data across various triple stores.

Category
访问服务器

README

mcp-server-sparql

A generic Model Context Protocol (MCP) server that connects AI agents to any SPARQL 1.1 endpoint.

Works with Apache Jena Fuseki · GraphDB · Stardog · Virtuoso · Amazon Neptune · Blazegraph — or any endpoint that speaks SPARQL 1.1.

Tools

Tool Description
sparql_select Execute a SELECT query → tabular rows; paginate with limit/offset/has_more
sparql_ask Execute an ASK query → boolean; fast existence/reachability checks
sparql_construct Execute a CONSTRUCT query → RDF graph string
sparql_describe DESCRIBE a resource URI → all triples about it
sparql_update Any SPARQL 1.1 Update: INSERT DATA, DELETE, CLEAR, DROP, LOAD, COPY, MOVE, ADD
graph_list List all named graphs with triple counts
graph_get Fetch a named graph as Turtle; paginated
graph_put Replace a named graph (inline content or remote URL via server-side LOAD)
graph_post Append to a named graph
graph_delete Delete a named graph
validate_shacl Validate RDF against SHACL shapes — pure function, no endpoint needed
endpoint_ping Check connectivity; returns response time and configured URLs

Connection is configured once at the server level via environment variables. Tools take no connection parameters — the same pattern used by mcp-server-postgres and mcp-server-sqlite.

Quickstart

git clone https://github.com/Kashif-Rabbani/mcp-server-sparql.git
cd mcp-server-sparql
pip install -e .

cp .env.example .env
# edit .env — set SPARQL_ENDPOINT (or the three explicit URL vars)

python server.py

Server starts on http://0.0.0.0:8000. The SSE endpoint is at /sse.

Configuration

Copy .env.example to .env and set one of:

Option A — single base URL (Fuseki / Stardog):

SPARQL_ENDPOINT=http://localhost:3030/myDataset

This auto-derives /query, /update, and /data suffixes.

Option B — explicit URLs (GraphDB, Virtuoso, Neptune, etc.):

SPARQL_QUERY_URL=http://localhost:7200/repositories/myrepo
SPARQL_UPDATE_URL=http://localhost:7200/repositories/myrepo/statements
SPARQL_GRAPH_STORE_URL=http://localhost:7200/repositories/myrepo/rdf-graphs/service

Auth (optional):

SPARQL_USERNAME=admin
SPARQL_PASSWORD=secret

Endpoint-specific notes

Endpoint Option Query URL pattern
Apache Jena Fuseki A http://host:3030/<dataset>
Stardog A http://host:5820/<database>
GraphDB B http://host:7200/repositories/<repo>
Amazon Neptune B https://<cluster>.neptune.amazonaws.com:8182/sparql
Virtuoso B http://host:8890/sparql
Blazegraph B http://host:9999/blazegraph/namespace/<ns>/sparql

Connect to an MCP client

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "sparql": {
      "command": "uvicorn",
      "args": ["server:app", "--host", "0.0.0.0", "--port", "8000"],
      "cwd": "/path/to/mcp-server-sparql",
      "env": {
        "SPARQL_ENDPOINT": "http://localhost:3030/myDataset"
      }
    }
  }
}

Vectara Agent Platform

Register the server as an MCP Tool Server pointing at the public SSE URL (use ngrok for local development):

ngrok http 8000
# then register https://<id>.ngrok-free.app/sse as an MCP tool server in Vectara

Requirements

  • Python 3.11+
  • A running SPARQL 1.1 endpoint

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选