Skip to content

Passing custom environment variables #90

@jonmach

Description

@jonmach

Hi,

I've configured mcp-proxy as an sse endpoint calling a local stdio service (inside a docker container) to allow for remote deployment of a service.

What I would like to do is to pass custom variables to the stdio service (e.g. GITHUB_TOKEN, USER_ID) etc.

I've written my CMD as follows

CMD ["mcp-proxy", "--pass-environment", "--host=0.0.0.0", "--debug", "--port=8080", "node", "/home/app/mystdio-service/index.js"]

Unfortunately, this means that everyone gets the same experience, and the only alternative I have is to run multiple containers.

Is there any way to pass say the contents of the "env" section in the sse configuration, so that behaviour would be different for different users using the same service?

...
"env": {
    "GITHUB_TOKEN": "my personal github token"
}
...

I tried using the --pass-environment flag, but it didn't seem to have any effect. I.e., it was ignored by the stdio service

The debug trace shows no evidence of the environment variables being passed through the proxy. All I'm seeing is content being returned in the debug, but not content being sent by the client.

Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions