Skip to content

[Bug]: plugin that is using tool_prefetch hook cannot access PASSTHROUGH_HEADERS, tags for an MCP Server Need MCP-GW restart #1024

@popagruia

Description

@popagruia

🐞 Bug Summary

Briefly describe the issue or unexpected behavior.
For a MCP GW with OATUH2 enabled the TAGS and PASSTHROUGH_HEADERS received by plugin that is using tool_prefetch hook are not immediately visible after save. Need to restart the GW in order to receive correct plugins

🧩 Affected Component

Select the area of the project impacted:

  • [x ] mcpgateway - API
  • mcpgateway - UI (admin panel)
  • mcpgateway.wrapper - stdio wrapper
  • Federation or Transports
  • CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)
  • [ x] Other (explain below)
    -Plugin retrieves tags as gateway_metadata = context.global_context.metadata['gateway']

🔁 Steps to Reproduce

  1. Add a new tags on an existing GW.
  2. Save GW configuration
  3. In a plugin access the config
async def tool_pre_invoke(self, payload: ToolPreInvokePayload, context: PluginContext) -> ToolPreInvokeResult:
      print(context.global_context.metadata['gateway'].tags)
      headers: dict[str, str] = payload.headers.model_dump()
      print(headers)

🤔 Expected Behavior

What should have happened instead?


📓 Logs / Error Output

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


🧠 Environment Info

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

Key Value
Version or commit 0.0.7
Runtime ython 3.11, Gunicorn
Platform / OS macOS
Container none

🧩 Additional Context (optional)

Add any configuration details, flags, or related issues.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriageIssues / Features awaiting triage

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions