Repository navigation
Expose bounded MCP server sessions and supervisor observations #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
fc239d0
refactor(contract): move MCP algorithms behind bounded module calls
senamakel cf16f89
docs(contract): explain pure vocabulary and remaining host migration
senamakel dd2b06f
fix: keep shared argument errors available without module feature
senamakel 7b3eede
fix: satisfy stable clippy checks
senamakel 52e862a
fix: preserve bounded batch response framing
senamakel 267d757
feat: ignore unknown supervisor wire variants
senamakel d619a6c
docs: publish TinyMCP pure vocabulary surface
senamakel 3451a80
Merge remote-tracking branch 'origin/main' into enforce-module-bounda…
senamakel 5c64a24
fix(bus): preserve forward-compatible server enums
senamakel 2f65734
feat(tinymcp): open directories with host config
senamakel 80d8408
feat(tinymcp): add configured directory lifecycle
senamakel 15895b6
Merge pull request #59 from tinyhumansai/openconfigured-directory-lif…
senamakel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,101 +1,35 @@ | ||
| # tinymcp-bus | ||
|
|
||
| Every type that crosses the template module's `TinyBus` boundary, and the names | ||
| of the members that carry them. | ||
|
|
||
| The template ships as a loadable module so a host does not compile the | ||
| implementation: `crates/tinymcp` is built as a `cdylib` and exports one object. | ||
| A host can load that binary but cannot `use` anything out of it, so the payload | ||
| vocabulary has to be published as an ordinary library. This is it. | ||
|
|
||
| | module | what it holds | | ||
| | ---------- | ------------------------------------------------------------ | | ||
| | `names` | interface name, object path, one constant per member | | ||
| | `greeting` | the value vocabulary: the `Greet` request and response | | ||
| | `agent_tools` | tool specs a host exposes to a model, argument normalization, and the structured call outcome | | ||
| | `version` | `CONTRACT_VERSION` and the bind rule a host applies to it | | ||
|
|
||
| Two dependencies, both pure Rust: `serde` and `serde_json`. | ||
|
|
||
| ## This crate sits underneath `template` | ||
|
|
||
| `template` **depends on this crate and re-exports all of it**. That direction | ||
| matters, and it is the opposite of the obvious one. | ||
|
|
||
| A *host* needs the payload types and needs nothing else: it loads the module and | ||
| makes calls, so it names `GreetRequest` and `GreetResponse` but implements no | ||
| behavior and links no transport. Making it depend on the whole module crate — and | ||
| through it on `tinybus`, `tokio`, and the module SDK — to spell a payload type | ||
| would be the wrong shape. | ||
|
|
||
| The alternative, a parallel set of payload types for hosts, is worse: a | ||
| `GreetRequest` defined twice is two distinct types, with a conversion at every | ||
| call site that nothing checks. One definition, here, at the bottom. | ||
|
|
||
| Because the re-export is by module as well as by item, `tinymcp::GreetRequest`, | ||
| `tinymcp::names::OBJECT_PATH`, and `tinymcp_bus::greeting::GreetRequest` all | ||
| resolve to the same items, not twins. | ||
|
|
||
| So: a module author depends on `template` and gets behavior and vocabulary. A | ||
| host depends on `tinymcp-bus` and gets vocabulary alone. | ||
|
|
||
| ## What is deliberately absent | ||
|
|
||
| **No behavior.** `greet` lives in `crates/tinymcp`. A payload type describes | ||
| what a frame carries, not what the module does with it. The split is readable | ||
| off the path: a name here is data, a name there is an obligation. | ||
|
|
||
| **No transport.** This crate does not depend on `tinybus` and holds no | ||
| connection, client, or codec. A host already owns its connection — its reconnect | ||
| policy, its timeouts, its tracing — and the useful part is the vocabulary. | ||
|
|
||
| That is also structural, not just preference: `tinybus` is vendored as a | ||
| submodule whose manifest inherits fields from its own nested | ||
| `[workspace.package]`. Keeping the contract crate transport-free is what keeps | ||
| it down to two dependencies and what lets anything in the workspace — or outside | ||
| it — depend on it freely. CI asserts the dependency tree stays that way. | ||
|
|
||
| ## Making a call | ||
|
|
||
| Arguments travel as a positional JSON array — `#[tinybus::interface]` decodes | ||
| them into a tuple — and the member name comes from `names`: | ||
|
|
||
| ```rust,ignore | ||
| use tinymcp_bus::{names, GreetRequest, GreetResponse}; | ||
|
|
||
| let proxy = connection.proxy(names::INTERFACE, names::OBJECT_PATH, names::INTERFACE)?; | ||
| let reply: GreetResponse = proxy | ||
| .call(names::methods::GREET, (GreetRequest::new("Ferris"),)) | ||
| .await?; | ||
| assert_eq!(reply.greeting, "Hello, Ferris!"); | ||
| ``` | ||
|
|
||
| Nothing above is a string literal at a call site. Renaming the interface, the | ||
| path, or a member is therefore a compile error in every consumer rather than an | ||
| `UnknownMethod` discovered at runtime. | ||
|
|
||
| ## Staying in step with the module | ||
|
|
||
| `names::METHODS` lists every member in dispatch order. `crates/tinymcp` asserts | ||
| its served members against that list, so a method added to the interface without | ||
| an entry here fails that crate's tests rather than surfacing in a host. | ||
|
|
||
| ## Versioning | ||
|
|
||
| `CONTRACT_VERSION` describes *this vocabulary*, not the package. Bump its major | ||
| component when a payload's wire form changes incompatibly or a member is removed | ||
| or renamed, and its minor component when a member or an optional field is added. | ||
| It is deliberately independent of the package version the release workflow owns, | ||
| which tracks the shipped artifact. | ||
|
|
||
| The payload tests pin the serde representation, because that representation is | ||
| the wire form: a host and a module that disagree about a field name fail at | ||
| runtime with a decode error, so the shape is asserted rather than assumed. | ||
|
|
||
| ## Generating a project from the template | ||
|
|
||
| Rename the interface, the object path, and the member constants in `names` | ||
| together, replace `greeting` with the first real payload family, and reset | ||
| `CONTRACT_VERSION` to `(1, 0)` for the new contract. Keep the crate | ||
| dependency-light: the moment it links a transport or a runtime, the reason it | ||
| exists is gone. | ||
| Shared serialized MCP vocabulary, fixed tool declarations, errors, method names | ||
| and contract version. The implementation re-exports the same definitions. | ||
| Normal/build dependency closures contain only serialization/schema utilities, | ||
| including with all features enabled. No optional runtime, transport, native or | ||
| TinyTools dependency belongs here. | ||
|
|
||
| DTO constructors, fixed catalog/schema declarations and serde helpers are | ||
| vocabulary. Protocol routing, transport, argument normalization, dynamic | ||
| metadata preparation, query filtering, persisted-value parsing and redaction | ||
| execute in the implementation. Generic lexical helpers live in TinyTools. | ||
| The sanitize module retains only MCP presentation limits. | ||
|
|
||
| Contract 1.9 adds four one-argument operations: TransformText, | ||
| NormalizeToolArguments, DisplayRemoteTool and RenderToolOutput. Their requests | ||
| and output are capped at 1 MiB. Rendering applies its cap incrementally, before | ||
| buffering oversized pretty JSON or joined content. Existing member arities and | ||
| wire forms are preserved. Prefer member constants from names::methods. | ||
|
|
||
| Contract 1.10 adds the one-argument `OpenConfigured` operation and its | ||
| `OpenConfiguredRequest` payload. It pairs a data directory with that host's | ||
| MCP client settings; `Open` and its original string argument remain unchanged. | ||
| Because those settings may contain credentials, callers send this request using | ||
| TinyBus's confidential-call path. Contract 1.11 adds `Close(data_dir)` and the | ||
| nonblocking `TransitionStatus(id)` observation. `OpenConfigured` returns an | ||
| `OpenConfiguredResponse` carrying the object path and lifecycle transition id; | ||
| replacement and old-service cleanup are complete only when the status is | ||
| `complete`. The root remains available after close, with no persistent | ||
| directory or static client configuration. | ||
|
|
||
| Library consumers bring implementation extension traits into scope for moved | ||
| DTO methods. Contract-only hosts call the compiled module. See | ||
| [the relocation specification](../../docs/specs/pure-vocabulary.md) for public | ||
| API compatibility and remaining transport/host integration work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.