Set Up Access as an Administrator
You need OpenHands Enterprise app version 1.96.0 or later and access to the deployment configuration. For Helm and Replicated installations, 0.119.0 was the first Stable release to include the external MCP server. The same setup works on Docker Compose and Kubernetes. Serve the instance over HTTPS and use its HTTPS URL in the client. For example, if users openhttps://openhands.example.com, the MCP URL is
https://openhands.example.com/external-mcp/mcp.
Choose Who Can Connect and What They Can Do
Choose who can connect to the server. Users sign in with their own OpenHands accounts and approve the connection.The feature is off by default. If a database flag named
ENABLE_EXTERNAL_MCP already exists, its enabled state and
rules take precedence over the deployment variable.Register the Client and Enable Access
Copy the example for your deployment. It enables MCP across the deployment and registers a public client that can request read and write permissions. Before applying it, setENABLE_EXTERNAL_MCP and scopes to the values you chose
above.
- Docker Compose
- Helm
If your instance still uses an HTTP URL, configure HTTPS for Docker Compose
first.Add these settings to the
.env file next to docker-compose.yml. Then run docker compose up --wait..env
client_id in OpenHands and in your MCP client. OpenHands shows name to users when they approve the
connection. Add a JSON object to the existing array for each additional client.
Set redirect_uris to the exact callback URL your client uses. Use HTTPS for remote callbacks. A client running on
the user’s machine can use HTTP on a loopback address. The callback in the examples works with the Claude Code example
below.
Example for a client that uses a secret
Example for a client that uses a secret
Supply Configure the client with the same ID and secret and use
OPENHANDS_EXTERNAL_MCP_CLIENTS through your deployment’s secret configuration. The value is the full JSON
array, with the actual secret in client_secret. Replace the example ID, name, and callback URL with your client’s
values.client_secret_post for token exchange.Verify the Endpoint
After the deployment updates, check that the OAuth discovery URL returns JSON withresource set to your MCP URL.
Connect an MCP Client
Use a client that supports Streamable HTTP and lets you configure a pre-registered OAuth client ID. Get your MCP URL, client ID, and registered callback URL from your administrator.-
Add the MCP URL as a remote server in your client. Use the registered client ID and callback URL. Request
tasks:readand addtasks:writeif you need write access and your administrator registered it. If your client asks for the OAuth resource, use the same MCP URL. - Sign in to OpenHands in your browser and switch to the organization you want to connect. Start authentication from your MCP client and approve the access request in your browser.
-
Ask your client to list your tasks.
Use the OpenHands MCP server to show my five most recent tasks with their links.
Open a link to check the task in Agent Canvas. If you have yet to create a task in the connected organization, the list can be empty.
Claude Code example
Claude Code example
Run this command from the project where you want to use OpenHands. Use your deployment’s MCP URL and the client ID
and callback port from your administrator. For a read-only registration, set Launch
oauth.scopes to tasks:read.claude from the same project. Run /mcp, select openhands, and authenticate. See the
Claude Code MCP documentation.Start Tasks and Send Follow-ups
After connecting with write access, try asking your client to start a task that summarizes the README in a repository you can access. Connect the repository’s Git provider in OpenHands first. Ask for the task link, then use the same task ID to check the result or send a follow-up. If you originally connected with read-only access, have your administrator addtasks:write to the client registration
and apply the configuration. Request both scopes in your client and authenticate again to approve the new access.
Client Compatibility
OpenHands uses Streamable HTTP and OAuth for client connections. The server is built with FastMCP. Public OAuth clients use PKCE withS256 and omit client_secret from the registration.
Enable User Access for a Pilot
To limit access to a user or an organization, keep the deployment flag off and set up a database flag through the Admin API. With an enabled flag and an include rule, only matching accounts can connect. An enabled flag with no rules allows access across the deployment. Review any existing rules before making changes. Make these requests to your OpenHands instance with an API key from an instance-wide Super Admin account. Create the key inSettings > API Keys.
Find ORG_ID in the id field returned by GET /api/admin/organizations. Find USER_ID in the user_id field
returned by GET /api/admin/directory/users. Both endpoints accept q to search by name.
Start by checking whether the flag already exists. Use your instance URL and an environment variable containing your
API key. Send the same authorization header on each request.
For requests with a JSON body, send
Content-Type: application/json. Omit user_id from the include rule to allow the
entire organization. Check that evaluation returns {"enabled":true} for the pilot user and {"enabled":false} for a
user outside the pilot.
Troubleshooting
OpenHands uses the instance web URL with
/external-mcp appended as its OAuth issuer. To override it, set
OPENHANDS_EXTERNAL_MCP_BASE_URL to an HTTPS URL ending in /external-mcp. For OpenAI app domain verification,
set OPENAI_APPS_CHALLENGE_TOKEN to the issued token and forward /.well-known/openai-apps-challenge to the OpenHands
app. The path should return the token as plain text.
