OWL MCP Server
The OWL MCP Server enables AI assistants to directly query, modify, and reason over OWL/TTL/RDF ontology files, abstracting away complex syntax like SPARQL.
Load & Save
Load ontologies from local paths or IRIs (TTL, OWL, RDF formats)
Save changes in RDF/XML, Turtle, or N-Triples format
Query & Explore
Get ontology overview (class, individual, and property counts; namespaces)
List classes, individuals, and properties with optional filters/limits
Describe a specific class (parent/child classes, restrictions, equivalents, individuals) or individual (types, property values)
Search entities by keyword (fuzzy, case-insensitive)
Execute SPARQL 1.1 SELECT queries
Modify
Add new classes (with optional parent, rdfs:label, rdfs:comment)
Add new individuals (with associated class and property values)
Add object property assertions
Note: all modifications are in-memory until
save_ontologyis explicitly called
Reason
Run Pellet or HermiT reasoners to check ontology consistency and infer new knowledge (requires JDK 8+)
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OWL MCP Server描述BankStatement类的结构"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🦉 OWL MCP Server
让 AI 直接读写你的 OWL / TTL / RDF 本体文件
简介
OWL MCP Server 是一个基于 Model Context Protocol (MCP) 的本体操作服务器。
它让 Claude、Cursor、WorkBuddy 等 AI 助手能够像操作普通文件一样,直接查询、修改、推理你的 OWL/TTL/RDF 本体文件 —— 无需手写 SPARQL,无需了解 OWL 语法细节,用自然语言对话即可完成复杂的知识图谱操作。
你:"找出所有 XX 类的个体,按金额降序排列"
AI:[调用 sparql_query] → 返回结构化结果适用场景
🏦 金融领域:对账单、票据本体的增删改查
🏥 医疗健康:临床知识图谱探索与推理
🏗️ 工程建模:设备、流程本体的管理与验证
🎓 学术研究:OWL 本体的快速原型开发与测试
Related MCP server: Ontology MCP
快速开始
第一步:安装依赖
pip install mcp owlready2 rdflib或使用 requirements.txt:
pip install -r requirements.txt⚠️ 推理器依赖 Java:使用
run_reasoner(Pellet/HermiT)需要本地安装 JDK 8+
第二步:配置 MCP 客户端
WorkBuddy
在 ~/.workbuddy/mcp.json 中添加:
{
"mcpServers": {
"owl": {
"command": "python",
"args": ["/绝对路径/server.py"]
}
}
}💡 推荐:使用虚拟环境的 Python 绝对路径,避免依赖冲突:
"command": "C:/Users/yourname/.workbuddy/binaries/python/envs/default/Scripts/python.exe"
Claude Desktop
在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"owl-mcp": {
"command": "python",
"args": ["/绝对路径/server.py"]
}
}
}Cursor
在 .cursor/mcp.json 中添加同样的配置,重启 Cursor 后即可在 Agent 模式中使用。
第三步:启用并开始对话
在 WorkBuddy 连接器管理页面找到 owl,点击 Trust 启用,然后直接开始自然语言对话:
"加载本体文件 C:/work/xxxx.ttl"
"列出所有类,只显示以 xxx: 开头的"
"描述 BankStatement 类的完整结构"
"运行 HermiT 推理器,检查本体一致性"
"把新增的类保存回原文件"工具列表
📖 查询类
工具 | 说明 |
| 加载本体文件(支持本地路径或 IRI,格式:TTL / OWL / RDF) |
| 获取本体概览(类数、个体数、属性数、命名空间) |
| 列出所有类,支持前缀过滤与数量限制 |
| 列出所有个体,支持按类过滤 |
| 列出对象属性 / 数据属性 |
| 详细描述类(父类、子类、限制、已知个体) |
| 描述个体(所属类型、全部属性值) |
| 按关键词模糊搜索类 / 个体 / 属性 |
| 执行 SPARQL 1.1 SELECT 查询 |
✏️ 修改类
工具 | 说明 |
| 添加新类(可指定父类、rdfs:label、rdfs:comment) |
| 添加新个体(可指定初始属性值) |
| 添加对象属性三元组断言 |
| 保存本体(支持 rdfxml / turtle / ntriples) |
🧠 推理类
工具 | 说明 |
| 运行推理器(Pellet 或 HermiT),检查一致性并推断隐含知识 |
注意:
add_*系列修改操作不会自动保存,需显式调用save_ontology。
示例用法
探索本体结构
你:加载 xxx.ttl,给我一个整体介绍
AI:该本体共有 47 个类、213 个个体、18 个对象属性……
你:描述一下 BankStatement 类
AI:BankStatement 是 FinancialDocument 的子类,拥有以下数据属性:amount、currency、date……SPARQL 查询
-- 查找所有 BankStatement 及其金额(降序)
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX : <http://test.com/t#>
SELECT ?ind ?amount WHERE {
?ind rdf:type :BankStatement .
?ind :amount ?amount .
}
ORDER BY DESC(?amount)增量修改
你:新增一个 AA 类,父类是 BB,标签为"CC"
AI:[调用 add_class] → 已添加 AA 类
你:把这个改动保存为 turtle 格式
AI:[调用 save_ontology] → 已保存到 xxx.ttl一致性检查
你:运行 HermiT 推理器,检查本体有没有逻辑矛盾
AI:[调用 run_reasoner] → 本体一致,推断出 3 个新的隐含类成员关系……技术栈
注意事项
推理器需要 Java:Pellet / HermiT 依赖 JDK 8+,请确保
java在系统 PATH 中大型本体:超过 10 万三元组时,
list_*系列操作请配合limit参数使用修改不自动保存:所有
add_*操作仅更新内存模型,需手动调用save_ontologySPARQL 语法:使用标准 SPARQL 1.1 语法,由 rdflib 引擎执行
兼容的 MCP 客户端
✅ WorkBuddy
✅ Trae/Traw-work
✅ Claude
✅ Cursor (Agent 模式)
✅ 任何支持 MCP 标准的 AI 客户端
License
☕ 请作者喝杯咖啡
OWL MCP Server 是我在业余时间独立开发和维护的开源项目,永久免费。
如果它帮你省下了哪怕半小时手写 SPARQL 的时间,可以考虑请我喝杯咖啡(¥9.9 就够 ☕)—— 你的每一份支持都会直接转化为新功能开发和 bug 修复的动力。
不方便赞赏? 给项目点个 ⭐ Star、提一个 Issue、或把它分享给需要的人,同样是巨大的支持!
Maintenance
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/liftkkkk/owl-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server