env-mcp

env-mcp

Secure environment variable and configuration management MCP server with Claude Code integration for storing, managing, and retrieving environment variables.

Category
访问服务器

README

🔐 env-mcp - Environment Variable MCP Server

A Model Context Protocol (MCP) server for secure environment variable and configuration management with Claude Code integration

License: MIT MCP Built by BuildAppolis

Features

  • Secure Storage: Store environment variables with optional sensitive data protection
  • Categories: Organize variables by category for better management
  • Search & Filter: Find variables quickly with search functionality
  • Multiple Formats: Export/import support for .env, JSON, and YAML formats
  • MCP Integration: Seamlessly integrates with Claude Code for AI-assisted configuration management
  • CLI Tool: Powerful command-line interface for manual management

Installation

# Clone the repository
git clone https://github.com/buildappolis/env-mcp.git
cd env-mcp

# Install dependencies
pnpm install

# Build the project
pnpm run build

Configuration

Add to Claude Code

The server is already configured with Claude Code. To verify:

claude mcp list

You should see:

env-mcp: node /home/cory-ubuntu/coding/env-mcp/dist/index.js - ✓ Connected

Manual Configuration

If you need to reconfigure:

claude mcp add env-mcp "node" "/path/to/env-mcp/dist/index.js"

CLI Usage

Basic Commands

# Set a variable
./env-mcp-cli set KEY "value" --description "Description" --category "category"

# Set a sensitive variable (will be redacted in output)
./env-mcp-cli set API_KEY "secret" --sensitive --category "secrets"

# Get a variable
./env-mcp-cli get KEY

# List all variables
./env-mcp-cli list

# List by category
./env-mcp-cli list --category "secrets"

# Search variables
./env-mcp-cli search "api"

# Delete a variable
./env-mcp-cli delete KEY

# List categories
./env-mcp-cli categories

Import/Export

# Export to .env format
./env-mcp-cli export --format env --output .env

# Export to JSON
./env-mcp-cli export --format json --output config.json

# Export to YAML
./env-mcp-cli export --format yaml --output config.yaml

# Import from .env file
./env-mcp-cli import .env

MCP Tools (Available in Claude)

When using Claude Code, the following tools are available:

  • env_get - Get an environment variable value
  • env_set - Set an environment variable with optional metadata
  • env_delete - Delete an environment variable
  • env_search - Search for variables by query
  • env_list - List all variables or filter by category
  • env_export - Export variables in different formats
  • env_import - Import variables from a file

Data Storage

Configuration is stored in: ~/.env-mcp/config.yaml

The storage format includes:

  • Variable key/value pairs
  • Optional descriptions
  • Categories for organization
  • Sensitive data flags
  • Creation/update timestamps

Examples

Setting up a development environment

# Database configuration
./env-mcp-cli set DB_HOST "localhost" --category "database"
./env-mcp-cli set DB_PORT "5432" --category "database"
./env-mcp-cli set DB_NAME "myapp" --category "database"
./env-mcp-cli set DB_USER "admin" --category "database"
./env-mcp-cli set DB_PASS "secret" --sensitive --category "database"

# API Keys
./env-mcp-cli set OPENAI_API_KEY "sk-..." --sensitive --category "api-keys"
./env-mcp-cli set STRIPE_API_KEY "sk_test_..." --sensitive --category "api-keys"

# Application settings
./env-mcp-cli set NODE_ENV "development" --category "app"
./env-mcp-cli set PORT "3000" --category "app"
./env-mcp-cli set LOG_LEVEL "debug" --category "app"

# Export for use in application
./env-mcp-cli export --format env --output .env

Searching and filtering

# Find all database-related variables
./env-mcp-cli search "db"

# List all API keys
./env-mcp-cli list --category "api-keys"

# Show all categories
./env-mcp-cli categories

JSON output for scripting

# Get JSON output for parsing
./env-mcp-cli list --json | jq '.[] | select(.category == "database")'

# Export specific category to JSON
./env-mcp-cli list --category "app" --json > app-config.json

Security

  • Variables marked as --sensitive are redacted in normal output
  • Use --show-sensitive flag with get command to view sensitive values
  • Sensitive values are still exported normally (be careful with exports)
  • Configuration file permissions should be restricted (chmod 600)

Development

Project Structure

env-mcp/
├── src/
│   ├── index.ts       # MCP server implementation
│   ├── cli.ts         # CLI tool implementation
│   ├── store.ts       # Storage layer
│   └── types.ts       # TypeScript type definitions
├── dist/              # Compiled JavaScript
├── package.json       # Dependencies and scripts
└── tsconfig.json      # TypeScript configuration

Scripts

# Build the project
pnpm run build

# Run in development mode
pnpm run dev

# Run CLI in development
pnpm run cli

Troubleshooting

MCP Server won't connect

  1. Check if the server is built:

    pnpm run build
    
  2. Test the server manually:

    echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}},"id":1}' | node dist/index.js
    
  3. Reconnect with Claude:

    claude mcp list  # Check status
    

Variables not persisting

Check the configuration file:

cat ~/.env-mcp/config.yaml

Ensure write permissions:

mkdir -p ~/.env-mcp
chmod 755 ~/.env-mcp

License

MIT

Contributing

Feel free to submit issues and pull requests to improve the env-mcp server.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选