Skip to content

Add headers field to McpTool spec#85

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-headers-to-mcptool-spec
Draft

Add headers field to McpTool spec#85
Copilot wants to merge 2 commits into
mainfrom
copilot/add-headers-to-mcptool-spec

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

MCP tools had no way to specify custom HTTP headers in declarative YAML agent definitions, blocking use cases like per-request auth tokens or routing headers.

Changes

  • agentschema-emitter/lib/model/tools/mcp.tsp — Adds headers?: Record<string> to McpTool, allowing arbitrary string key-value HTTP headers
  • agentschema-emitter/src/ast.ts — Extends the Record<unknown> dictionary detection to also handle Record<string>, preventing the emitter from generating an invalid standalone class for it
  • Generated runtimes — All four language runtimes updated; headers surfaces as IDictionary<string, object>? (C#), Optional[dict[str, Any]] (Python), Record<string, unknown> | undefined (TypeScript), map[string]interface{} (Go)
  • JSON Schema — New RecordString.yaml schema (string-valued record) referenced from McpTool.yaml

Usage

tools:
  - kind: mcp
    serverName: product-mcp
    connection:
      kind: anonymous
      endpoint: =Env.MCP_URL
    headers:
      Authorization: =Env.MCP_ACCESS_TOKEN
      X-Tenant-Id: =Env.TENANT_ID
    approvalMode: never

Copilot AI linked an issue Apr 3, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add headers to McpTool spec Add headers field to McpTool spec Apr 3, 2026
Copilot AI requested a review from sethjuarez April 3, 2026 02:15
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.

Add headers to McpTool spec

2 participants