Skip to content

Add MCP tool execution middleware - #801

Merged
Aymericr merged 1 commit into
mainfrom
feat/mcp-tool-executor-20260909
Sep 9, 2026
Merged

Add MCP tool execution middleware#801
Aymericr merged 1 commit into
mainfrom
feat/mcp-tool-executor-20260909

Conversation

@Aymericr

@Aymericr Aymericr commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Description

Expose a server-level executeTool hook so stateful MCP hosts can wrap every registered tool for session-local ordering or other execution controls. The callback receives the registered tool name and an execute function, while resources, prompts, and protocol notifications remain unaffected.

This is the public-package prerequisite for serializing hosted Pascal tool calls without blocking MCP cancellation or SSE traffic.

Validation

  • bun test packages/mcp/src — 357 tests passed, 1,356 assertions.
  • bunx biome check packages/mcp/src/server.ts packages/mcp/src/server.test.ts
  • git diff --check
  • Package TypeScript build has no diagnostics in changed files; the workspace currently reports eight pre-existing implicit-any diagnostics in packages/mcp/src/tools/scene-query.ts.

Note

Low Risk
Optional, additive server factory API; behavior is unchanged when executeTool is omitted, with scope limited to tool registration wrapping.

Overview
Adds an optional executeTool hook on createPascalMcpServer so hosts can wrap every registered tool handler (e.g. to serialize access to a stateful bridge) without touching resources, prompts, or other MCP traffic.

When provided, installToolExecutor temporarily wraps server.registerTool so each tool callback runs through { name, execute } before the real handler runs. A new integration test drives get_scene over in-memory transport and asserts the wrapper’s before/after ordering.

Reviewed by Cursor Bugbot for commit ff953a1. Bugbot is set up for automated code reviews on this repo. Configure here.

@pascal

pascal Bot commented Sep 9, 2026

Copy link
Copy Markdown

I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…).

Please try again, rephrase, or reach out if it keeps failing.

Error id: 68189220-f4b6-459f-9ddd-821219f104ea

@Aymericr
Aymericr merged commit f758c63 into main Sep 9, 2026
4 checks passed
@Aymericr
Aymericr deleted the feat/mcp-tool-executor-20260909 branch September 9, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant