---
title: "Cursor Secrets Management: No More .env Keys | 1Claw"
description: "Stop hardcoding API keys in Cursor projects. The 1Claw MCP server gives Cursor secrets at runtime, so keys never sit in .env files, the clipboard or the chat."
canonical: "https://1claw.co/cursor-secrets"
---

# Cursor secrets management without the risk

Every time you paste an API key into Cursor, it lands in prompts, logs, and LLM context windows. 1claw's MCP server injects secrets at runtime so they never touch your editor.

[Start free](https://1claw.co/login)[Install the MCP server](https://docs.1claw.co/docs/guides/mcp)

\[ THE PROBLEM \]

## How secrets leak in Cursor

Every prompt you send carries context from your workspace, and your keys go with it.

Cursor's AI features are powerful, but every prompt you send includes context from your workspace. When API keys live in `.env` files, hardcoded strings, or clipboard pastes, they become part of that context. Here's where secrets end up:

- LLM context windows. Cursor sends open files as context. If your `.env` is open or referenced, the LLM provider receives your keys.
- Git history. Even if you add `.env` to `.gitignore`, a single accidental commit exposes keys forever. GitHub's secret scanning finds thousands of leaked keys daily.
- Clipboard and prompts. Pasting a key into a Cursor chat message means it's now in the conversation log, synced to the cloud, and potentially used as training data.
- Shared workspaces. Team members with Cursor access can see every file. Without granular access control, every developer has every secret.

.env: exposed in workspacein LLM context

\# Cursor sends this as context

OPENAI\_API\_KEY\=sk-proj-4f8a...c2d1

STRIPE\_SECRET\=sk\_live\_51N8x...kJ2m

DATABASE\_URL\=postgresql://admin:p@ss@prod:5432

Every key in this file is now in the LLM provider's logs.

\[ THE SOLUTION \]

## MCP server that plugs into Cursor natively

Your agent fetches secrets at runtime through authenticated, scoped API calls, never from flat files.

### HSM-encrypted vault

Secrets are stored in a hardware-backed vault with AES-256 envelope encryption. Not in .env, not in memory, not in the repo.

### Policy-scoped access

Each agent only sees the secret paths you explicitly grant. Glob-based policies, IP restrictions, and time-window conditions.

### Zero-config MCP integration

Add the MCP config to your Cursor settings. Your agent gets 162 tools: list, get, put, rotate, share, simulate, sign, execute, and more, all authenticated.

\[ SETUP \]

## Set up in under two minutes

Add the 1claw MCP server to Cursor and your agent fetches secrets on demand.

Add the 1claw MCP server to your Cursor configuration. Once connected, your agent can fetch secrets on demand, with no `.env` files needed. The agent authenticates with an API key and only accesses the secret paths you've granted via policies.

- Create a vault and store your secrets
- Register an agent and grant it a policy on the paths it needs
- Add the MCP config to Cursor; the agent fetches secrets at runtime
- Secrets never appear in your workspace, git history, or prompts

.cursor/mcp.json

```
{
  "mcpServers": {
    "1claw": {
      "command": "npx",
      "args": ["@1claw/mcp"],
      "env": {
        "ONECLAW_AGENT_API_KEY": "ocv_your_key_here"
      }
    }
  }
}
```

\[ HOW IT WORKS \]

## How it works under the hood

The MCP server handles authentication, token refresh, and vault discovery automatically.

1

### Agent starts

Cursor launches the MCP server process. It exchanges the API key for a short-lived JWT.

2

### Vault auto-discovered

The token response includes the agent’s vault IDs. No vault ID configuration needed.

3

### Secret fetched

When the agent calls get\_secret, the MCP server fetches the value from the encrypted vault over HTTPS.

4

### Token refreshed

JWTs auto-refresh 60 seconds before expiry. The agent key stays in the MCP process, never in Cursor memory.

\[ COMPARISON \]

## .env files vs. 1claw vault

Flat files were never designed for AI-assisted development.

.env files

1claw vault

Encrypted at rest

Access policies

Audit trail

Visible in LLM context

Risk of git commit

Secret rotation

MCP-native

\[ FREE TIER \] 1 vault · 10 secrets · 100 requests/mo

## Stop pasting secrets into Cursor

Install the MCP server, create a vault, and your Cursor agent will never see a raw API key again. Setup takes under two minutes.

[Start free](https://1claw.co/login)[Read the MCP docs](https://docs.1claw.co/docs/guides/mcp)

Already using 1claw? [Jump to the MCP setup guide →](https://docs.1claw.co/docs/guides/mcp)

\[ FAQ \]

## Frequently asked questions

### Can Cursor read my .env file?

Cursor's agent can read files in your workspace, so a key in .env can end up in its context. Add .env to .cursorignore, and move the real keys out of the project so the agent has nothing to read.

### How do I use API keys in Cursor without pasting them?

Connect the 1Claw MCP server to Cursor with one scoped agent key. The agent asks for a secret by path when a tool needs it, and the value goes to the tool, not into the chat.

### What happens if the Cursor agent key leaks?

Revoke that agent key from the 1Claw dashboard. The provider keys in the vault never left it, so nothing else needs rotating.

\[ READ \]

## Further reading

- [MCP security guide](https://1claw.co/mcp-security)
- [Claude Code API key security](https://1claw.co/claude-api-key-security)
- [MCP secrets manager](https://1claw.co/mcp-secrets-manager)
- [Your AI agent doesn't need to see the key](https://1claw.co/blog/your-ai-agent-doesnt-need-to-see-the-key)

\[ NEXT \]

## Comparing your options?

Capability-by-capability against the alternatives, including where the alternative is the better choice.

- [1Claw vs 1Password (Developer)1Claw vs 1Password for AI agent secrets](https://1claw.co/compare/1password-developer)
- [1Claw vs .env files and Vercel environment variablesCan AI agents just use .env files or Vercel environment variables?](https://1claw.co/compare/dotenv-vercel-env)
- [1Claw vs Doppler1Claw vs Doppler: which is better for AI agents?](https://1claw.co/compare/doppler)
[All comparisons](https://1claw.co/compare)
