Model Context Protocol
ApiVault exposes a remote MCP server over HTTP with OAuth 2.1 authentication. Connect Cursor, Claude Desktop, or any MCP-compatible client to browse and manage vault keys with scoped, revocable access — no secrets pasted into chat.
Setup
Add the MCP server URL to your client configuration. On first use, the client opens a browser for OAuth approval.
Cursor
Add to MCP config (mcp.json or Cursor Settings → MCP):
{
"mcpServers": {
"apivault": {
"url": "https://api-vault-opal.vercel.app/mcp"
}
}
}Claude Desktop
Add the same URL entry to your Claude Desktop MCP configuration. OAuth flow is identical — approve scopes in the browser when prompted.
https://api-vault-opal.vercel.app/mcpAuthentication
MCP uses OAuth 2.1 with Dynamic Client Registration (DCR) and PKCE. MCP tokens are independent from CLI tokens — revoking one does not affect the other.
If tools return an auth error or the server status is needsAuth:
Trigger OAuth re-authentication
Use your MCP client's reconnect or re-authenticate action to start a fresh OAuth flow.
Approve the requested scopes
Review the permissions in the browser and approve the scopes required for your task.
Retry the tool call
Run the intended MCP tool again after authentication completes.
Manage and revoke active connections in Settings → MCP Connections.
OAuth scopes
Request the minimum scopes required for your task. During OAuth consent you select which permissions to grant.
| Scope | Permission | Tools |
|---|---|---|
keys:read | View API keys (masked) | list_keys, get_key |
keys:write | Add, update, and delete API keys | add_key, update_key, delete_key |
keys:reveal | Reveal decrypted secret values | reveal_key |
keys:read— List key names, services, environments, and masked values.keys:write— Create new keys, update metadata, and permanently delete keys.keys:reveal— Decrypt and return full secret values to the connected agent.
Tools reference
Discover full input schemas via your MCP client's tool inspection before calling. Summary of all six tools:
list_keys
Scope: keys:read. List all keys with masked values.
| Parameter | Required | Description |
|---|---|---|
environment | No | Filter by environment name |
service | No | Filter by service name |
get_key
Scope: keys:read. Get metadata for a single key by ID (masked).
| Parameter | Required | Description |
|---|---|---|
id | Yes | Key ID |
reveal_key
Scope: keys:reveal. Decrypt and return the raw secret value.
| Parameter | Required | Description |
|---|---|---|
id | Yes | Key ID |
vault_key | Custom mode only | Custom vault passphrase |
add_key
Scope: keys:write. Create a new key in the vault.
| Parameter | Required | Description |
|---|---|---|
name | Yes | Key name (env var name) |
key | Yes | Raw secret value |
service | No | Service label |
environment | No | Environment label |
notes | No | Optional notes |
vault_key | Custom mode only | Custom vault passphrase |
update_key
Scope: keys:write. Update metadata or secret value.
| Parameter | Required | Description |
|---|---|---|
id | Yes | Key ID |
name, service, environment, notes | No | Metadata fields to update |
key | No | New raw secret value |
vault_key | When changing value in custom mode | Custom vault passphrase |
delete_key
Scope: keys:write. Permanently delete a key by ID.
Workflow patterns
Find a key for an integration task
List keys for the target environment
Call
list_keyswith anenvironmentfilter (e.g."Production").Confirm the correct key ID
Call
get_keyto verify metadata before using the secret.Reveal only when the raw secret is required
Call
reveal_keyonly if needed — use the value immediately in env or config, not in chat.
Add a new credential
Confirm write scope is granted
Ensure your OAuth token includes
keys:write.Create the key with add_key
Call
add_keywithname,key,service, andenvironment.Pass vault_key in custom encryption mode
Include
vault_keywhen the vault uses custom encryption.
Error codes
| Code | Meaning | Action |
|---|---|---|
INSUFFICIENT_SCOPE | Token lacks required scope | Re-authenticate with broader scopes or use a different tool |
NOT_FOUND | Key ID invalid | Re-list keys with list_keys |
VAULT_KEY_REQUIRED | Custom encryption; passphrase needed | Pass vault_key |
INVALID_VAULT_KEY | Wrong passphrase | Retry with correct vault key |
Protocol details
| Resource | URL |
|---|---|
| MCP endpoint | https://api-vault-opal.vercel.app/mcp |
| Protected resource metadata | https://api-vault-opal.vercel.app/.well-known/oauth-protected-resource |
| Authorization server metadata | https://api-vault-opal.vercel.app/.well-known/oauth-authorization-server |
| Server card | https://api-vault-opal.vercel.app/mcp/server-card |
| OAuth authorize | https://api-vault-opal.vercel.app/oauth/authorize |
| OAuth token | https://api-vault-opal.vercel.app/oauth/token |
Token lifetimes
- Authorization codes: 5 minutes
- Access tokens: 1 hour
- Refresh tokens: 30 days
Transport: Streamable HTTP. There is no local apivault mcp stdio command — the MCP server is remote only.
Security practices
- Request only the scopes your agent needs
- Use masked
list_keys/get_keybefore callingreveal_key - Do not paste revealed values into chat, commits, logs, or issue trackers
- Inject secrets via env vars or local files the user controls
- Revoke unused connections in Settings → MCP Connections