Skip to content

mcp-bridge: harden confirmations, exit handling, host checks - #392

Open
hassan1731996 wants to merge 3 commits into
openhome-dev:devfrom
hassan1731996:followup-mcp-bridge
Open

hassan1731996 wants to merge 3 commits into
openhome-dev:devfrom
hassan1731996:followup-mcp-bridge

Conversation

@hassan1731996

@hassan1731996 hassan1731996 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What does this Ability do?

Follow-up to #391 (MCP Bridge), covering the items from the review and a few found afterwards. MCP Bridge lets you use any MCP server's tools by voice. This PR only hardens existing behaviour.

  • Confirmations: the tool name now comes from code in every spoken confirmation, and the fallback sentence lists the values being sent.
  • Answers vs. exit: "Done", "all good" and similar can be a real answer (for example a Trello list called "Done") and no longer end the session. "Cancel", "nothing" or "skip" while answering a question skips just that step. A bare "cancel" at a confirmation means no.
  • Write detection: more write verbs, including "-ing" and "-ed" forms. A tool that reads like a write still gets the "might not be undoable" warning even if the server marks it read-only.
  • Personal-data check: also covers numbers and nested values. Non-Latin speech and names no longer normalize to nothing.
  • Address check: number-style hosts such as 2130706433 and 127.1 are refused. The README states that DNS-based tricks are not caught.

Suggested Trigger Words

Unchanged from #391.

Type

  • New community Ability
  • Improvement to existing Ability
  • Bug fix
  • Documentation update

External APIs

  • No external APIs
  • Uses external API(s): the MCP server the user configures (unchanged)

Testing

  • Tested in OpenHome Live Editor
  • All exit paths tested (said "stop", "exit", etc.)
  • Error scenarios tested (API down, bad input, etc.)

Not yet run in the Live Editor. Checked offline: the file compiles, and the changed helpers pass a small test harness (numeric hosts, write detection, personal-data check, non-Latin text). The live run against https://mcp.deepwiki.com/mcp and https://docs.mcp.cloudflare.com/mcp is still to do and I'll tick these boxes after it.

Checklist

  • Files are in community/my-ability-name/ (community/mcp-bridge/)
  • README.md included with description, suggested triggers, and setup
  • No hardcoded API keys

Anything else?

The items first left out are now in this PR too:

  • Total wait: connecting, listing tools and calling a tool each stop waiting after a wall-clock limit (45, 60 and 45 seconds), so a server that trickles bytes can't hold the session. Event streams are now read in small chunks, so the time check runs even when no newline arrives.
  • Size cap: a declared Content-Length over the cap is refused up front. The no-streaming fallback is used only when the error is about stream, so an unrelated TypeError no longer turns streaming off for the session.
  • Busy servers: a 429 or 5xx while connecting or listing is reported as "busy" and is not taken as a sign of an older server. A server that answers server/discover with a 5xx still gets one legacy handshake.
  • Arguments: keys the schema doesn't declare are dropped unless extras are explicitly allowed. A spoken word can't fill a list of objects, and such a field is treated as one that can't be collected by voice.

Found in the Live Editor: saving the merged #391 code in the OpenHome editor is refused by the platform's push check, which CI does not run. Two things are flagged: the event-stream prefix data: (read as a URL scheme) and the protocol's io.modelcontextprotocol/... metadata keys (read as use of the io module). Event-stream lines are now split at the first colon, and the io. prefix is joined at runtime. After this the editor says "Release files validated successfully and saved".

Offline checks added: event stream split across chunks (including a multi-byte character and CRLF), a dripping stream hitting the deadline, the declared-size refusal, busy handling on discover and list, and the argument rules.

Name the tool in code in every confirmation, let answers like Done through, skip a step on cancel, warn on write-like tools marked read-only, and refuse number-style hosts.
@hassan1731996
hassan1731996 requested a review from a team as a code owner November 15, 2026 17:23
@github-actions

Copy link
Copy Markdown
Contributor

🔀 Branch Merge Check

PR direction: followup-mcp-bridge → dev

✅ Passed — followup-mcp-bridge → dev is a valid merge direction

@github-actions

Copy link
Copy Markdown
Contributor

✅ Community PR Path Check — Passed

All changed files are inside the community/ folder. Looks good!

@github-actions github-actions Bot added the community-ability Community-contributed ability label Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

✅ Ability Validation Passed

📋 Validating: community/mcp-bridge
  ⚠️  Found 3 classes — only one class per main.py is recommended
  ✅ All checks passed!

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Lint Results

🔧 Formatting fixes available

This PR is from a fork, so fixes could not be pushed automatically. Download the python-lint-results artifact from the workflow run for the patch file, then run:

git apply autofix.patch

Files linted: community/mcp-bridge/main.py

✅ Flake8 — Passed

✅ All checks passed!

Stop waiting after a wall-clock limit, read event streams in small chunks, check the declared size, report 429/5xx as busy, and drop undeclared arguments.
The platform rejects the event-stream data prefix and the io. metadata keys as forbidden uses. Split each stream line at the first colon and join the reverse-DNS prefix at runtime.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-ability Community-contributed ability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant