ontoloom

ontoloom

MCP server for building and exploring OWL 2 ontologies using AI agents, with tools for axiom management, structural pattern matching, and persistent selections.

Category
访问服务器

README

ontoloom

MCP tools for building and exploring OWL 2 ontologies with AI agents.

Python 3.12 License Status: Alpha

ontoloom is an MCP server for working with OWL 2 EL ontologies. Each ontology is a single SQLite file. Axioms are typed and validated at the API boundary, and identity is a content hash so duplicates can't slip in.

Example

A coding agent sketches a tiny solar-system ontology. Create the database, declare a prefix, and add the planet hierarchy:

>>> create_ontology(path="solar.ontology.db")

Created ontology at `solar.ontology.db`.


>>> set_prefix(
...     path="solar.ontology.db",
...     name="sol",
...     iri="http://example.org/solar-system#",
... )

Set prefix `sol:` -> `http://example.org/solar-system#`


>>> add_axioms(path="solar.ontology.db", axioms=[...])

Added 6 axioms, skipped 0 axioms.
[bb5496d24bd1] SubClassOf(sol:Star, sol:CelestialBody)
[f3b454b634a3] SubClassOf(sol:Planet, sol:CelestialBody)
[e4e965a69712] SubClassOf(sol:Moon, sol:CelestialBody)
[3f335b35490c] SubClassOf(sol:TerrestrialPlanet, sol:Planet)
[7bc195f4d6a6] SubClassOf(sol:Planet, ObjectSomeValuesFrom(sol:orbits, sol:Star))
[f3de1afbfd6c] SubClassOf(sol:Moon, ObjectSomeValuesFrom(sol:orbits, sol:Planet))

Now query the structure. match_axioms does structural pattern matching: ?vars bind to whatever fills the slot, and every match is saved as a selection.

>>> match_axioms(
...     path="solar.ontology.db",
...     pattern={
...         "sub_class": "?body",
...         "super_class": {"property": "sol:orbits", "filler": "?center"},
...     },
...     into="orbits",
... )

Saved 2 axioms to "orbits".
[7bc195f4d6a6] SubClassOf(sol:Planet, ObjectSomeValuesFrom(sol:orbits, sol:Star))
[f3de1afbfd6c] SubClassOf(sol:Moon, ObjectSomeValuesFrom(sol:orbits, sol:Planet))

Selections persist and compose. A second match grabs every axiom where sol:Planet is the sub-class; create_selection intersects the two to find the one axiom that is both about Planet and describes an orbit.

>>> match_axioms(
...     path="solar.ontology.db",
...     pattern={"sub_class": "sol:Planet", "super_class": "?super"},
...     into="planet_facts",
... )

Saved 2 axioms to "planet_facts".
[7bc195f4d6a6] SubClassOf(sol:Planet, ObjectSomeValuesFrom(sol:orbits, sol:Star))
[f3b454b634a3] SubClassOf(sol:Planet, sol:CelestialBody)


>>> create_selection(
...     path="solar.ontology.db",
...     name="planet_orbit",
...     expr={"intersect": ["orbits", "planet_facts"]},
... )

Saved 1 axiom to "planet_orbit".
[7bc195f4d6a6] SubClassOf(sol:Planet, ObjectSomeValuesFrom(sol:orbits, sol:Star))

What you can do

  • Build an ontology from scratch by talking to an agent
  • Poke around an existing one: search by text or structure, inspect entities
  • Hand an agent an existing ontology and ask it to clean up or extend
  • Dump everything to JSONL for sharing or archival
  • Manage prefix mappings and axiom-level annotations

Tools

Setup create_ontology | set_prefix | remove_prefix

Build

  • add_axioms - add validated axioms; duplicates are skipped
  • remove_axioms - remove by hash or by axiom selection
  • annotate_axiom - change axiom-level annotations without touching identity
  • replace_axiom - atomic delete + add for one axiom
  • rename_iri - rewrite an IRI across all (or scoped) axioms

Query

  • describe_ontology - entity and axiom counts, top entities, prefix mappings
  • get_entity - roles, annotations, and asserted axiom counts for one entity
  • find_entities - text search, optionally filtered by role or namespace
  • find_axioms - text search on axiom-level annotations
  • find_duplicate_entities - entities sharing the same value for an annotation property
  • match_axioms - structural pattern matching with ?vars and * wildcards

Selections - named, persistent sets of axiom hashes or entity IRIs

  • create_selection - build from set algebra over existing selections
  • read_selection - paginated view with present/missing visibility
  • list_selections - show all named selections
  • remove_selections - drop one or more selections

Export export_jsonl - dump all axioms to a sorted JSONL file

Getting started

Requires Python 3.12 and uv.

git clone git@github.com:ExtensityAI/ontoloom.git
cd ontoloom

Claude Code plugin (recommended)

/plugins add /path/to/ontoloom/plugins/claude-plugin

Manual MCP configuration

Drop this into your .mcp.json, adjusting the paths for your clone:

{
  "mcpServers": {
    "ontoloom": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "--project", "packages/mcp", "python", "-m", "ontoloom_mcp.server"]
    }
  }
}

Standalone

uv run --project packages/mcp python -m ontoloom_mcp.server

Sandboxing (optional)

Set ONTOLOOM_WORKSPACE_ROOT=/path/to/workspace to confine all Ontology(...), export_jsonl, and import paths to that directory tree. Useful when running an agent that may take instructions from untrusted documents - the agent can't open or write SQLite files outside the workspace. Unset (default) means unrestricted single-user behavior.

How it works

Each ontology lives in a single .db file that works the same whether it has a dozen axioms or millions. SQLite is the source of truth; the MCP layer is the only writer, so axioms are always validated before they reach disk.

Axioms are typed Pydantic models hashed by canonical logical content, ignoring annotations - you can edit a comment without changing the hash, and exact duplicates are caught automatically.

Status

Alpha. The pieces work and are in use, but the API isn't frozen yet. Issues and PRs welcome.

License

BSD-3-Clause - see LICENSE.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选