Skip to main content

env2mcp

Environment configuration manager for MCP projects. Provides utilities to manage .env files and integrate with GitHub CLI (gh) for authentication.

Installation

# From project root
pip install -e ./env2mcp

# Or with pipx
pipx install ./env2mcp

Quick Start

GitHub Setup Wizard

# Interactive setup - checks gh CLI, prompts for auth, saves to .env
env2mcp setup-github

# Or use the github command group
env2mcp github login

Environment Management

# Show all environment variables
env2mcp env show

# Set a variable
env2mcp env set OPENROUTER_API_KEY "sk-or-v1-..."

# Get a variable (masked by default)
env2mcp env get OPENROUTER_API_KEY
env2mcp env get OPENROUTER_API_KEY --show  # Show full value

GitHub Commands

# Check auth status
env2mcp github status

# Login (interactive)
env2mcp github login

# List your repos
env2mcp github repos --limit 10

# List repos for specific user/org
env2mcp github repos --owner microsoft --limit 5

# Logout
env2mcp github logout

Python API

from env2mcp import EnvConfig, GitHubCLI, get_github_token

# Load .env file
config = EnvConfig(".env")

# Get/set values
api_key = config.get("OPENROUTER_API_KEY")
config["GITHUB_PAT"] = "ghp_xxx"
config.save()

# GitHub CLI integration
gh = GitHubCLI()
if gh.is_available():
    token = gh.get_token()
    user = gh.get_user()
    repos = gh.list_repos(limit=10)

How It Works

  1. GitHub Authentication: Checks for gh CLI and uses it to get tokens securely
  2. Token Storage: Saves GITHUB_PAT to .env file with backup creation
  3. Environment Loading: Loads variables from both .env file and actual environment (env takes precedence)

Integration with MCP

The package is used across the MCP project:

  • mcp-git-proxy uses GITHUB_PAT for authenticated git operations
  • llm-agent loads configuration via env2mcp
  • mcp-webui provides UI for GitHub repo configuration

License

Licensed under Apache-2.0.

Metadata

Release files for env2mcp 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for env2mcp 0.1.4
File Size Uploaded
env2mcp-0.1.4.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for env2mcp 0.1.4
File Interpreter ABI Platform
env2mcp-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Release files / env2mcp-0.1.4.tar.gz

Download URL env2mcp-0.1.4.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c97f911f877c431a57b28d29c321b7cc8b5a72f42dcb63edf02eff910014f112
BLAKE2b-256 checksum
How to use checksums
f819a0deb5bd84cf4923b36c3a118715a23ec8ba2165f9ac49a5e3956e6c9f50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / env2mcp-0.1.4-py3-none-any.whl

Download URL env2mcp-0.1.4-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
135f88d9024ce400e1f51388c61161a48f693b1f9d330a578984d852d51b0e7d
BLAKE2b-256 checksum
How to use checksums
3812461e3fc94a98f010d51320406d9fdfe998242b9a1f824b1f972ea280af17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page