Skip to main content
Glama

op-run-mcp

A small MCP server that lets AI coding agents (Claude Code, Codex, Cursor…) use secrets stored in 1Password without ever seeing them.

The agent gets three tools:

Tool

What it does

list_secrets

Names, vault, field names and description of the secrets it may use. Never values.

run_with_secrets

Runs a command with the chosen secrets as environment variables and returns the output with every value replaced by [secret NAME].

save_secret

Creates an item or sets one field. The value comes from a file (deleted afterwards), from a command's stdout (never shown to the agent), or literally when the user already pasted it. Replacing an existing value needs overwrite: true.

There is no tool that reveals or deletes a secret. You see and manage everything in the 1Password app.

Not an official 1Password product. Built on the official 1Password JavaScript SDK.

Why

  • No approval prompt per secret. It authenticates with a 1Password Service Account, so agents spawning new shells don't trigger the desktop app's authorization prompt every few minutes.

  • Least privilege. The service account only sees the vault(s) you grant it (e.g. a dedicated Agents vault). OP_VAULTS adds a second fence inside the server.

  • Works on Windows. The token is stored encrypted with DPAPI for your Windows user. The official 1Password Environments MCP server is currently macOS/Linux only.

  • Tiny. Two source files, three pinned dependencies.

Related MCP server: keymaster-mcp

Setup

  1. In 1Password: create a vault (e.g. Agents) and a service account with access only to it. Give it write access if agents should store secrets with save_secret (or you use import-env); read-only otherwise.

  2. Add items to that vault, any kind:

    • Regular items (Login, Database, API Credential…) with as many fields as you like, e.g. a Login Staging admin with username and password. The agent maps fields to variables when it runs a command.

    • Single-value secrets whose title is a variable name (GITHUB_TOKEN) can be requested by name alone.

    Without an explicit field, the value comes from the field named credential, password, token, api key, secret, key or value, or else the first concealed field. An optional text field named description is shown to the agent.

  3. Install and store the token:

    git clone https://github.com/luizferw/op-run-mcp && cd op-run-mcp && npm ci
    # paste the token, then Enter and Ctrl+D (Linux/macOS) or Ctrl+Z, Enter (Windows)
    node src/index.mjs store-token

    The token is written to %APPDATA%\op-run-mcp\token encrypted with DPAPI (Windows), or to ~/.config/op-run-mcp/token with mode 600 (Linux/macOS).

    WSL: instead of a second plaintext copy, point WSL at the Windows file (OP_TOKEN_FILE=/mnt/c/Users/<you>/AppData/Roaming/op-run-mcp/token). It is decrypted through powershell.exe interop.

  4. Register the server.

    Claude Code:

    claude mcp add -s user op-run -e OP_VAULTS=Agents -- node /path/to/op-run-mcp/src/index.mjs

    Codex (~/.codex/config.toml):

    [mcp_servers.op-run]
    command = "node"
    args = ["/path/to/op-run-mcp/src/index.mjs"]
    env = { OP_VAULTS = "Agents" }

Configuration

Variable

Meaning

OP_SERVICE_ACCOUNT_TOKEN

Token in the environment. Takes precedence over the token file.

OP_TOKEN_FILE

Token file path (default above). Content dpapi:<base64> is decrypted with DPAPI.

OP_ACCOUNT

Use the 1Password desktop app instead of a service account (prompts for approval).

OP_VAULTS

Comma-separated vault names or IDs the server may use. Empty means every vault the account can see.

OP_RUN_WSL_DISTRO

WSL distro for shell: "wsl" (Windows only; default distro if unset).

Using it

run_with_secrets takes:

  • command (PowerShell on Windows, bash elsewhere) or argv (program + arguments, no shell);

  • secrets: ["GITHUB_TOKEN"], or a map from variable to item, such as { "APP_USER": { "item": "Staging admin", "field": "username" }, "APP_PASS": { "item": "Staging admin", "field": "password" }, "GH_TOKEN": "GITHUB_TOKEN", "X": "op://Agents/Item/field" };

  • optional cwd, timeout_seconds (default 120, max 600; kills the whole process tree), shell: "wsl".

