webmcp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f211ae3ee7700b7d3da74922a27328c3c412955110b8c38c4e560a4363ba565f
4
- data.tar.gz: 186b9f6456258def8ef8c239cec92be83f062274a29eb03387055ca3e17d4b34
3
+ metadata.gz: c32274fd7dc9ffe43c9204439ab0d2b4bb40bfb9720a6a90aa3afdc4ee2b973c
4
+ data.tar.gz: 4801f44a17de9f4ac612eb6fe57dc8b95814f851dc381b3547ba0e63c505584c
5
5
  SHA512:
6
- metadata.gz: 9802bbe173071fe7ac5dbc9b5c30edd66633ebb11082fa168fa494abc5b84a22c34f631f619d114cb5461a6884922cd8a8c453b586db15dc226eaf60c8f6c708
7
- data.tar.gz: e452595f3829a74ad941d83a047b56e3968a7ef7de8b912ec905318d1b89bafa497bc2bb35a9fd34c82c28524fe9d0bb78be7702dcda1837405d7b941393ecb8
6
+ metadata.gz: 153a2e664db64df9b278b7607d50fd4dafdf854977e2ca4f849545a2b68b13e66c8078c0b45faf43c46c8d4ce78c867c1723b37f521d4adaf3db65a6ed2d584a
7
+ data.tar.gz: a385501050755b4c71afe2e264afeff7a8f71c74e6d603e88ea920a40f88731f71dbb4ef729e6e840a3cdcf68b3f63378ed60db49bb5c63e7620b4dbb218b2e5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 — 2026-10-06
4
+
5
+ - Documentation for people and AI agents: `AGENTS.md`, `llms.txt`, a README troubleshooting table with exact error messages, and changelog/issue/documentation links in the gemspec.
6
+
3
7
  ## 0.1.0
4
8
 
5
9
  - Autostart opted-in manifests from the external runtime under strict CSP, expose
data/README.md CHANGED
@@ -1,6 +1,45 @@
1
1
  # webmcp
2
2
 
