Skip to content

[BUG]: when APP_ROOT_PATH is set, virtual server mcp request not working, returns 404 #4129

@shixuguang

Description

@shixuguang

🐞 Bug Summary

Briefly describe the issue or unexpected behavior.

when we set APP_ROOT_PATH, then mcp calls made to virtual server/mcp endpoint returns 404

🧩 Affected Component

Select the area of the project impacted:

  • mcpgateway - API
  • mcpgateway - UI (admin panel)
  • mcpgateway.wrapper - stdio wrapper
  • Federation or Transports
  • CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)
  • Other (explain below)

🔁 Steps to Reproduce

  1. set APP_ROOT_PATH=/our/nginx/path
  2. configure mcpgateway url to https://our_host/out/nginx/path/servers/server_id/mcp
  3. returns 404

🤔 Expected Behavior

What should have happened instead?

this was working for us in RC2

📓 Logs / Error Output

Paste any relevant stack traces or logs here.
⚠️ Do not paste secrets, credentials, or tokens.

{
  "asctime": "2026-04-09T20:06:53",
  "name": "mcpgateway.services.structured_logger",
  "levelname": "WARNING",
  "message": "[http_gateway] Request completed: POST /physical_location/ocp4813-default/mcp-context-forge-sqlite-9ac3666-7l9l7xpezyk8/servers/7ce5f5ba03814433afab9d7122a96c38/mcp - 404",
  "component": "http_gateway",
  "category": null,
  "user_id": null,
  "user_email": null,
  "team_id": null,
  "duration_ms": 35.10475158691406,
  "custom_fields": null,
  "tags": null,
  "correlation_id": "75151795cbc640b290650fd458257b4d",
  "operation_type": "http_request",
  "request_method": "POST",
  "request_path": "/physical_location/ocp4813-default/mcp-context-forge-sqlite-9ac3666-7l9l7xpezyk8/servers/7ce5f5ba03814433afab9d7122a96c38/mcp",
  "response_status_code": 404,
  "user_agent": "node",
  "client_ip": "10.17.100.117",
  "metadata": {
    "event": "request_completed",
    "response_time_category": "fast"
  },
  "hostname": "mcp-context-forge-sqlite-9ac3666-7l9l7xpezyk8-75dd5dd68c-gdh7v",
  "process_id": 1,
  "timestamp": "2026-04-09T20:06:53.127173+00:00",
  "@timestamp": "2026-04-09T20:06:53.127355Z",
  "request_id": "75151795cbc640b290650fd458257b4d"
}

🧠 Environment Info

You can retrieve most of this from the /version endpoint.

Key Value
Version or commit main@9ac3666
Runtime Python 3.12, Gunicorn
Platform / OS RHEL 9
Container openshift

🧩 Additional Context (optional)

Add any configuration details, flags, or related issues.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageIssues / Features awaiting triage

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions