Skip to main content

Environment configuration manager for MCP projects

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

env2mcp-0.1.3.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

env2mcp-0.1.3-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file env2mcp-0.1.3.tar.gz.

File metadata

  • Download URL: env2mcp-0.1.3.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for env2mcp-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ce3b85747db3d4660805455fa85ccda5a7a1edffd64ed193609e9cb690f99c83
MD5 43728651ea1dc77ec706d33c4583937b
BLAKE2b-256 d88d52f7ae6859f8036bd3f4bf3ff25496d8839001c86c3042a8d2db9040ee66

See more details on using hashes here.

File details

Details for the file env2mcp-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: env2mcp-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for env2mcp-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 613a8cafff9efb4cd5b6ab376ab9d70b7c755c0412aaa6de78e261d2c722e844
MD5 c2e29ed60f9ad8a430d304b2eb5edbd7
BLAKE2b-256 e7ed6bf9052659d234eee336bd76ff2eeba925a3a282130112f02231f410cfb8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page