一个用于 Oxigraph 的模型上下文协议(MCP)服务器。Oxigraph 是一个快速且轻量级的 RDF 三元组存储库,支持 SPARQL。
Oxigraph 是一个高性能的内存或基于文件的 RDF 图数据库,用 Rust 编写。此 MCP 服务器提供了一个与 Claude 友好的包装器,通过模型上下文协议访问 PyOxigraph(Oxigraph 的 Python 绑定)。
uv pip install mcp-server-oxigraph
在你的 Claude Desktop MCP 配置中添加以下内容:
"oxigraph": {
"command": "uv",
"args": ["run", "mcp-server-Oxigraph"],
"env": {}
}
要设置特定的默认数据库位置,请添加 OXIGRAPH_DEFAULT_STORE 环境变量:
"oxigraph": {
"command": "uv",
"args": ["run", "mcp-server-oxigraph"],
"env": {
"OXIGRAPH_DEFAULT_STORE": "~/.claude/my_knowledge_graph.oxigraph"
}
}
Oxigraph MCP 适用于:
此 MCP 服务器提供:
Oxigraph 是一个用 Rust 实现的开源 RDF 三元组存储库。关键特性包括:
此 MCP 服务器使用 PyOxigraph,这是 Oxigraph 的官方 Python 绑定。
Oxigraph MCP 服务器支持以下 RDF 序列化格式:
| 格式 | 文件扩展名 | MIME 类型 | 支持命名图 |
|---|---|---|---|
| Turtle | .ttl | text/turtle | 否 |
| N-Triples | .nt | application/n-triples | 否 |
| N-Quads | .nq | application/n-quads | 是 |
| TriG | .trig | application/trig | 是 |
| RDF/XML | .rdf | application/rdf+xml | 否 |
| N3 | .n3 | text/n3 | 否 |
你可以使用 oxigraph_get_supported_formats() 函数来获取这些信息。
服务器管理两种类型的默认存储:
~/.mcp-server-oxigraph/default.oxigraphOXIGRAPH_DEFAULT_STORE 环境变量指定启动时,服务器初始化这两种存储(如果已配置):
你不需要显式地创建或打开这些存储——它们会在服务器启动时自动初始化。所有未指定存储路径的操作都会使用适当的默认存储。
配置完成后,你可以使用 Oxigraph MCP 工具在 Claude 中处理 RDF 数据:
将 RDF 三元组添加到默认存储
oxigraph_create_named_node(iri: "http://example.org/subject")
oxigraph_create_named_node(iri: "http://example.org/predicate")
oxigraph_create_literal(value: "Object value")
oxigraph_create_quad(subject: subject, predicate: predicate, object: object)
oxigraph_add(quad: quad)
使用 SPARQL 查询
oxigraph_query(query: "SELECT * WHERE { ?s ?p ?o } LIMIT 10")
导入和导出不同格式的 RDF 数据
oxigraph_parse(data: "@prefix ex: <http://example.org/> . ex:a ex:b ex:c .", format: "turtle")
oxigraph_serialize(format: "ntriples")
oxigraph_get_supported_formats()
如需创建自定义存储
oxigraph_create_store(store_path: "/path/to/my/custom.oxigraph")
oxigraph_query(query: "SELECT * WHERE { ?s ?p ?o }", store_path: "/path/to/my/custom.oxigraph")
oxigraph_create_store:创建新的存储(内存或基于文件)oxigraph_open_store:打开现有的基于文件的存储oxigraph_close_store:关闭存储并从管理器中移除oxigraph_backup_store:创建存储的备份oxigraph_restore_store:从备份恢复存储oxigraph_optimize_store:优化存储以提高性能oxigraph_list_stores:列出所有管理的存储注意:大多数操作会与默认存储一起工作,无需指定 store_path。对于持久存储,我们建议使用文件路径作为 store_path 以便清晰。
oxigraph_create_named_node:创建用于 RDF 语句的 NamedNodeoxigraph_create_blank_node:创建用于 RDF 语句的 BlankNodeoxigraph_create_literal:创建用于 RDF 语句的 Literaloxigraph_create_quad:创建一个四元组(带有可选图的三元组)oxigraph_add:将四元组添加到存储oxigraph_add_many:将多个四元组添加到存储oxigraph_remove:从存储中移除四元组oxigraph_remove_many:从存储中移除多个四元组oxigraph_clear:从存储中移除所有四元组oxigraph_quads_for_pattern:查询匹配模式的四元组oxigraph_query:针对存储执行 SPARQL 查询oxigraph_update:针对存储执行 SPARQL 更新oxigraph_query_with_options:使用自定义选项执行 SPARQL 查询oxigraph_run_query:针对存储运行 SPARQL 查询或更新oxigraph_parse:解析 RDF 数据并添加到存储oxigraph_serialize:将存储序列化为字符串oxigraph_import_file:从文件导入 RDF 数据oxigraph_export_graph:将图导出到文件oxigraph_get_supported_formats:获取支持的 RDF 格式列表MIT 许可证