Skip to content

Commit 614f19f

Browse files
Merge branch 'main' into feature/sep-2106-output-schema-relaxation
2 parents c30725c + b8c4d95 commit 614f19f

33 files changed

Lines changed: 2854 additions & 28 deletions

.github/workflows/ci-build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- name: 🔧 Set up Node.js
5353
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
5454
with:
55-
node-version: '20'
55+
node-version: '22'
5656

5757
- name: 📦 Install pinned npm dependencies for tests
5858
run: npm ci

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Cake tools
22
/[Tt]ools/
33

4+
# Language server cache
5+
*.lscache
6+
47
# Build output
58
[Bb]uildArtifacts/
69
# Build results

docs/concepts/tools/tools.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,28 @@ public static string Search(
315315
// Schema will include descriptions and default value for maxResults
316316
}
317317
```
318+
319+
### Custom HTTP headers from tool parameters
320+
321+
When using the Streamable HTTP transport, tool parameters can be mirrored as HTTP headers so that network infrastructure (load balancers, proxies, gateways) can make routing decisions without parsing the JSON-RPC request body. Apply the <xref:ModelContextProtocol.Server.McpHeaderAttribute> to a parameter to opt it in:
322+
323+
```csharp
324+
[McpServerTool, Description("Executes a SQL query in a specific region")]
325+
public static string ExecuteSql(
326+
[McpHeader("Region"), Description("Target datacenter region")] string region,
327+
[Description("The SQL query to execute")] string query)
328+
{
329+
// Clients will send an additional HTTP header:
330+
// Mcp-Param-Region: <region value>
331+
}
332+
```
333+
334+
When the tool's schema is generated, the annotated parameter includes an `x-mcp-header` extension property. Clients read this annotation and automatically add the corresponding `Mcp-Param-{Name}` header on outgoing `tools/call` requests. The server validates that the header value matches the value in the JSON-RPC body.
335+
336+
Rules and constraints:
337+
338+
- Only primitive parameter types (`string`, numeric types, `bool`) are supported.
339+
- The header name must contain only visible ASCII characters (0x21–0x7E) excluding colon (`:`).
340+
- Values containing non-ASCII characters, control characters, or leading/trailing whitespace are Base64-encoded using the `=?base64?{value}?=` wrapper.
341+
- Header names must be case-insensitively unique within the tool's input schema.
342+
- Header validation is enforced only for protocol versions that support the HTTP Standardization feature (currently `DRAFT-2026-v1` and later).

package-lock.json

Lines changed: 225 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"description": "Pinned npm dependencies for MCP C# SDK integration and conformance tests",
44
"dependencies": {
5-
"@modelcontextprotocol/conformance": "0.1.13",
5+
"@modelcontextprotocol/conformance": "0.1.16",
66
"@modelcontextprotocol/server-everything": "2026.1.26",
77
"@modelcontextprotocol/server-memory": "2026.1.26"
88
}

0 commit comments

Comments
 (0)