Use 1Password Developer Environments with Cursor
By Flavio
Updated
Tagged: AI
Learn how the 1Password Cursor plugin mounts secrets without plaintext .env files, what its skill and validation hook do, and how to use it safely.
1Password has an official plugin for Cursor that handles project secrets through 1Password Developer Environments. Your app still reads from a normal .env path, except the plaintext values never sit on disk. From inside Cursor, the agent can create Environments, import an existing .env file, list variable names, and mount an Environment directly into your project.
If you haven’t used the underlying feature yet, start with my deep dive into 1Password Developer Environments.
What 1Password Developer Environments are
A 1Password Developer Environment groups all the environment variables for a single project or stage, like DATABASE_URL, RESEND_API_KEY, and STRIPE_SECRET_KEY. You’d typically split them up by stage:
my-app-developmentmy-app-stagingmy-app-production
With a regular .env file, those secrets sit in plaintext on your disk, where anything can copy, index, back up, or accidentally commit them. 1Password keeps the values inside the Environment instead and only exposes them through a local .env path at the moment a process reads it.
The local .env file is a named pipe
That .env path looks like a regular file in your project folder, but under the hood it’s a Unix named pipe (also called a FIFO). Here’s how a read travels through it:
application reads .env
↓
1Password asks for authorization
↓
secret values pass through the named pipe
↓
application receives the variables
Because the plaintext values are never written to disk, your existing tools keep working as-is. Node.js dotenv, Docker Compose, python-dotenv, and other common libraries read the mounted .env path without needing any special 1Password integration.
If you want to confirm the mount is really a pipe, run this check in your terminal:
test -p .env && echo "1Password mount is active"
Don’t use test -f here. Since a FIFO isn’t a regular file, that check fails even when the mount is working fine.
What the Cursor plugin adds
The official 1Password plugin for Cursor bundles three pieces: an MCP server, an agent skill, and a shell validation hook.
The MCP server
The MCP server gives Cursor tools to manage your Developer Environments. Through it, the agent can:
- list Environments
- create and rename an Environment
- list variable names
- add or update variables
- create a local
.envmount - list existing mounts
When the agent calls the listing tools, it only gets back variable names and mount paths, keeping the secret values hidden. If you want the background on how this protocol works, check out my guide to how MCP works.
The agent skill
The plugin also ships a 1password-environments skill. Having MCP tools on their own doesn’t tell an agent what order to run steps in, how to handle duplicate Environment names, or when an import is finished.
For example, when you import a .env file on macOS or Linux, creating the Environment and adding the variables is only half the job. The skill tells Cursor to finish by mounting the Environment at the original .env path and verifying the mount. It also tells the agent to keep secret values out of chat and to check variables with the listing tool instead of reading the mounted FIFO directly.
The validation hook
The third piece is a beforeShellExecution hook. Right before Cursor runs a shell command, it checks every relevant 1Password .env mount in your workspace to make sure:
- the path exists
- the path is a FIFO
- the mount is enabled in 1Password
If a required mount is missing or disabled, the hook stops the command and hands back an error the agent can help you fix. That saves you from watching the agent boot a dev server or run a test suite without its required environment and waste time chasing unrelated errors.
Requirements
Before installing the plugin, make sure you have:
- a 1Password subscription
- the 1Password desktop app
- Cursor
- macOS or Linux
sqlite3in yourPATH(used by the validation hook)- the local MCP server enabled in 1Password Labs, with MCP client integration turned on
On macOS, sqlite3 is already built in. On Linux, install it with your package manager if it’s missing.
The plugin only works on Mac and Linux. Local .env mounts and the desktop MCP server aren’t available on Windows, and the validation hook exits without a decision there so shell commands run without any mount check. If you’re on Windows, the plugin skill recommends using op run --environment instead of mounting a file.
Install the plugin in Cursor
Start in the 1Password desktop app. Open Settings → Labs (or jump straight there with onepassword://settings/labs) and turn on Enable local MCP server. Then go to Settings → Developer and select Integrate with MCP clients.
If your company uses 1Password Enterprise Password Manager, an admin might need to enable this first. They can sign in on 1Password.com and allow it under Policies → Agentic permissions → Local MCP server.
Next, switch to Cursor. Open the Agents window, go to Customize → Plugins, search for 1Password, select Add, and restart Cursor when it’s done. You can also open the command palette and pick Plugins: Install Plugin, or ask Cursor to install it directly:
/add-plugin 1password
Install the full plugin instead of adding the MCP command by hand, or you’ll miss the import workflow skill and mount validation. Once Cursor restarts, open Cursor Settings → Tools & MCPs and confirm the 1password server is connected.
The first time you ask Cursor to access an Environment, the 1Password app pops up an authorization prompt where you decide whether Cursor can list and create Environments.
Under the hood, the configuration is tiny:
{
"mcpServers": {
"1password": {
"command": "1password-mcp"
}
}
}
The 1password-mcp command ships with the 1Password desktop app, and Cursor runs it locally on the same computer as the editor.
Create an Environment
You can create your first Environment right in the 1Password app. Open Developer → View Environments, pick New environment, give it a name, and save it. From there you can add variables by hand or import an existing .env file.
Once the plugin is connected, Cursor can do the same thing through the agent:
Create a new 1Password Environment called my-app-development
Before creating anything, the skill lists your existing Environments. If that name is already taken, it pauses and asks whether to reuse it, pick another name, or cancel, so it won’t quietly overwrite secrets in the wrong Environment.
Import an existing .env file
If you already have a project with a .env file and want to move it into 1Password, ask Cursor:
Import .env into a new 1Password Environment called my-app-development and mount it here
From there, the skill walks through seven steps:
- Read the existing
.envfile. - Authenticate with the local 1Password app.
- Check whether the Environment name already exists.
- Create or select the Environment.
- Add the variables.
- Mount the Environment at the original
.envpath. - Verify the mount.
Importing is a migration step where Cursor has to read your existing plaintext values to pass them to 1Password, so only run this with a local agent you trust.
If Git is already tracking your .env file, the skill stops before mounting. Delete the tracked file and commit that deletion first, because otherwise Git still expects a regular file at that path and commands like git status get confusing. Even though a mounted FIFO can’t be staged with its secret contents, clearing out the old tracked file is still required.
Mount an existing Environment
When an Environment is already in 1Password and you just want to wire it into a project, ask Cursor to mount it:
Mount my staging Environment as .env in this repo
The first time your app reads .env, 1Password shows an authorization prompt. Approve it, and your app receives the values once through the pipe, while authorization stays active until 1Password locks. You can have up to ten enabled local .env mounts per device.
Choose which mounts the hook validates
By default, the hook finds and checks every 1Password mount tied to the current workspace. If you want to pin down the exact paths, list them in .1password/environments.toml:
mount_paths = [".env", "billing.env"]
With that file in place, the hook checks only those two paths. To turn validation off completely for a repo, pass an empty list instead:
mount_paths = []
Stick with the default unless a repository uses several mounts and only some of them are needed for every shell command.
The security boundary
Keeping values in 1Password gets plaintext secrets off your disk, though once you authorize a mounted .env file, any process on your computer can read it until 1Password locks or you disable the mount. 1Password can’t tell your app apart from Cursor or another local process, so let your app read .env directly instead of asking an agent to run cat .env.
The validation hook is also fail open. If 1Password is missing, its database is unavailable, or sqlite3 can’t run, the hook allows the shell command through. That makes sense for day-to-day development since a broken helper shouldn’t block every terminal command, so treat the hook as a setup check for missing mounts.
There are two more practical quirks to watch out for:
- named pipes aren’t designed for several simultaneous readers
- tools watching
.envcan react to pipe activity as if the file changed
1Password specifically warns that Vite can get stuck in a restart loop because of this. If that happens, exclude the mounted path from the watcher:
import { defineConfig } from 'vite'
export default defineConfig({
server: {
watch: {
ignored: ['**/.env'],
},
},
})
How I would use it
For local development in Cursor, my approach is to create one Development Environment for a project that needs a database, an email provider, and a payment provider, and mount it at .env. Let the application read that path directly while Cursor lists variable names, catches missing mounts, and adds a placeholder whenever new code introduces a variable.
Keep staging and production separate. Production secrets belong in your hosting platform’s secret store, never in a local .env mount. I wrote more about that boundary in How to protect secrets when coding agents deploy your app.
This plugin is built for project secrets. If you want password-manager autofill so an agent can log into a website without the model holding the password, read How AI agents can log in without seeing your passwords.
Want me to talk about your product? You can sponsor this site.
Related posts about ai: