Skip to content

Implement MCP integration and improve script generation logic - #1895

Merged
nmaguiar merged 3 commits into
masterfrom
t8
Sep 3, 2026
Merged

Implement MCP integration and improve script generation logic#1895
nmaguiar merged 3 commits into
masterfrom
t8

Conversation

@nmaguiar

@nmaguiar nmaguiar commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces support for the "modern" (2026-07-28+) stateless, per-request protocol era in the Model Context Protocol (MCP) client and server, while maintaining full backward compatibility with legacy (initialize-handshake-based) protocol versions. The changes allow clients to automatically negotiate the most advanced protocol supported by the server, and servers to handle both legacy and modern requests side-by-side. Additionally, there are improvements to Unix launcher scripts for safer terminal state restoration.

MCP Protocol Modernization and Negotiation

  • The MCP client ($mcp in js/openaf.js) now supports automatic negotiation of protocol versions, including the new modern, stateless era (2026-07-28+). If aOptions.protocolVersion is set to "auto", the client probes the server and uses the most advanced mutually supported protocol. Legacy behavior remains the default for callers not opting into "auto". [1] [2] [3]
  • The MCP server (ow.server.mcp in js/owrap.server.js) implements helpers for protocol version negotiation, request classification (modern vs. legacy), error construction, and result wrapping. The server can now respond to modern-era requests with enhanced metadata and error handling, while preserving legacy behavior for older clients.
  • The ow.server.mcpStdio function now accepts an opts parameter to opt into modern protocol support, serving both legacy and modern clients concurrently. [1] [2]

Client and Server API Enhancements

  • The MCP client exposes new properties (_era, _negotiatedVersion) and methods (e.g., isInputRequired) to help callers understand the negotiated protocol and handle modern server features, such as input-required results. [1] [2]

Unix Script Improvements

  • The Unix launcher script generation (genUnixSttyRestore in js/genScripts.js) now ensures the terminal state is safely restored even if an exact snapshot is unavailable, falling back to stty sane to prevent leaving the shell in an unusable state. Signal handling is also improved for portability. [1] [2]

These changes collectively enable seamless adoption of the new MCP protocol era, while ensuring existing clients and servers remain fully functional without modification.


References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

- Update openaf.js and owrap.server.js to support MCP functionality
- Add new MCP test suite in autoTestAll.MCP.js and autoTestAll.MCP.yaml
Modified js/genScripts.js with 15 insertions and 4 deletions to improve script generation.
@nmaguiar
nmaguiar merged commit 0d6a724 into master Sep 3, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Continuous Enhancement Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

1 participant