mcp-env-manager

toddalchin/mcp-env-manager

3.2

If you are the rightful owner of mcp-env-manager and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

MCP Env Manager is a server designed to streamline the management of environment variables across development workflows, integrating with local projects and Vercel.

Tools
9
Resources
0
Prompts
0

MCP Env Manager

A Model Context Protocol (MCP) server for managing environment variables across your development workflow. Automates the tedious process of updating .env files, Vercel environment variables, and searching for hardcoded values.

Features

  • 📝 Read/Write .env files - Parse and update environment variables in local projects
  • 🚀 Vercel Integration - Update environment variables in Vercel projects via API
  • 🔍 Codebase Search - Find hardcoded values (like old Supabase URLs) across your codebase
  • Validation - Validate that required environment variables exist
  • 🔄 Bulk Operations - Update multiple projects at once (perfect for migrations!)
  • 🔐 Secure - Never exposes sensitive values in responses

Setup

1. Install Dependencies

cd /Users/toddalchin/.cursor/mcp-env-manager
npm install

2. Build the Server

npm run build

3. Configure Vercel Token (Optional)

For Vercel integration, you need a Vercel API token:

  1. Go to https://vercel.com/account/tokens
  2. Create a new token
  3. Add it to your environment or update mcp.json:
{
  "env-manager": {
    "command": "node",
    "args": ["/Users/toddalchin/.cursor/mcp-env-manager/dist/index.js"],
    "env": {
      "VERCEL_TOKEN": "your-token-here"
    }
  }
}

Or set it as an environment variable:

export VERCEL_TOKEN=your-token-here

4. Restart Cursor

After adding the server to mcp.json, restart Cursor to load the new MCP server.

Available Tools

read_env_file

Read and parse an .env file from a project directory.

Example:

Read the .env.local file from /path/to/my-project

write_env_file

Write or update environment variables in an .env file.

Example:

Update SUPABASE_URL in /path/to/my-project to https://new-project.supabase.co

validate_env_file

Validate that required environment variables exist in an .env file.

Example:

Check that /path/to/my-project has SUPABASE_URL and SUPABASE_ANON_KEY

update_vercel_env

Update an environment variable in a Vercel project.

Example:

Update SUPABASE_URL in Vercel project my-app to https://new-project.supabase.co

list_vercel_projects

List all Vercel projects (requires VERCEL_TOKEN).

Example:

List all my Vercel projects

get_vercel_env_vars

Get all environment variables for a Vercel project.

Example:

Get all environment variables for Vercel project my-app

delete_vercel_env

Delete an environment variable from a Vercel project.

Example:

Delete TEST_VAR from Vercel project my-app

search_hardcoded_values

Search a codebase for hardcoded values (like old Supabase project refs).

Example:

Search /path/to/my-project for hardcoded references to qfhuczrvratasjdzcznn

bulk_update_supabase_credentials

Bulk update Supabase credentials across multiple projects. Perfect for migrations!

Example:

Update all Sponge projects to use LifeOS Supabase credentials:
- Projects: [/path/to/sponge-app-1, /path/to/sponge-app-2]
- New URL: https://dcswojsxcscrvcmjjhtd.supabase.co
- New Anon Key: eyJhbGc...
- Also update Vercel: true

Use Cases

Migration Scenario

When migrating from one Supabase project to another:

  1. Search for hardcoded values:

    Search /path/to/project for old Supabase project refs
    
  2. Update local .env files:

    Update SUPABASE_URL and SUPABASE_ANON_KEY in /path/to/project
    
  3. Update Vercel:

    Update SUPABASE_URL in Vercel project my-app
    
  4. Bulk update multiple projects:

    Use bulk_update_supabase_credentials to update all projects at once
    

Daily Development

  • Quickly check what environment variables a project needs
  • Validate that all required vars are set before deployment
  • Update Vercel env vars without leaving Cursor

Development

Build

npm run build

Watch Mode (for development)

npm run dev

Run Directly

npm start

Architecture

  • src/index.ts - Main MCP server entry point
  • src/env-file.ts - .env file parsing and writing
  • src/vercel.ts - Vercel API integration
  • src/codebase-search.ts - Codebase search functionality

Security Notes

  • Environment variable values are never logged or exposed in error messages
  • Vercel tokens should be stored securely (use environment variables, not hardcoded)
  • .env files are never committed (they're in .gitignore)

Troubleshooting

"VERCEL_TOKEN environment variable is required"

Set your Vercel token in mcp.json under env.VERCEL_TOKEN or as a system environment variable.

"File not found" errors

Make sure the project path is absolute or relative to your current working directory.

MCP server not loading

  1. Make sure you've run npm install and npm run build
  2. Check that the path in mcp.json is correct
  3. Restart Cursor after updating mcp.json

License

MIT