View and safely edit ~/.claude.json global configuration sections
Manages global configuration settings with safe viewing, editing, and validation capabilities.
/plugin marketplace add melodic-software/claude-code-plugins/plugin install claude-code-observability@melodic-software[--view] [--edit SECTION] [--validate]View and safely edit the ~/.claude.json global configuration file. This file contains critical settings including MCP servers, OAuth tokens, and feature flags.
| Argument | Description |
|---|---|
--view | View current configuration (redacted sensitive data) |
--edit SECTION | Edit a specific section interactively |
--validate | Validate JSON syntax and structure |
| (no args) | View configuration summary |
~/.claude.json contains these sections:
| Section | Description | Editable |
|---|---|---|
mcpServers | MCP server configurations | ✅ Yes |
oauthAccount | OAuth authentication tokens | ❌ No (managed by Claude) |
statsigFeatureFlags | Statsig feature flags | ❌ No (managed by Claude) |
growthBookFeatureFlags | GrowthBook feature flags | ❌ No (managed by Claude) |
NEVER expose or modify:
SAFE to view/modify:
--view or no args)Display configuration with sensitive data redacted:
import json
from pathlib import Path
claude_json = Path.home() / ".claude.json"
if not claude_json.exists():
print("No global configuration found (~/.claude.json)")
exit(0)
config = json.load(open(claude_json))
# Redact sensitive sections
def redact(obj, keys_to_redact):
if isinstance(obj, dict):
return {
k: "[REDACTED]" if k in keys_to_redact else redact(v, keys_to_redact)
for k, v in obj.items()
}
elif isinstance(obj, list):
return [redact(item, keys_to_redact) for item in obj]
return obj
sensitive_keys = {"accessToken", "refreshToken", "token", "secret", "password", "key"}
redacted = redact(config, sensitive_keys)
print(json.dumps(redacted, indent=2))
Show high-level summary:
import json
from pathlib import Path
claude_json = Path.home() / ".claude.json"
config = json.load(open(claude_json))
print("# Global Configuration Summary\n")
# MCP Servers
mcp_servers = config.get("mcpServers", {})
print(f"## MCP Servers ({len(mcp_servers)})")
for name, server_config in mcp_servers.items():
server_type = server_config.get("type", "unknown")
print(f" • {name} ({server_type})")
# OAuth
oauth = config.get("oauthAccount", {})
if oauth:
email = oauth.get("email", "[not set]")
print(f"\n## OAuth Account")
print(f" • Email: {email}")
print(f" • Tokens: [REDACTED]")
# Feature Flags
statsig = config.get("statsigFeatureFlags", {})
growthbook = config.get("growthBookFeatureFlags", {})
print(f"\n## Feature Flags")
print(f" • Statsig: {len(statsig)} flags")
print(f" • GrowthBook: {len(growthbook)} flags")
--edit SECTION)Edit a specific section interactively:
import json
from pathlib import Path
claude_json = Path.home() / ".claude.json"
section = "mcpServers" # From argument
# Only allow editing safe sections
allowed_sections = ["mcpServers"]
if section not in allowed_sections:
print(f"❌ Cannot edit section: {section}")
print(f" Allowed sections: {', '.join(allowed_sections)}")
exit(1)
config = json.load(open(claude_json))
current = config.get(section, {})
print(f"Current {section}:")
print(json.dumps(current, indent=2))
# Use AskUserQuestion to confirm edit approach
# Options: Add server, Remove server, Modify server, Cancel
--validate)Check JSON syntax and structure:
import json
from pathlib import Path
claude_json = Path.home() / ".claude.json"
try:
config = json.load(open(claude_json))
# Check expected structure
issues = []
# mcpServers should be a dict
if "mcpServers" in config and not isinstance(config["mcpServers"], dict):
issues.append("mcpServers should be an object")
# Validate MCP server entries
for name, server in config.get("mcpServers", {}).items():
if not isinstance(server, dict):
issues.append(f"MCP server '{name}' should be an object")
elif "command" not in server and "type" not in server:
issues.append(f"MCP server '{name}' missing command or type")
if issues:
print("⚠️ Validation warnings:")
for issue in issues:
print(f" • {issue}")
else:
print("✅ Configuration is valid")
except json.JSONDecodeError as e:
print(f"❌ Invalid JSON syntax: {e}")
# Global Configuration (~/.claude.json)
## MCP Servers (5 configured)
| Name | Type | Command |
|------|------|---------|
| perplexity | stdio | npx -y @anthropic/perplexity-mcp |
| microsoft-learn | stdio | npx -y @anthropic/microsoft-learn-mcp |
| firecrawl | stdio | npx -y @anthropic/firecrawl-mcp |
| context7 | stdio | npx -y @anthropic/context7-mcp |
| ref | stdio | npx -y @anthropic/ref-mcp |
## OAuth Account
- **Email:** user@example.com
- **Tokens:** [REDACTED - managed by Claude]
## Feature Flags
- Statsig: 12 flags [managed by Claude]
- GrowthBook: 5 flags [managed by Claude]
## Actions
- View full config: `/user-config:global --view`
- Edit MCP servers: `/user-config:global --edit mcpServers`
- Validate config: `/user-config:global --validate`
- Backup config: `/user-config:backup`
# Example: Add a new MCP server
new_server = {
"type": "stdio",
"command": "npx",
"args": ["-y", "@example/my-mcp-server"]
}
config["mcpServers"]["my-server"] = new_server
json.dump(config, open(claude_json, "w"), indent=2)
# Example: Remove an MCP server
if "server-name" in config.get("mcpServers", {}):
del config["mcpServers"]["server-name"]
json.dump(config, open(claude_json, "w"), indent=2)
~/.claude.json to version control/user-config:backup (extracts mcpServers only)/user-config:mcp - Focused MCP server management/user-config:backup - Backup configuration including MCP servers/user-config:restore - Restore from backup/user-config:status - Overview of all configurationThis command uses the user-config-management skill for: