diff --git a/openhands/static/img/mcp-credential-broker.gif b/openhands/static/img/mcp-credential-broker.gif new file mode 100644 index 000000000..a47536a86 Binary files /dev/null and b/openhands/static/img/mcp-credential-broker.gif differ diff --git a/openhands/usage/settings/mcp-settings.mdx b/openhands/usage/settings/mcp-settings.mdx index 9b1c1afa3..007ed9e21 100644 --- a/openhands/usage/settings/mcp-settings.mdx +++ b/openhands/usage/settings/mcp-settings.mdx @@ -150,6 +150,39 @@ Direct stdio connections may still be appropriate in these scenarios: For production use, we recommend using proxy tools like SuperGateway. + + A credential broker lets the agent call an API such as GitHub without the token being in its environment. + The token stays in the broker's vault. The agent names a binding, a method and a path; the broker checks what + a person allowed, adds the token, sends the request and returns the response. + + This example uses [1Claw](https://1claw.co), which provides a hosted MCP server. In 1Claw, store the token, + create an agent, and give it a binding that says what it may call, for example `GET` only on one repository. + Then add the server with `Add custom server`: + + | Field | Value | + |-------|-------| + | `Server Type` | `SHTTP` | + | `Server name` | `1claw` | + | `URL` | `https://mcp.1claw.co/mcp` | + | `Authentication` | `Header` | + + In `Headers`, enter the tool set and the 1Claw agent's key: + + ```text + X-1Claw-Toolsets=execute + Authorization=Bearer <1Claw agent key> + ``` + + `X-1Claw-Toolsets=execute` gives the agent only the tools for brokered calls. Click `Test connection`; a working + setup reports `Connected — 9 tool(s) available`. + + In a new conversation, the agent can call the `execute_http` tool with the binding's name. A request outside + the binding's limits is refused by the broker, whatever the prompt says: + + ![Agent Canvas: adding the broker as a custom MCP server, then a conversation where the agent finds no GitHub token in its environment, reads a repository through the broker, and is refused a DELETE request](/openhands/static/img/mcp-credential-broker.gif) + + Access is revoked per agent in the broker, without rotating the token. + Other options include: diff --git a/openhands/usage/settings/secrets-settings.mdx b/openhands/usage/settings/secrets-settings.mdx index 0d07168a3..a017fd65b 100644 --- a/openhands/usage/settings/secrets-settings.mdx +++ b/openhands/usage/settings/secrets-settings.mdx @@ -40,6 +40,12 @@ For security, the existing value is not displayed. Enter a replacement value whe secret named `OPENAI_API_KEY`, you can access it in your code as `process.env.OPENAI_API_KEY` in JavaScript or `os.environ['OPENAI_API_KEY']` in Python. + + For an HTTP API, the agent can also use a credential without it being exported at all, through a credential broker + connected as an MCP server. See the Credential Broker example in + [MCP Settings](/openhands/usage/settings/mcp-settings#configuration-examples). + + ## Agent-Requested Secrets Secrets saved in `Settings > Secrets` reach conversations that start after the save. During a conversation, the agent can also ask for a credential it needs for the current task.