op-run-mcp
Integrates with 1Password via Service Accounts and the official SDK to list allowed secret metadata, inject selected secrets into commands as environment variables while masking their values, and create or update secret items and fields in permitted vaults.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@op-run-mcp run `gh api user` with my GitHub token injected from 1Password"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
| Names, vault, field names and description of the secrets it may use. Never values. |
| Runs a command with the chosen secrets as environment variables and returns the output with every value replaced by |
| 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 |
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
Agentsvault).OP_VAULTSadds 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
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 withsave_secret(or you useimport-env); read-only otherwise.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 adminwithusernameandpassword. 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,keyorvalue, or else the first concealed field. An optional text field nameddescriptionis shown to the agent.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-tokenThe token is written to
%APPDATA%\op-run-mcp\tokenencrypted with DPAPI (Windows), or to~/.config/op-run-mcp/tokenwith mode600(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 throughpowershell.exeinterop.Register the server.
Claude Code:
claude mcp add -s user op-run -e OP_VAULTS=Agents -- node /path/to/op-run-mcp/src/index.mjsCodex (
~/.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 |
| Token in the environment. Takes precedence over the token file. |
| Token file path (default above). Content |
| Use the 1Password desktop app instead of a service account (prompts for approval). |
| Comma-separated vault names or IDs the server may use. Empty means every vault the account can see. |
| WSL distro for |
Using it
run_with_secrets takes:
command(PowerShell on Windows, bash elsewhere) orargv(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/.envSecurity 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_secretsif 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_TOKENis removed from the environment of the commands it runs.Service accounts have rate limits. The item list is cached for 60 seconds.
Development
npm testLicense
MIT
Available Tools
3 toolslist_secretsARead-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
Scored across 3 tools
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.
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.
Three tools is right for a narrow secret-injection purpose: enumerate, use, and store. Nothing redundant and nothing that feels like padding.
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
Related MCP Connectors
Secrets for developers and agents—secure context and workflows without exposing secret values.
Password vault for AI agents with scoped, user-approved access
Governed access to sensitive data, secrets and APIs for AI agents. A signed proof for each decision.
A secret store for AI agents: the agent never sees the plaintext.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to securely inject API keys and secrets into environment files, configs, or commands without the agent ever seeing the secret values.MIT
- AlicenseAqualityBmaintenanceEnables 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.23MIT
- AlicenseNot gradedqualityBmaintenanceEnables 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
- AlicenseNot gradedqualityBmaintenanceEnables 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