Skip to content

How To Get Environment Variables  #61

@ilvalerione

Description

@ilvalerione

Hi, thank you for the great package,
I would understand how to get environment variables passed by an MCP client using Stdio transport. How the server makes them available in the elements class or methods declared as tools?

Do you have a code example on how to access env variables?

This should be a valid client configuration:

{
    "mcpServers": {
        "php-calculator": {
            "command": "php",
            "args": ["/absolute/path/to/your/mcp-server.php"], 
            "env": {"API_KEY": "xxxx"}
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions