Skip to content

[Feature]: AI gateway — one MCP server for both mounts, reap shared-endpoint sessions, decouple UI tools from enable_mcp #9215

Description

@Nabil-Salah

Requirement

As a Jaeger operator enabling the AI chat assistant,
I want the browser's per-turn UI tools to work over MCP without also exposing the
telemetry MCP server (ai.enable_mcp), the gateway's MCP endpoints to reap their
sessions at shutdown, and the shared and turn-scoped mounts to share one MCP server,
so that I can run a "chat only" assistant (UI tools, no external MCP exposure), MCP
sessions don't outlive the query server, and there is a single MCP server to trace
and reason about.

Problem

Part of #8890. These are RFC 0008 milestones M7.2 / M7.1 / M7 — three gaps in the
current gateway-hosted MCP server:

  • M7.2 — UI tools coupled to ai.enable_mcp. The turn-scoped MCP endpoint
    (/api/ai/mcp/<mcpRouteID>/), which carries the per-turn UI tools, is mounted only
    when enable_mcp is set. UI tools also ride the ACP ext-method path today, so this
    is currently harmless — but M6 will drop that path, at which point enable_mcp: false with chat enabled would leave the agent no UI tools at all.

  • M7.1 — the shared endpoint leaks sessions. mcptools.WrapHTTP returns a bare
    http.Handler, so the shared /api/ai/mcp/ mount has no closer and its MCP
    sessions outlive the query server. The turn-scoped mount got a closer in feat(ai-gateway): Announce the session-scoped MCP endpoint to the sidecar over HTTP #9009; the
    shared one never did.

  • M7 — two MCP servers where one would do. The shared and turn-scoped mounts run
    two mcp.Server instances. The turn-scoped UI-tools middleware already degrades to
    telemetry-only when no turn is present, so one server can back both mounts.

Proposal

No response

Open questions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions