Overview
Model Context Protocol (MCP) servers provide additional tools and context to OpenHands agents. You can add HTTP/SSE servers with authentication or stdio-based local servers to extend what OpenHands can do. The CLI provides two ways to manage MCP servers:- CLI commands (
openhands mcp) - Manage servers from the command line - Interactive command (
/mcp) - View server status within a conversation
If you’re upgrading from a version before release 1.0.0, you’ll need to redo your MCP server configuration as the format has changed from TOML to JSON.
MCP Commands
List Servers
View all configured MCP servers:Get Server Details
View details for a specific server:Remove a Server
Remove a server configuration:Enable/Disable Servers
Control which servers are active:Adding Servers
HTTP/SSE Servers
Add remote servers with HTTP or SSE transport:With Bearer Token Authentication
With API Key Authentication
With Multiple Headers
With OAuth Authentication
Stdio Servers
Add local servers that communicate via stdio:Basic Example
With Environment Variables
Add in Disabled State
Command Reference
| Option | Description |
|---|---|
--transport | Transport type: http, sse, or stdio (required) |
--header | HTTP header for http/sse (format: "Key: Value", repeatable) |
--env | Environment variable for stdio (format: KEY=value, repeatable) |
--auth | Authentication method (e.g., oauth) |
--enabled | Enable immediately (default) |
--disabled | Add in disabled state |
Example: Web Search with Tavily
Add web search capability using Tavily’s MCP server:Manual Configuration
You can also manually edit the MCP configuration file at~/.openhands/mcp.json.
Configuration Format
The file uses the MCP configuration format:Example Configuration
Interactive /mcp Command
Within an OpenHands conversation, use /mcp to view server status:
- View active servers: Shows which MCP servers are currently active in the conversation
- View pending changes: If
mcp.jsonhas been modified, shows which servers will be mounted when the conversation restarts
The
/mcp command is read-only. Use openhands mcp commands to modify server configurations.Workflow
- Add servers using
openhands mcp add - Start a conversation with
openhands - Check status with
/mcpinside the conversation - Use the tools provided by your MCP servers
Troubleshooting
Server Not Appearing
-
Verify the server is enabled:
-
Check the configuration:
- Restart the conversation to load new configurations
Server Fails to Start
-
Test the command manually:
- Check environment variables and credentials
- Review error messages in the CLI output
Configuration File Location
The MCP configuration is stored at:- Config file:
~/.openhands/mcp.json
See Also
- Model Context Protocol - Official MCP documentation
- MCP Server Settings - GUI MCP configuration
- Command Reference - Full CLI command reference

