Plan, apply and roll back changes to a production ontology, with a blast radius report and a proof an auditor can re-check.
Rust ai-nativedescription-logicsformal-verificationinfrastructure-as-codeisabelle-languageknowledge-graphleanlean4mcpmcp-serverontologyowlowl2reasoningrustshaclsparqltheorem-proving
Post-release housekeeping for v2.0.1, and the rmcp handshake staged upstream (#265)
Fabio Rovai9c5f640c7c55
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 733839cc..850fc1b7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,26 +4,47 @@ All notable changes to Open Ontologies are documented here.## [Unreleased]-### Fixed+### Added-- **A request sent before `initialize` no longer ends the MCP server** (#260).- rmcp's handshake reads messages itself until it sees `initialize`, answers a- pre-initialize `ping` and turns away everything else- (rmcp-1.4.0/src/service/server.rs:191 and :200), so `serve` returned- `ExpectedInitializeRequest`, `main.rs:1867` propagated it with `?`, and the- client read the exit as EOF while waiting on its own `initialize`. One line- was enough: a client whose first message was- `{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{}}` never got- as far as the handshake. That same request one message later is answered- -32601 by rmcp's default `on_custom_request` and costs nothing, so arrival- order was the whole difference between a reply and a dead process. The stdio- transport is now wrapped: a pre-initialize request is answered with a- JSON-RPC error, -32601 for an unknown method so the reply matches what the- post-handshake path already returns and -32600 for a known MCP method sent- out of order, and a pre-initialize notification is dropped. Nothing changes- after `initialize`. Measured on both rmcp versions in the registry, 1.4.0 and- 1.8.0: unguarded, both reject the reported byte sequence; guarded, both- complete the handshake, so the version bump was not the fix it looked like.+- **A named profile hands a client one job's worth of the tool surface** (#263).+ A client aligning two vocabularies has no use for most of what this server+ registers, and every tool it has no use for is one more chance to call the+ wrong one. Nine profiles, selected with `--tool-profile`, with+ `OPEN_ONTOLOGIES_TOOL_PROFILE`, or with `profile` under `[tools]`, in that+ order of precedence. The profile narrows first and the older allow/deny axis+ narrows what is left, so neither can widen the other and naming a tool in+ `--tools-allow` that the profile dropped does not bring it back. The default+ does not move: no profile means every tool this build can serve. An unknown+ name refuses to start rather than falling back to the full surface, because+ publishing the whole catalogue to a deployment that asked for one job's worth+ of it, silently, because someone mistyped a flag, is worth declining to boot+ over. Three counters are reported rather than one, since `remove_unavailable`+ strips feature-gated tools before the operator filter and a single counter+ would report the Cargo feature set as something the profile withheld:+ `compiled_in`, `servable_in_this_build` and `exposed`. Coverage is a gate, not+ a claim: every registered tool must belong to some profile and no profile may+ name a tool that does not exist, both measured from the router, so the next+ tool added carries a failing test until its author files it.++- **Each step of a claimed reasoning trace is labelled** (#264). `onto_trace_label`+ and the `trace-label` verb take a trace in `oo-trace/1`, which is the line a+ `derivations.tsv` from `onto_reason` already carries, so a certificate this+ engine wrote is itself a valid trace. Each step is labelled `entailed` when a+ Lean checker accepted a certificate concluding it, `not_entailed` when a rule+ head could conclude that shape and the graph still does not support it, or+ `outside_the_fragment` when no rule in the table could ever derive it. The+ last two are never merged, exactly as `onto_dlp_boundary` never merges them,+ because they send a reader to different places. Two answers travel per step+ and are also never merged: a step whose reasoning is valid over triples the+ graph does not hold reads `locally_sound_but_premises_not_in_the_store`, which+ is a step reasoning from premises it invented. A supplied rule table earns+ `entailed_under_supplied_rules` and the qualification survives into the family+ word, so a consumer filtering on the family cannot collect conclusions that+ hold only in models satisfying rules nobody checked. `not_entailed` is bounded+ by a table implementing 29 of OWL 2 RL's 78 rules over an open world and the+ report says so, so it never means false.++### Fixed- **`onto_temporal_conflicts` no longer files a withdrawn assertion as a livecontradiction partner** (#128). The tool takes no `as_of` and read the@@ -57,6 +78,29 @@ All notable changes to Open Ontologies are documented here.did. Found and analysed on #128 by nicolas-geysse, who also framed the fourdecisions this takes.+## [2.0.1] - 2026-09-28++### Fixed++- **A request sent before `initialize` no longer ends the MCP server** (#260).+ rmcp's handshake reads messages itself until it sees `initialize`, answers a+ pre-initialize `ping` and turns away everything else+ (rmcp-1.4.0/src/service/server.rs:191 and :200), so `serve` returned+ `ExpectedInitializeRequest`, `main.rs:1867` propagated it with `?`, and the+ client read the exit as EOF while waiting on its own `initialize`. One line+ was enough: a client whose first message was+ `{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{}}` never got+ as far as the handshake. That same request one message later is answered+ -32601 by rmcp's default `on_custom_request` and costs nothing, so arrival+ order was the whole difference between a reply and a dead process. The stdio+ transport is now wrapped: a pre-initialize request is answered with a+ JSON-RPC error, -32601 for an unknown method so the reply matches what the+ post-handshake path already returns and -32600 for a known MCP method sent+ out of order, and a pre-initialize notification is dropped. Nothing changes+ after `initialize`. Measured on both rmcp versions in the registry, 1.4.0 and+ 1.8.0: unguarded, both reject the reported byte sequence; guarded, both+ complete the handshake, so the version bump was not the fix it looked like.+## [2.0.0] - 2026-09-22A major number because the engine now answers three questions it could notdiff --git a/Cargo.lock b/Cargo.lockindex 949bdaa0..fd9337b2 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -2811,7 +2811,7 @@ dependencies = [[[package]]name = "open-ontologies"-version = "2.0.0"+version = "2.1.0"dependencies = ["anyhow","arrow 54.3.1",diff --git a/Cargo.toml b/Cargo.tomlindex 94c0f154..e01e1afe 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -1,6 +1,6 @@[package]name = "open-ontologies"-version = "2.0.0"+version = "2.1.0"edition = "2024"description = "AI-native ontology engine: an MCP server and CLI for building, validating, querying and reasoning over RDF and OWL, with a native SHIQ tableaux reasoner, SHACL validation and SPARQL. Single binary, no JVM."license = "MIT"diff --git a/docs/UPSTREAM_ISSUES.md b/docs/UPSTREAM_ISSUES.mdindex d5c080fb..d915aa32 100644--- a/docs/UPSTREAM_ISSUES.md+++ b/docs/UPSTREAM_ISSUES.md@@ -116,3 +116,71 @@ up here rather than attempted blind.`sh:datatype` constraint naming one of these as unevaluated rather than answeringit wrongly. `tests/datatype_preservation_test.rs` pins the exact affected set andfails in both directions, so the workaround is removed when this is fixed.++---++## 2. A request that arrives before `initialize` ends the server without a reply++**Repository:** `modelcontextprotocol/rust-sdk` (`rmcp`) · **Versions:** 1.4.0 and+1.8.0, both measured · **Severity: high.** A conformant-enough client that opens+with any request other than `initialize` cannot use an rmcp server at all, and+the failure carries no diagnostic to the client because nothing is written back.++### Reproduction++Feed a server built with `serve(stdio())` two lines, in this order:++```json+{"jsonrpc":"2.0","id":1,"method":"server/discover","params":{}}+{"jsonrpc":"2.0","id":2,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"probe","version":"0"}}}+```++Observed: the process exits non-zero with `ExpectedInitializeRequest` and writes+**zero bytes** to stdout. The client sees the stream close while it waits on its+own `initialize` and reports EOF.++Reverse the two lines and everything works: the same `server/discover` is+answered `-32601` by the default `on_custom_request` and the handshake completes.+**Arrival order is the whole difference between a routine error reply and a dead+process.**++### Where it happens++`src/service/server.rs`. The handshake loop reads messages itself until it sees+`initialize`, answers a pre-initialize `ping`, and turns everything else away+(1.4.0 at :191 and :200; 1.8.0 at :212 and :221). `serve` then returns the error+and the caller's `?` ends the process.++Measured on both versions in the local registry: unguarded, both reject the+sequence above; wrapped in a transport that answers the early request, both+complete the handshake. **The version bump is not the fix it looks like.**++### Why we think this is a defect and not strictness++JSON-RPC 2.0 obliges a server to respond to every request carrying an `id`.+Exiting without a reply is itself a protocol violation, so the current behaviour+is the *less* conformant of the two available ones, not the stricter. MCP's+lifecycle says a client SHOULD NOT send non-ping requests before the initialize+response, and SHOULD NOT is not MUST NOT.++rmcp already reasons this way one screen further down: the comment at 1.4.0+`src/service/server.rs:250-256` explains why a message arriving before the+`initialized` notification is processed rather than rejected. The suggestion here+is to apply that same rule one message earlier, replying with a JSON-RPC error+instead of ending the connection.++### It is not hypothetical++Reported against us in fabio-rovai/open-ontologies#260 by a user whose client+opens with `server/discover`. The same reporter notes the current release of+Goose triggers it as well, so this reaches an MCP client with a real user base+and would affect every rmcp-based server equally.++### Our workaround++`src/mcp_handshake.rs` wraps the stdio transport and answers a pre-initialize+request with a JSON-RPC error, `-32601` for an unknown method so the reply+matches what the post-handshake path already returns and `-32600` for a known+MCP method sent out of order, then becomes transparent. A pre-initialize+notification is dropped. `tests/mcp_handshake_guard_test.rs` pins it and fails+in both directions. The wrapper is removed if upstream takes this.