mcp-go
mcp-go copied to clipboard
How to get the server process environment variables which set by the mcp client(such as cursor)?
RT. sorry that i don't find any examples of read server process environment variables by using mcp-go
{ "mcpServers": { "mymcp":{ "url": "http://localhost:8080/sse", "env": { "MY_ENV": "value" } } } }
how to read the MY_ENV value
you can directly get 'MY_ENV' by os.Getenv('MY_ENV') in your code logic
you can directly get 'MY_ENV' by os.Getenv('MY_ENV') in your code logic
That doesn't make sense for SSE. The server doesn't have access to an environment variable on the client. How are we supposed to set API Keys?
You'd usually set headers in the MCP config, though I'm not sure if Cursor supports this yet (as of a couple weeks ago, they did not).
Goose doesn't support it either. How are people passing API_Keys from Cursor and Goose?