Authentication
Pensyve supports two authentication methods for accessing the cloud API and remote MCP server:
| Method | Best For | Setup |
|---|---|---|
| OAuth 2.1 (PKCE) | Interactive remote MCP clients | Add the Pensyve URL, then approve browser consent |
API Keys (psy_ prefix) | SDKs, CI/CD, scripts, and unattended automation | Create in dashboard and store as a secret |
Both methods access the same data. Choose based on your workflow.
API Keys
Creating a Key
- Sign in at pensyve.com
- Go to Dashboard → API Keys
- Click Create Key
- Choose a scope (see below)
- Copy the key — it's only shown once
Store your API key securely. We hash keys with SHA-256 before storing them — we cannot recover a lost key. Create a new one if needed.
Key Scopes
Every API key has a scope that controls which operations it can perform:
| Scope | Permissions | Use Case |
|---|---|---|
Full access (mcp) | All operations — recall, remember, forget, inspect, observe, episodes, status | Default. General-purpose agents. |
Read only (mcp:read) | recall, inspect, status, account | Agents that only retrieve memories. Safest option. |
Write only (mcp:write) | remember, forget, observe, episode_start, episode_end | Ingestion pipelines that store but don't query. |
The default scope is mcp (full access). Use the narrowest scope that fits your use case.
Key Rotation
Rotate keys without downtime:
- Go to Dashboard → API Keys
- Click Rotate on the key you want to replace
- A new key is created with the same scope
- The old key enters a 24-hour grace period — it still works
- Update your environment with the new key
- After 24 hours, the old key is automatically revoked
This gives you a full day to update all systems using the key.
Using Your API Key
API keys authenticate via the standard Authorization: Bearer header. Set the key in your environment so SDKs and MCP clients can reference it:
export PENSYVE_API_KEY="psy_your_key_here"Add to your shell profile (~/.bashrc, ~/.zshrc, ~/.config/fish/config.fish) to persist across sessions.
When configuring MCP clients, pass the key as a Bearer token in the headers block — not in the env block. The headers approach explicitly sets the Authorization header on every HTTP request, which is the standard pattern for HTTP-transport MCP servers:
{
"mcpServers": {
"pensyve": {
"type": "http",
"url": "https://mcp.pensyve.com/mcp",
"headers": {
"Authorization": "Bearer ${PENSYVE_API_KEY}"
}
}
}
}Environment interpolation differs by MCP client. Confirm that your client expands the placeholder, or use its secret-storage feature. Never commit a resolved key. Antigravity users should use browser OAuth because its MCP JSON does not expand environment-variable placeholders.
OAuth 2.1 (PKCE)
OAuth is the recommended authentication method for interactive remote MCP clients. Pensyve publishes protected-resource and authorization-server discovery metadata, supports dynamic client registration, and requires PKCE S256. A compatible client can register the URL, open browser consent, and refresh its token without storing a Pensyve API key in project configuration.
How it works:
- The client discovers
/.well-known/oauth-protected-resourceand the authorization server - Browser opens the Pensyve consent page
- You approve access
- The client receives a JWT access token signed with Ed25519
- The gateway verifies the token on every request
When to use OAuth: Interactive development with a compatible remote MCP client. OAuth tokens are short-lived and refreshed by the client.
When to use API keys instead: CI/CD pipelines, automation scripts, non-interactive environments, or MCP clients that don't support OAuth discovery.
Pensyve's discovery, registration, PKCE S256, public-client token, and authentication-challenge endpoints have been verified independently. That protocol probe does not replace a user completing browser consent in each client.
MCP Client Support
“Browser OAuth” means the client supports the remote MCP OAuth discovery flow.
“Static bearer” is the API-key fallback; the exact secret-storage mechanism
varies by client. Local stdio starts pensyve-mcp on the user's machine and does
not use cloud authentication.
| Client | Remote browser OAuth | Static bearer | Local stdio | Interactive setup |
|---|---|---|---|---|
| Antigravity CLI | Yes — discovery and dynamic registration | Manual, user-owned config | Yes | Install the plugin or add the URL, then authenticate from /mcp |
| Claude Code | Yes — automatic discovery and registration | Yes | Yes | Add the URL; use /mcp or claude mcp login |
| Codex CLI | Yes — codex mcp login | Yes | Yes | Add the URL, then run codex mcp login pensyve |
| GitHub Copilot CLI | Yes — automatic discovery and dynamic registration | Yes | Yes | Add the URL; use /mcp auth pensyve to re-authenticate |
| Cursor | Yes — remote HTTP/SSE | Yes | Yes | Add the URL and complete the browser prompt |
| VS Code Copilot | Yes — MCP OAuth 2.0/2.1 | Yes | Yes | Add the HTTP server and complete browser consent |
| Cline | Yes — remote HTTP/SSE | Yes | Yes | Add the URL and complete browser consent |
| Windsurf | Yes — remote MCP OAuth | Yes | Yes | Add the server URL and complete browser consent |
| OpenCode | Yes — discovery, PKCE, and dynamic registration | Yes | Yes | Add a remote server and complete browser authentication |
| OpenClaw | Yes — explicit OAuth mode | Yes | Yes | Add with --auth oauth, then log in if prompted |
| Claude Desktop | Yes — remote custom connectors | Yes | Yes | Add the public remote connector and approve access |
| Continue CLI | Yes — documented browser OAuth workflow | Yes | Yes | Follow the CLI browser login workflow |
| generic Continue IDE | Not guaranteed on every MCP surface | Yes | Yes | Use a token fallback where automatic OAuth is unavailable |
MCP Client Configuration
Claude Code (OAuth — Recommended)
Register the URL and let Claude Code discover OAuth:
claude mcp add --transport http pensyve https://mcp.pensyve.com/mcpNo API key is needed for the interactive flow.
Antigravity CLI
Install the native plugin:
agy plugin install https://github.com/major7apps/pensyve/tree/main/integrations/antigravity-pluginOr register only the server:
agy mcp add pensyve https://mcp.pensyve.com/mcpOpen /mcp and choose Authenticate. See the Antigravity CLI
guide for details.
Codex CLI
codex mcp add pensyve --url https://mcp.pensyve.com/mcp
codex mcp login pensyveGitHub Copilot CLI
copilot mcp add --transport http pensyve https://mcp.pensyve.com/mcpCopilot starts browser OAuth when the server first needs authentication. From
an interactive Copilot CLI session, run /mcp auth pensyve to authenticate
again or switch accounts.
OpenClaw
openclaw mcp add pensyve --url https://mcp.pensyve.com/mcp --transport streamable-http --auth oauthClaude Code (API Key — CI/Automation)
For non-interactive environments or when you prefer explicit key management:
export PENSYVE_API_KEY="psy_your_key_here"
claude mcp add --transport http pensyve https://mcp.pensyve.com/mcp \
--header "Authorization: Bearer $PENSYVE_API_KEY"Use this bearer pattern only for non-interactive automation. The Pensyve Antigravity plugin and interactive URL-only registrations use OAuth instead.
Other MCP Clients
See the Remote MCP guide for URL-only configuration examples for Cursor, Cline, Windsurf, VS Code, OpenCode, Claude Desktop, and the qualified Continue paths.
SDK Authentication
Python
import pensyve
p = pensyve.Pensyve(
api_url="https://api.pensyve.com",
api_key="psy_your_key_here",
namespace="my-agent",
)Or use the environment variable:
import os
p = pensyve.Pensyve(
api_url="https://api.pensyve.com",
api_key=os.environ["PENSYVE_API_KEY"],
namespace="my-agent",
)TypeScript
import { Pensyve } from "pensyve";
const p = new Pensyve({
baseUrl: "https://api.pensyve.com",
apiKey: "psy_your_key_here",
});Go
client := pensyve.New(
pensyve.WithAPIKey("psy_your_key_here"),
pensyve.WithBaseURL("https://api.pensyve.com"),
)REST API
curl https://api.pensyve.com/v1/recall \
-H "Authorization: Bearer psy_your_key_here" \
-H "Content-Type: application/json" \
-d '{"query": "user preferences", "namespace": "my-agent"}'Security Best Practices
- Never commit API keys to version control. Use environment variables or secret managers.
- Use the narrowest scope —
mcp:readfor agents that only recall,mcp:writefor ingestion pipelines. - Rotate keys regularly — the 24-hour grace period makes this zero-downtime.
- Revoke compromised keys immediately from the dashboard.
- One key per environment — separate keys for dev, staging, and production.
- The gateway never logs plaintext keys — only the first 8 characters appear in debug logs.