Skip to content

Interpolating variable in the Custom MCP config #5477

@mskitroot

Description

@mskitroot

Describe the bug

When adding a Custom MCP in both AgentFlow and Chatflow, and trying to use variables for the Token, I get 401 on my MCP. Debugging on my MCP shows that the Authorization header is sent without the variable being interpolated.

Being no expert I debuged the server code and found that workspaceId is not sent to CustomMCP and when getVars is called it returns an empty set. See screenshots

To Reproduce

  1. Create a variable i.e. mcptoken
  2. Add in Chatflow a CustomMCP. Configure it to get the Bearer Token as per example
{
    "url": "http://localhost:3001/sse",
    "headers": {
        "Authorization": "Bearer {{$vars.mcptoken}}"
    }
}
  1. Check on the MCP server side the value of Authorization Header

Expected behavior

The variable to be interpolated

Screenshots

MCP Server Logs

Image

Snippet from packages/components/src/utils.ts:getVars

Image

Snippet from packages/components/nodes/tools/MCP/CustomMCP/CustomMCP.ts:loadMethods

Image

Debuging output

Image

Flow

No response

Use Method

pnpm start

Flowise Version

3.0.10

Operating System

macOS

Browser

Safari

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions