Skip to content

Fix MCP extra args rejection and bank ID resolution priority#351

Merged
nicoloboschi merged 2 commits intomainfrom
fix/mcp-extra-args-and-bank-priority
Feb 12, 2026
Merged

Fix MCP extra args rejection and bank ID resolution priority#351
nicoloboschi merged 2 commits intomainfrom
fix/mcp-extra-args-and-bank-priority

Conversation

@DK09876
Copy link
Contributor

@DK09876 DK09876 commented Feb 11, 2026

Summary

  • Strip unknown tool arguments (e.g., explanation) that LLMs add to tools/call requests before they reach FastMCP's Pydantic validation
  • Fix bank ID resolution priority: URL path now takes priority over X-Bank-Id header, making single-bank mode authoritative

Test plan

  • All 90 MCP tests pass (test_mcp_tools.py, test_mcp_endpoint_routing.py, test_mcp_extension.py)
  • Verified extra args are stripped via curl against deployed server
  • Verified bank ID path priority works correctly

🤖 Generated with Claude Code

@DK09876 DK09876 force-pushed the fix/mcp-extra-args-and-bank-priority branch from 743e3ce to 17c1a3b Compare February 12, 2026 00:17
DK09876 and others added 2 commits February 11, 2026 18:04
Two fixes to the MCP middleware:

1. Strip unknown tool arguments: LLMs frequently add extra fields
   like "explanation" to tool calls. FastMCP's Pydantic TypeAdapter
   rejects these with "Unexpected keyword argument". The middleware
   now intercepts tools/call requests and removes unknown fields
   before they reach validation.

2. Bank ID resolution priority: Path now takes priority over header.
   Previously X-Bank-Id header was checked first, meaning /mcp/my-bank/
   with X-Bank-Id: other-bank would silently use other-bank in multi-bank
   mode. Now the URL path is authoritative — single-bank mode connections
   cannot be overridden by headers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add all mental model tools (create, list, get, update, delete, refresh)
- Add list_banks and create_bank tool docs
- Document single-bank vs multi-bank modes
- Fix bank selection priority: path > header > default
- Add Accept header to curl example
- Add timestamp param to retain, max_tokens to recall

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DK09876 DK09876 force-pushed the fix/mcp-extra-args-and-bank-priority branch from 2ef9d3f to 8a9f58f Compare February 12, 2026 01:05
Copy link
Collaborator

@nicoloboschi nicoloboschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nicoloboschi nicoloboschi merged commit 7ee229b into main Feb 12, 2026
26 of 28 checks passed
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.

2 participants