mcp-config-example
v0.0.1
Published
Generate example .mcp.json files by masking sensitive environment variables
Maintainers
Readme
mcp-config-example
Generate example .mcp.json files by automatically masking sensitive environment variables.
Features
- Automatically detects and masks sensitive environment variables (API keys, tokens, secrets, passwords)
- Preserves JSON structure and formatting
- Masks absolute file paths with generic placeholders
- Normalizes all placeholder values to uppercase with underscores
- Simple CLI interface
Installation
pnpm add -D mcp-config-exampleOr use directly with bunx:
bunx mcp-config-exampleUsage
CLI
Generate an example config from .mcp.json:
mcp-exampleSpecify custom input file:
mcp-example custom-config.jsonSpecify both input and output:
mcp-example .mcp.json my-example.jsonProgrammatic
import { generateExampleConfig } from 'mcp-config-example';
generateExampleConfig('.mcp.json', '.mcp.json.example');How It Works
The tool automatically masks:
Environment Variables: Any key containing
API_KEY,TOKEN,SECRET,PASSWORD,CREDENTIALS,AUTH, orKEYwill have its value replaced with the key name.// Before "env": { "SUPABASE_ACCESS_TOKEN": "sbp_abc123def456" } // After "env": { "SUPABASE_ACCESS_TOKEN": "SUPABASE_ACCESS_TOKEN" }File Paths: Absolute paths are normalized by replacing specific usernames with generic placeholders.
// Before "MEMORY_BANK_ROOT": "/Users/seungwonan/Dev/memory-bank" // After "MEMORY_BANK_ROOT": "/Users/username/Dev/memory-bank"Bearer Tokens: Authorization headers with Bearer tokens are masked.
// Before "args": ["--header", "Authorization: Bearer hf_abc123"] // After "args": ["--header", "Authorization: Bearer YOUR_TOKEN"]Placeholder Values: Angle bracket placeholders are removed, converted to uppercase, and hyphens/spaces are normalized to underscores.
// Before "args": ["--project-ref=<project-ref>"] // After "args": ["--project-ref=PROJECT_REF"]// Before "env": { "NAVER_CLIENT_ID": "your-client-id" } // After "env": { "NAVER_CLIENT_ID": "YOUR_CLIENT_ID" }
Example
Given a .mcp.json file:
{
"mcpServers": {
"supabase": {
"command": "npx",
"args": ["-y", "@supabase/mcp-server-supabase@latest"],
"env": {
"SUPABASE_ACCESS_TOKEN": "sbp_real_token_here"
}
}
}
}Running mcp-example generates .mcp.json.example:
{
"mcpServers": {
"supabase": {
"command": "npx",
"args": ["-y", "@supabase/mcp-server-supabase@latest"],
"env": {
"SUPABASE_ACCESS_TOKEN": "SUPABASE_ACCESS_TOKEN"
}
}
}
}Development
# Install dependencies
pnpm install
# Build
pnpm build
# Format code
pnpm format
# Lint code
pnpm lint
# Check and fix
pnpm checkLicense
MIT
