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.4.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.4-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: env2mcp-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 c97f911f877c431a57b28d29c321b7cc8b5a72f42dcb63edf02eff910014f112
MD5 7bdd584bbf2202ccf0e7543c16a2803d
BLAKE2b-256 f819a0deb5bd84cf4923b36c3a118715a23ec8ba2165f9ac49a5e3956e6c9f50

See more details on using hashes here.

File details

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

File metadata

  • Download URL: env2mcp-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 135f88d9024ce400e1f51388c61161a48f693b1f9d330a578984d852d51b0e7d
MD5 3b2fdd06b0cf93de88eda52f9d8f68b2
BLAKE2b-256 3812461e3fc94a98f010d51320406d9fdfe998242b9a1f824b1f972ea280af17

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