Remotehost Docs

Set an MCP connection's credential

PUT
/orgs/{orgId}/projects/{projectId}/mcp-connections/{connectionId}/credential

Sets or replaces the credential of an api_key MCP connection: headers sent with every request to an http or sse server, or env for a stdio server's process. It is stored encrypted and never returned. Needs mcp.manage on the project; API keys are refused. A credential is delivered to every sandbox in the project at each start, into its RAM-only secrets directory, where every process in those sandboxes, and anyone who may open a terminal (sandbox.terminal.connect) or read files (sandbox.files.read) there, can read it. Changing where the connection points (its transport, URL, command, arguments or auth type), or moving it to another project, deletes it.

Authorization

bearerAuth
AuthorizationBearer <token>

A RemoteHost API key (rh_sk_...) or a user session token.

In: header

Path Parameters

orgId*string
projectId*string
connectionId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PUT "https://example.com/orgs/string/projects/string/mcp-connections/string/credential" \  -H "Content-Type: application/json" \  -d '{    "headers": {      "property1": "string",      "property2": "string"    }  }'
{  "connection": {    "id": "string",    "org_id": "string",    "project_id": "string",    "name": "string",    "transport": "streamable_http",    "server_url": "string",    "command": "string",    "args": [      "string"    ],    "auth_type": "none",    "auth_status": "not_required",    "enabled": true,    "allowed_tools": [      "string"    ],    "last_used_at": "string",    "created_by": "string",    "listing_id": "string",    "created_at": "string",    "updated_at": "string",    "credential_set": true,    "credential_set_by": "string",    "credential_set_at": "string"  },  "exposure": "string"}