Skip to content

Add environment variable (env) support for MCP’s stdio transport. #1136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wangwei1237
Copy link

Add environment variable (env) support for MCP’s stdio transport to address dependencies of stdio-based MCP servers on environment variables.

Features

  • Feature 1: For stdio-based MCP servers like the GitHub MCP Server, the tools execution relies on the GITHUB_PERSONAL_ACCESS_TOKEN environment variable for authentication. Environment variable support has been added for stdio MCP servers.

Feature Docs

In the mcp.json configuration file, environment variable dependencies for a server can be added under mcpServers.server.env, which is a dictionary variable.

{
  "mcpServers": {
    "github": {
      "type": "stdio",
      "command": "${ROOT_PATH}/github-mcp-server/github-mcp-server",
      "args": [
        "stdio"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${github_access_token}"
      }
    }
  }
}

Result

INFO     [browser_use] BrowserUse logging setup complete with level info
INFO     [root] Anonymized telemetry enabled. See https://docs.browser-use.com/development/telemetry for more information.
GitHub MCP Server running on stdio
2025-05-21 11:29:28.547 | INFO     | app.tool.mcp:_initialize_and_list_tools:124 - Connected to server github with tools: ['add_issue_comment', 'create_branch', 'create_issue', 'create_or_update_file', 'create_pull_request', 'create_pull_request_review', 'create_repository', 'fork_repository', 'get_code_scanning_alert', 'get_file_contents', 'get_issue', 'get_issue_comments', 'get_me', 'get_pull_request', 'get_pull_request_comments', 'get_pull_request_files', 'get_pull_request_reviews', 'get_pull_request_status', 'list_code_scanning_alerts', 'list_commits', 'list_issues', 'list_pull_requests', 'merge_pull_request', 'push_files', 'search_code', 'search_issues', 'search_repositories', 'search_users', 'update_issue', 'update_pull_request_branch']
2025-05-21 11:29:28.547 | INFO     | app.agent.manus:initialize_mcp_servers:95 - Connected to MCP server github using command /Users/wangwei17/Documents/Project/github/github-mcp-server/github-mcp-server with arguments ['stdio']

Other

…ddress dependencies of stdio-based MCP servers on environment variables.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant