Skip to content

[Bug]: Context set from one hook is not available in another hook #1495

@BenjaminNechicattu

Description

@BenjaminNechicattu

🐞 Bug Summary

pre-auth-check plugin sets context and tool-pre-invoke plugin can't access it. When tried to access it returns None. Both plugins are in differnt hooks


🧩 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)
    plugins

🔁 Steps to Reproduce

  1. in pre-auth-check plugin a context is set as below
       context.set_state("wxo_access_token", token)
       context.global_context.state["wxo_access_token"] = token  # Store for http_pre_request
  1. In tool-pre-invoke plugin, the same value is tried to get as given below
            access_token= context.get_state("wxo_access_token", None)

but when accessed its returning None


🤔 Expected Behavior

access_token= context.get_state("wxo_access_token", None)
when accessed it should return values as assigned in previous plugin.


📓 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 main
Runtime Python 3.11
Platform / OS MacOs
Container None

🧩 Additional Context (optional)

Add any configuration details, flags, or related issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssues / Features awaiting triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions