Repository navigation
Add Mcp-Method and Mcp-Name headers to HTTP requests - #288
EhsanAzish80 wants to merge 2 commits into
Conversation
|
One value-encoding edge looks inconsistent with SEP-2243.
return bytes.allSatisfy { $0 == 0x09 || (0x20...0x7E).contains($0) }But SEP-2243's MCP encoding rules are stricter than the generic HTTP field-value allowance: after the leading/trailing whitespace check, the plain representation must be ASCII So a name like Could AI-assisted review; checked the current PR head against SEP-2243 value-encoding rules before posting. |
|
Fixed the tab encoding edge in bcc4d95 and added the regression. All 552 Swift tests passed locally. AI helped write the new test; I ran it. Could a maintainer review this and approve CI? |
Closes #228.
The HTTP client now sends
Mcp-Methodfor JSON-RPC requests and notifications, plusMcp-Namefor tool calls, prompt reads, and resource reads. Names that cannot be sent safely as plain ASCII use the Base64 format from SEP-2243. Responses and legacy batches have no single method to mirror.I added a transport test for each request type, notifications, responses, non-ASCII names, whitespace, and names that look like the Base64 marker. The new test failed before the change. After the change,
swift testpassed: 552 tests across 40 suites.AI assistance helped prepare the implementation and tests.