3
- 0.1.0 · Spec baseline: **Draft CG Report 2026-10-02** · Browser test target: **Chrome 154.0.8037.98**. All 9 real-browser checks pass on Rails 8.1 and 8.0, plus a production asset/CSP smoke test (details below).
3
+ [![Gem Version](https://img.shields.io/gem/v/webmcp)](https://rubygems.org/gems/webmcp) [![CI](https://github.com/seunghan91/webmcp/actions/workflows/ci.yml/badge.svg)](https://github.com/seunghan91/webmcp/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.txt)
4
+
5
+ Server-side WebMCP toolkit for Ruby and Rails — the reference implementation of the family.
6
+
7
+ [WebMCP](https://github.com/webmachinelearning/webmcp) is a W3C Community Group
8
+ proposal that lets a web page register tools an in-browser AI agent can call
9
+ through `document.modelContext`. This gem is the server side of that: you define
10
+ tools where your app already knows its routes, sessions and permissions, and a
11
+ small browser runtime registers them on the pages you choose. When an agent calls
12
+ a tool, the runtime calls your existing same-origin endpoint with the user's
13
+ session and CSRF token, so authentication and authorization stay in your app.
14
+
15
+ - **Tool definitions** — `WebMCP::Tool.define`, validated against the spec's naming, annotation and schema rules at boot.
16
+ - **Projection from MCP SDK tools** — `WebMCP::Tool.from_mcp` reuses a tool's identity from the official [`mcp`](https://rubygems.org/gems/mcp) gem and makes every browser-side difference explicit, with a pinned source fingerprint that fails tests when the MCP tool drifts.
17
+ - **Rails helpers** — `webmcp_manifest_tag` (per-page opt-in), `webmcp_runtime_tag` (CSP nonce aware, autostart), `form_with ..., webmcp: {...}` for declarative forms (keeps custom FormBuilders).
18
+ - **Origin Trial** — `WebMCP::OriginTrial` Rack middleware and `webmcp_origin_trial_meta_tag`.
19
+ - **Shared browser runtime** — zero dependencies; same-origin only, `redirect: 'error'`, CSRF read per call, declared parameters only, read/write outcome envelopes, no retries.
20
+
21
+ ```ruby
22
+ # Gemfile
23
+ gem "webmcp", "~> 0.1"
24
+ ```
25
+
26
+ **Status:** 0.x, tracking the WebMCP Draft CG Report of 2026-10-02. WebMCP runs
27
+ behind a Chrome origin trial (Chrome 149–156, extension requested to 162) or the
28
+ `chrome://flags/#enable-webmcp-testing` flag. The shared runtime is tested in real
29
+ Chrome 154 by the [Ruby reference suite](https://github.com/seunghan91/webmcp/blob/main/test/integration/RESULTS.md)
30
+ (CSRF-protected writes, blocked redirects, HTTP errors, Turbo navigation, strict CSP).
31
+
32
+ | Language | Package | Registry |
33
+ |---|---|---|
34
+ | Ruby / Rails (reference) | [`webmcp`](https://github.com/seunghan91/webmcp) | [RubyGems](https://rubygems.org/gems/webmcp) |
35
+ | Go (`net/http`) | [`webmcp-go`](https://github.com/seunghan91/webmcp-go) | [pkg.go.dev](https://pkg.go.dev/github.com/seunghan91/webmcp-go) |
36
+ | Python / Django | [`webmcp-django`](https://github.com/seunghan91/webmcp-django) | [PyPI](https://pypi.org/project/webmcp-django/) |
37
+ | Rust | [`webmcp`](https://github.com/seunghan91/webmcp-rust) | [crates.io](https://crates.io/crates/webmcp) |
38
+
39
+ All four emit the same manifest v1 (checked against shared conformance fixtures,
40
+ fingerprints included) and ship the byte-identical browser runtime.
41
+
42
+ Coding agents: start with [AGENTS.md](AGENTS.md). LLM summary: [llms.txt](llms.txt).
4
43
 
5
44
  ## Intent: share identity, project the rest explicitly
6
45
 
@@ -220,6 +259,26 @@ This copies `runtime/webmcp-runtime.js` into
220
259
  The Railtie adds asset paths and, for Sprockets, a precompile entry. Other asset
221
260
  pipelines can copy the canonical module directly. Do not edit the generated copy.
222
261
 
262
+ ## Troubleshooting
263
+
264
+ | Symptom (exact text) | Cause | Fix |
265
+ |---|---|---|
266
+ | `document.modelContext` is `undefined` | WebMCP is unavailable or the page is not a secure context | Chrome 149+ with the origin trial token (header or `<meta http-equiv="origin-trial">`) or `chrome://flags/#enable-webmcp-testing`; serve over HTTPS or localhost |
267
+ | `NotAllowedError` from `registerTool` | The document may not use the `tools` Permissions Policy feature (default allowlist `self`) | For cross-origin frames delegate with `allow="tools"` and make sure ancestor `Permissions-Policy` headers permit it |
268
+ | `UnknownError: Failed to parse input arguments` from `executeTool` | Chrome 154 and earlier accept only a JSON **string** input; object input ships in Chrome 155 | Agent side: pass `JSON.stringify(input)` on Chrome ≤ 154. The runtime's `execute` receives an object either way |
269
+ | `SecurityError` from `registerTool` on an older trial build | The response sent `Origin-Agent-Cluster: ?0` (requirement removed from the spec on 2026-09-30, still enforced by older builds) | Stop sending `?0`; enable the OAC opt-out warning to find it |
270
+ | Console: `WebMCP: could not register tool "<name>"` with `InvalidStateError` | Another script in the same document already registered that name | Use unique names; names are unique per document, not per site |
271
+ | Console: `WebMCP: unsupported manifest version; no tools registered.` | Runtime and manifest come from different package versions | Upgrade so both use manifest v1 and the same runtime |
272
+ | Tool result `error.code: "csrf_token_missing"` | A non-GET tool (including a read-only POST) has CSRF transport configured but no readable token on the page | Render the configured token (Rails `csrf_meta_tags`, Django `{% webmcp_csrf_meta %}`, Go/Rust: your own escaped `<meta name="csrf-token">`) or configure a readable cookie source. Without CSRF transport the runtime skips this check |
273
+ | `error.code: "invalid_input"` | The agent sent an undeclared parameter, a missing required one, or the wrong scalar type | Fix the schema or descriptions; the runtime forwards declared parameters only |
274
+ | `error.code: "unknown_outcome"` | A write request failed after dispatch: network error, abort, or a **redirect** (redirects are never followed) | Make the endpoint answer without redirecting (e.g. 401 JSON instead of redirecting to sign-in); never retry automatically |
275
+ | `error.code: "network_error"` on a read | Network failure or redirect rejection after dispatch (an aborted read returns `aborted`) | Check connectivity and answer JSON without redirects; reads may be retried |
276
+ | `error.code: "response_too_large"` | Read response exceeded `maxResponseChars` | Narrow the query or raise the limit; responses are never truncated |
277
+ | `dataOmitted: "invalid_response"` on a write | The endpoint returned 2xx with a non-JSON body | Return JSON from write endpoints |
278
+ | Tools from the previous page remain, or none appear, after client-side navigation | Turbo is handled automatically; other SPAs (Inertia, React routers) are not | After the SPA replaces or removes `#webmcp-manifest`, `await WebMCPRuntime.handle.refresh()`. `webmcp:mounted` only delivers the initial handle. If the first page has no manifest, mount the runtime from your app entry (`mount()`) and keep that handle |
279
+ | A string-returning tool yields `hi` instead of `"hi"` | Chrome 154 does not JSON-quote string results (spec says it should) | The shared runtime always returns an envelope object, so this only affects hand-written tools |
280
+ | Definition error at boot such as `GET endpoints require read_only: true` | The definition violates a rule above | Fix the definition; errors are raised at boot on purpose |
281
+
223
282
  ## Security model
224
283
 
225
284
  The server remains the security boundary. Tools call existing same-origin
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebMCP
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webmcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - seunghan Kim
@@ -135,6 +135,9 @@ homepage: https://github.com/seunghan91/webmcp
135
135
  licenses:
136
136
  - MIT
137
137
  metadata:
138
+ changelog_uri: https://github.com/seunghan91/webmcp/blob/main/CHANGELOG.md
139
+ bug_tracker_uri: https://github.com/seunghan91/webmcp/issues
140
+ documentation_uri: https://github.com/seunghan91/webmcp#readme
138
141
  source_code_uri: https://github.com/seunghan91/webmcp
139
142
  rubygems_mfa_required: 'true'
140
143
  rdoc_options: []