Raw credentials
Store a service account key or other raw credential on your webhook, which mints short-lived access tokens for agents instead of handing out the long-lived key.
A raw credential is a JSON, config or connection-string blob, such as a GCP service account key. Store it once on your webhook. When an agent reads it, the webhook detects the kind, mints a short-lived access token (a one-hour OAuth2 token for GCP) and returns only that token. The long-lived key never leaves the webhook.
GCP service-account minting is built into the reference webhook. AWS and Azure follow the same pattern if you add them.
Add one
In Add credential, choose Other, then Raw (JSON, config, connection string). Paste the content into the Credential box. A badge shows what the page detected, for example GCP Service Account (sa@project.iam.gserviceaccount.com).
The web app does not offer MCP servers on raw credentials, so access is Value.
What just happened
| Hop | Sees the long-lived key? | Sees the minted token? |
|---|---|---|
| Token Vault | No | No |
| Agent | No | Yes |
| Your webhook | Yes | Yes |
Detected kinds
| Credential | Detected by | Webhook behaviour |
|---|---|---|
| GCP service account | type: "service_account" with private_key and client_email | Mints a one-hour access token |
| GCP authorized user | type: "authorized_user" | Page badge only; returned as stored |
| AWS credentials | aws_access_key_id in JSON or INI | Returned as stored; STS minting is yours to add |
| Azure service principal | appId and tenant, or clientId and tenantId | Returned as stored; token minting is yours to add |
| Other JSON or YAML | Generic | Returned as stored |
The reference webhook mints with the default scope https://www.googleapis.com/auth/cloud-platform and ignores a scope an agent asks for, so an agent cannot widen it.
Security properties
| Property | How |
|---|---|
| Key is not returned | Stored by ticket in storage you control, behind a webhook you run. Tokens are minted from it there. |
| Encrypted at rest | The reference webhook encrypts; your webhook, your choice. |
| Short-lived tokens | A minted GCP token lasts about an hour. |
| Policy-gated | Every mint passes the agent's grant and policies first. |
| Audited | AGENT_CREDENTIAL_ACCESS is logged per mint. |
| Revocable | Revoke the grant or suspend the agent. |
Troubleshooting
- "Failed to mint GCP access token". The webhook error is
gcp_mint_failed. The JSON needstype: "service_account",client_emailandprivate_key. The service account needs IAM roles for what you call. - The agent gets raw JSON. Your webhook lacks the interception. The reference webhook has it; a custom one needs the code below.
- Token rejected right away. The minted token inherits the service account's permissions. If the account is disabled in GCP IAM, the token fails even before expiry.
Implement it in your own webhook
The reference TypeScript webhook already mints GCP tokens. Read on only for a from-scratch or custom-language webhook, or to add a new kind. The examples use Python.
Dependencies
google-auth
requestsrequests is the HTTP transport google-auth uses to mint.
Minting module
import json
import time
from typing import Optional
from cachetools import TTLCache
from google.auth.transport.requests import Request as GoogleAuthRequest
from google.oauth2 import service_account
# Key: (service_name, scopes). TTL 50 min, so a fresh token is minted 10 min before expiry.
_token_cache: TTLCache = TTLCache(maxsize=100, ttl=3000)
DEFAULT_SCOPES = ["https://www.googleapis.com/auth/cloud-platform"]
def is_gcp_service_account(credential_value: str) -> bool:
try:
data = json.loads(credential_value)
return (
isinstance(data, dict)
and data.get("type") == "service_account"
and "private_key" in data
and "client_email" in data
)
except (json.JSONDecodeError, TypeError, ValueError):
return False
def mint_access_token(credential_value: str, service_name: str, scopes: Optional[list[str]] = None) -> dict:
scopes = scopes or DEFAULT_SCOPES
cache_key = (service_name, tuple(sorted(scopes)))
cached = _token_cache.get(cache_key)
if cached:
token, expiry_iso, email = cached
return {"accessToken": token, "expiresAt": expiry_iso, "tokenType": "Bearer", "serviceAccount": email}
sa_info = json.loads(credential_value)
credentials = service_account.Credentials.from_service_account_info(sa_info, scopes=scopes)
credentials.refresh(GoogleAuthRequest())
expiry = credentials.expiry
expiry_iso = (
expiry.isoformat() + "Z" if expiry
else time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(time.time() + 3600))
)
email = sa_info.get("client_email", "unknown")
_token_cache[cache_key] = (credentials.token, expiry_iso, email)
return {"accessToken": credentials.token, "expiresAt": expiry_iso, "tokenType": "Bearer", "serviceAccount": email}Wire into /v1/credential
After decrypting the stored token and before returning it. Use fixed scopes; do not take them from the request.
raw_access = token.get("accessToken", "")
if raw_access and is_gcp_service_account(raw_access):
minted = mint_access_token(raw_access, service)
token = {
"accessToken": minted["accessToken"],
"tokenType": minted["tokenType"],
"expiresAt": minted["expiresAt"],
"serviceName": service,
"serviceAccount": minted["serviceAccount"],
"gcpMinted": True,
}On failure return a 500 with an error such as gcp_mint_failed. The first mint takes about 500 ms; cached mints are instant.
Add another kind
The rule is the same: detect after decryption, transform before returning. For AWS, detect aws_access_key_id and aws_secret_access_key, call STS GetSessionToken, and return the temporary key, secret and session token in place of the stored key.
Ready to try it?
Sign in with Google or email. Your credentials stay on your own webhook, and the quickstart gets Claude Code making its first MCP tool call in about 15 minutes.