mcpField
E
env-manager

env-manager

github.com/dtyqDevelopment5.1k35 installsUpdated 4d ago
Repository

About env-manager

env-manager is a skill for managing environment variables through SDK tools. It supports personal and workspace scopes, merges them with personal values taking precedence, and does not echo plaintext values in tool results.

Key features

  1. 01Set, read, and unset variables
  2. 02List variables by scope
  3. 03Merge personal and workspace values
  4. 04Keep plaintext values out of results

Use cases

  1. 01Check whether a variable is configured
  2. 02Save a personal value for reuse across workspaces
  3. 03Set a variable for the current project

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dtyq/magic --skill env-manager

After installing, type/env-managerin Claude Code to confirm it loaded.

Details

From the project README

Environment Variable Manager

Use this skill by calling set_env, get_env, unset_env, and list_env through sdk.tool.call(...) inside run_sdk_snippet.

By default, save and delete personal environment variables stored in ~/.magic/super-magic.env for reuse across workspaces. Pass "scope": "workspace" only when the user explicitly asks to save or delete values for the current workspace/project.

The runtime effective environment merges workspace env and personal env. Personal env has the highest priority and overrides workspace values with the same key. Tool display and results never echo plaintext values.

Get One Env

When you only need to check whether one key is configured, prefer get_env. get_env queries the final effective env by default (scope=all). Do not call list_env just to inspect one key, because that exposes unrelated environment variable names and masked values to the model context.

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("get_env", {
    "key": "KEY_NAME",
})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

Only pass "scope": "personal" or "scope": "workspace" when you need to check whether a key exists in a specific storage scope.

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("get_env", {
    "key": "KEY_NAME",
    "scope": "workspace",
})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

Set Personal Env

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("set_env", {
    "key": "KEY_NAME",
    "value": "value",
})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

Set Workspace Env

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("set_env", {
    "key": "KEY_NAME",
    "value": "value",
    "scope": "workspace",
})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

List Personal Env

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("list_env", {})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

List Workspace Env

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("list_env", {
    "scope": "workspace",
})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

List Effective Env

"scope": "all" means the final effective merge of workspace and personal env. Personal env overrides workspace env with the same key.

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("list_env", {
    "scope": "all",
})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

Unset Personal Env

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("unset_env", {
    "key": "KEY_NAME",
})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

Unset Workspace Env

run_sdk_snippet(python_code="""
from sdk.tool import tool

result = tool.call("unset_env", {
    "key": "KEY_NAME",
    "scope": "workspace",
})
if not result.ok:
    raise SystemExit(result.content)
print(result.content)
""")

Comments

Markdown supported