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):

Cursor mcp.jsonJSON
{
  "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.

MCP endpoint
https://api-vault-opal.vercel.app/mcp

Authentication

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:

  1. Trigger OAuth re-authentication

    Use your MCP client's reconnect or re-authenticate action to start a fresh OAuth flow.

  2. Approve the requested scopes

    Review the permissions in the browser and approve the scopes required for your task.

  3. 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.

ScopePermissionTools
keys:readView API keys (masked)list_keys, get_key
keys:writeAdd, update, and delete API keysadd_key, update_key, delete_key
keys:revealReveal decrypted secret valuesreveal_key
  • keys:readList key names, services, environments, and masked values.
  • keys:writeCreate new keys, update metadata, and permanently delete keys.
  • keys:revealDecrypt 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.

ParameterRequiredDescription
environmentNoFilter by environment name
serviceNoFilter by service name

get_key

Scope: keys:read. Get metadata for a single key by ID (masked).

ParameterRequiredDescription
idYesKey ID

reveal_key

Scope: keys:reveal. Decrypt and return the raw secret value.

ParameterRequiredDescription
idYesKey ID
vault_keyCustom mode onlyCustom vault passphrase

add_key

Scope: keys:write. Create a new key in the vault.

ParameterRequiredDescription
nameYesKey name (env var name)
keyYesRaw secret value
serviceNoService label
environmentNoEnvironment label
notesNoOptional notes
vault_keyCustom mode onlyCustom vault passphrase

update_key

Scope: keys:write. Update metadata or secret value.

ParameterRequiredDescription
idYesKey ID
name, service, environment, notesNoMetadata fields to update
keyNoNew raw secret value
vault_keyWhen changing value in custom modeCustom vault passphrase

delete_key

Scope: keys:write. Permanently delete a key by ID.

Workflow patterns

Find a key for an integration task

  1. List keys for the target environment

    Call list_keys with an environment filter (e.g. "Production").

  2. Confirm the correct key ID

    Call get_key to verify metadata before using the secret.

  3. Reveal only when the raw secret is required

    Call reveal_key only if needed — use the value immediately in env or config, not in chat.

Add a new credential

  1. Confirm write scope is granted

    Ensure your OAuth token includes keys:write.

  2. Create the key with add_key

    Call add_key with name, key, service, and environment.

  3. Pass vault_key in custom encryption mode

    Include vault_key when the vault uses custom encryption.

Error codes

CodeMeaningAction
INSUFFICIENT_SCOPEToken lacks required scopeRe-authenticate with broader scopes or use a different tool
NOT_FOUNDKey ID invalidRe-list keys with list_keys
VAULT_KEY_REQUIREDCustom encryption; passphrase neededPass vault_key
INVALID_VAULT_KEYWrong passphraseRetry with correct vault key

Protocol details

ResourceURL
MCP endpointhttps://api-vault-opal.vercel.app/mcp
Protected resource metadatahttps://api-vault-opal.vercel.app/.well-known/oauth-protected-resource
Authorization server metadatahttps://api-vault-opal.vercel.app/.well-known/oauth-authorization-server
Server cardhttps://api-vault-opal.vercel.app/mcp/server-card
OAuth authorizehttps://api-vault-opal.vercel.app/oauth/authorize
OAuth tokenhttps://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_key before calling reveal_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