Command line, same logic:

node src/index.mjs list
node src/index.mjs run GITHUB_TOKEN -- gh api user
# copy env vars of this process into new items (needs write access to the vault);
# --descriptions takes a JSON file {"NAME": "description"}
node src/index.mjs import-env --vault Agents GITHUB_TOKEN OPENAI_API_KEY
# back up .env files: one item per file, a concealed field per variable + the whole file
node src/index.mjs backup-env --vault Agents apps/api/.env apps/web/.env
node src/index.mjs restore-env ".env · my-repo/apps/api/.env" apps/api/.env

Security notes

  • Masking is best effort. Raw, base64, URL- and JSON-encoded forms are replaced in the output. A command that deliberately transforms a secret (hashes it, reverses it, splits it) or sends it somewhere else is not stopped. Keep your client's approval prompt on for run_with_secrets if you don't trust what the agent runs.

  • The agent runs as your user. It can read the token file like any other file you own. DPAPI keeps the token encrypted at rest and out of config files and backups. It does not protect it from a process running as you. The real limit is what the service account can access: give agents a vault holding only what they may use.

  • OP_SERVICE_ACCOUNT_TOKEN is removed from the environment of the commands it runs.

  • Service accounts have rate limits. The item list is cached for 60 seconds.

Development

npm test

License

MIT

Available Tools

3 tools
list_secretsA
Read-only

List the secrets available to commands (names, vault, fields, description). Never returns values.

Inputs: no named parameters.

run_with_secretsA

Run a shell command with 1Password secrets injected as environment variables. Windows: PowerShell (reference as $env:NAME); Linux/macOS: bash (reference as $NAME). Output (stdout+stderr) is returned with secret values replaced by [secret NAME].

Inputs: secrets (required), cwd, argv, shell, +2 more.

save_secretA

Save a secret to 1Password: create an item or set one field of an existing item. The value is never returned. Give exactly one source: from_file (e.g. a file delivered by a secret-request card; deleted after saving by default), from_command (its stdout becomes the value and is never shown; e.g. a CLI that creates a token), or value (only when the user already pasted it in the conversation).

Inputs: item (required), field, shell, value, +10 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool maps to a distinct verb and lifecycle stage: listing metadata, executing with secrets injected, and persisting a secret. Descriptions make the boundaries explicit (list never returns values, run redacts output, save accepts exactly one source). An agent can pick correctly without guessing.

    Naming Consistency5/5

    All three names follow a clean verb_noun pattern (list_secrets, run_with_secrets, save_secret) in snake_case. The shared '_secrets'/'secret' noun family reinforces that they operate on one resource.

    Tool Count5/5

    Three tools is right for a narrow secret-injection purpose: enumerate, use, and store. Nothing redundant and nothing that feels like padding.

    Completeness4/5

    List/use/create-or-update covers the core lifecycle, including updating a single field of an existing item. There is no delete/remove or rotation-specific operation, but agents can accomplish cleanup via run_with_secrets shelling out to the 1Password CLI.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to look up stored logins by URL, name, or alias and use them without seeing the secrets, injecting authentication into HTTP requests, running commands with credentials in the environment and scrubbed output, and fetching 2FA codes, subject to per-credential policies and user approval.
      23
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to list entries and metadata, run commands with secrets injected as environment variables while scrubbing every value from the output, copy secrets straight to the clipboard, and generate or store new secrets without their plaintext ever entering the conversation. Obvious dumpers are refused and destructive edits require explicit confirmation, closing off accidental exposure paths.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to execute commands that require credentials while resolving secrets from HashiCorp Vault, injecting them only for the spawned process and redacting them from agent-visible output. It also lets users authenticate via OIDC and check which Vault secret references resolve without exposing secret values.
      MIT