github / github/copilot-cli

MCP tool string parameters containing HTML are stripped before reaching MCP server

Đang mở
#2,636 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
area:mcp area:tools
Ngôn ngữ chính
Shell
Star
11.2k
Fork
1.9k
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
6

Mô tả

MCP tool string parameters containing HTML are stripped before reaching MCP server

---

## Description

When the Copilot CLI invokes an MCP tool with a string parameter containing HTML (e.g., `

`, `
    `, `` tags), the HTML is stripped before the JSON-RPC request reaches the MCP server. The server receives plain text instead of the original HTML.

    ## Reproduction

    1. Register an MCP server with a tool that accepts a `string` parameter (e.g., `description`)
    2. The AI generates a tool call with HTML content in that parameter:
    ```json
    {
    "name": "CreateWorkItem",
    "arguments": {
    "title": "Test",
    "description": "

    Summary

    Details about SomeClass

    • Item 1
    "
    }
    }
    ```
    3. The MCP server receives the `description` parameter with all HTML tags removed, content wrapped in a single `

    ` tag

    ## Expected Behavior

    The HTML string should be passed through to the MCP server unchanged. It is a valid JSON string value and the MCP protocol has no reason to sanitize it.

    ## Evidence

    We built integration tests (ASP.NET TestServer + MCP SDK v0.5.0-preview.1) that prove the MCP SDK itself preserves HTML correctly through client→HTTP→server→parameter binding:

    - ✅ `McpSdk_PreservesHtmlInStringParameters` — HTML tags preserved
    - ✅ `McpSdk_PreservesComplexHtmlWithEntities` — entities and code blocks preserved
    - ✅ `McpSdk_PreservesHtmlWhenPassedAsJsonElement` — boxed JsonElement values preserved
    - ✅ `McpSdk_PreservesMultiLineHtml` — multi-line HTML preserved

    All tests pass, confirming the issue is upstream of the MCP server — in the Copilot CLI's tool call parameter serialization layer.

    We also verified the Fleet MCP Gateway proxy layer (which converts `JsonElement` → `object` and forwards to the MCP server) preserves HTML with 7 additional unit tests.

    ## Impact

    Any MCP tool that needs to pass HTML or structured markup in string parameters is affected. In our case, Azure DevOps work item descriptions (which natively support HTML) are always created as unformatted plain text, requiring a REST API workaround to set them properly.

    ## Workaround

    Bypass the MCP tool for HTML-bearing fields and use direct REST API calls instead (two-step: create via MCP, then patch description via REST).

    ## Environment

    - Copilot CLI version: 1.0.23
    - MCP SDK: ModelContextProtocol v0.5.0-preview.1
    - OS: Windows 11

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.