Skip to content

feat!: require Pi's built-in MCP and remove the extension's own client - #36

Merged
vitaliyslion merged 1 commit into
mainfrom
feat/native-mcp-only
Oct 24, 2026
Merged

vitaliyslion merged 1 commit into
mainfrom
feat/native-mcp-only

Conversation

@vitaliyslion

@vitaliyslion vitaliyslion commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The extension now registers gortex mcp with Pi's built-in MCP (pi.registerMcpServer) and leaves the tool channel entirely to Pi. Its own stdio MCP client (src/mcp-client.ts), tool registration (src/tools.ts), shared state (src/state.ts) and the native_mcp setting are removed. The remaining native* identifiers are renamed (src/native.ts -> src/mcp.ts, isNativeGortexTool -> isGortexTool, and so on).

Behaviour without a tool channel:

  • When no MCP connector is loaded (--no-mcp), the binary does not resolve, or Pi refuses the registration, nothing is registered (or the refusal is recorded) and the first turn tells the model graph tools are unavailable and why.
  • A refused registration may mean another source already supplies a gortex server, so the first turn still waits for its tools and reports the refusal only if none appear.
  • Read discipline is skipped once the first turn has waited and found no graph tools, so Pi's own tools are never blocked with nothing to use instead.
  • The first-turn wait is 15 s, because Pi loads its MCP extension after file extensions and its own 10 s connect wait runs after ours.

Each session builds a fresh extension instance, so each registers once; the re-register and withdraw logic and the session_shutdown handler are gone.

Closes #33

Breaking change: Pi 1.0+ with its MCP extension loaded is required. native_mcp: false / GORTEX_NATIVE_MCP no longer select a fallback channel. Both Pi peer dependencies (pi-coding-agent, pi-tui) are now >=1.0.0.

Related issues:

Deferred, unchanged by this PR:

Testing

  • npm run check passes (typecheck + 136 tests)
  • New behaviour has a suite that drives it through Pi's ExtensionRunner (see docs/tests.md)
  • Tried by hand in Pi (pi -e /path/to/checkout), if user-visible

Manual runs on Pi 1.3.0 with gortex v0.64.8 (pi -ne -e builtin:mcp -e <checkout> --mode json -p ...):

  • Normal start: briefing arrives, 21 mcp__gortex__* tools registered, Pi's read blocked and redirected to the graph tools.
  • --no-mcp: the model is told MCP support is not loaded; Pi's read is allowed.
  • GORTEX_BIN=/nope/gortex: the model is told the binary is missing; Pi's read is allowed.
  • Duplicate registration (another extension registers gortex first): the turn waits for the tools and no false unavailable message appears.

Mutation checks confirmed the suites fail when the enforcement gate, the tools-from-elsewhere check, the settled gate, the refusal wait or the late session_start fix is reverted, and when a handler throws.

Checklist

  • No runtime dependencies added
  • README configuration table updated, if config changed
  • docs/architecture.md updated briefly, only if a design decision changed
  • Works on Windows paths and process spawning, if touching either

The extension now registers `gortex mcp` with Pi's built-in MCP and leaves
the tool channel to Pi. Its own stdio client, tool registration and the
`native_mcp` setting are gone, and the remaining identifiers drop the
`native` prefix (`src/native.ts` -> `src/mcp.ts`).

When no MCP connector is loaded, the binary does not resolve or Pi refuses
the registration, the first turn tells the model graph tools are
unavailable, and read discipline stays off until graph tools appear.

BREAKING CHANGE: Pi 1.0 or later with its MCP extension loaded is required.
`native_mcp: false` and `GORTEX_NATIVE_MCP` no longer select a fallback.
Both Pi peer dependencies are now `>=1.0.0`.

Closes #33
@vitaliyslion vitaliyslion added breaking Breaking change for users or config enhancement New feature or request labels Oct 24, 2026
@vitaliyslion
vitaliyslion merged commit c880b7b into main Oct 24, 2026
3 checks passed
@vitaliyslion
vitaliyslion deleted the feat/native-mcp-only branch October 24, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change for users or config enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove the extension's own MCP client and require Pi's built-in MCP

1 participant