test-mcp-config/
When you configure an MCP server in the OpenHands UI, there’s no feedback on whether it actually connects. A bad URL or wrong token causes the server’s tools to silently disappear from the agent’s toolset. This example uses the agent-server’s POST /api/mcp/test endpoint to validate a config end-to-end before using it.
Requires agent-server 1.29.0 / OpenHands 1.8.0 or later. Older runtimes return 404.
How It Works
POST /api/mcp/test endpoint connects to a single MCP server, lists its tools, and optionally calls a specific tool to verify credentials. It returns HTTP 200 in both success and failure cases — a connection failure is an expected validation result, not a server error.
Response Format
error_kind is one of: timeout, connection, or unknown. Auth failures (e.g., a 401) currently return as unknown — read error for the full message.
Usage
Supported Transport Types
Multiple Configs at Once
Pass a JSON file with multiple server configurations to validate them all in one run:servers.json
See Also
- Per-Conversation Secrets — Use per-conversation secrets to supply MCP server auth tokens at runtime
- Start a Sandbox — How sandbox creation and polling works

