Skip to content

[MCP Bundle] tools/list can return empty in debug + FrankenPHP worker mode after successful discovery #2017

@ineersa

Description

@ineersa

Context

I’m running symfony/mcp-bundle over HTTP transport behind FrankenPHP worker mode with:

  • APP_ENV=dev
  • APP_DEBUG=1

The MCP endpoint is reachable and authenticated. initialize succeeds, but tools/list can return an empty array
even though MCP tools were discovered at startup.

────────────────────────────────────────────────────

Expected behavior

If tools are discovered (e.g. 4 tools), tools/list should return them consistently for subsequent requests in
the same MCP session.

Actual behavior

  • initialize succeeds
  • tools/list returns:
  {"tools":[]}

At the same time, MCP logs show discovery finding tools and then clearing discovered elements before/around
subsequent request handling.

────────────────────────────────────────────────────

Logs / evidence

MCP channel logs show:

  • Attribute discovery finished. with context like tools: 4
  • followed by: Removed 4 discovered elements from internal registry.

After that, tools/list may return empty.

────────────────────────────────────────────────────

Reproduction (HTTP MCP)

  1. Configure MCP bundle with HTTP transport and attribute-based tools in src/ (#[McpTool(...)]).
  2. Run in FrankenPHP worker mode with debug enabled (APP_DEBUG=1).
  3. POST /_mcp initialize:
  {
    "jsonrpc": "2.0",
    "method": "initialize",
    "params": {
      "protocolVersion": "2025-03-26",
      "capabilities": {},
      "clientInfo": { "name": "repro", "version": "1.0" }
    },
    "id": 1
  }
  1. Use returned Mcp-Session-Id and call:
  {
    "jsonrpc": "2.0",
    "method": "tools/list",
    "id": 2
  }
  1. Observe empty tools in affected runs.

────────────────────────────────────────────────────

Additional observations

  • Setting APP_DEBUG=0 in the same environment makes tools/list return the discovered tools correctly.
  • Behavior appears intermittent / client-flow dependent (request sequence/timing), but logs consistently show
    discovered tools being cleared in debug worker mode.

────────────────────────────────────────────────────

Suspected cause

Potential interaction between worker lifecycle + debug registry reset in:

Symfony\AI\McpBundle\Profiler\TraceableRegistry

reset() calls clear(), which seems to remove discovered MCP capabilities across requests in worker mode.

Possibly related to:

────────────────────────────────────────────────────

Versions

  • symfony/mcp-bundle: v0.8.0
  • Symfony: 8.0.*
  • Runtime: FrankenPHP worker mode
  • Transport: HTTP (/_mcp)
  • Env where reproduced: APP_ENV=dev, APP_DEBUG=1

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingMCP BundleIssues & PRs about the MCP SDK integration bundleStatus: Needs Review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions