You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Split: the `/api/chat` raw-bytes-body fix that previously lived here
has moved to HolmesGPT#2120. This PR is now MCP-only. Supersedes HolmesGPT#2117
(originally by @aantn); its commits are included.
## Summary
Makes MCP toolset authentication validation work end-to-end.
**From HolmesGPT#2117 (@aantn) — `health_check_tool` foundation**
- Adds an opt-in `health_check_tool` config field to MCP toolsets. MCP
servers (e.g. GitHub) return their full tool list even with an invalid
credential, so listing tools never proves auth. When set, the named
read-only tool is invoked during prerequisite evaluation; a failure
(e.g. 401) marks the toolset disabled instead of "connected". Wires
`get_me` / `get_current_user` into the helm chart for the built-in
GitHub / GitLab addons.
**Follow-up (this PR)**
1. **Auto-detect the health check tool.** Toolset configs generated
outside the helm template (e.g. Robusta's `custom_toolset.yaml`) don't
set `health_check_tool`, so the check was skipped. When unset, Holmes
now falls back to an allowlist of well-known read-only identity tools
(`get_me`, `get_current_user`, `get_authenticated_user`, `whoami`) and
invokes the first one the server exposes. Explicit config still takes
precedence.
2. **Enable the GitHub `context` toolset by default.** `get_me` only
exists when the GitHub MCP server's `context` toolset is enabled, but
the chart default (`repos,issues,pull_requests,actions`) excluded it —
so auto-detection found nothing. Default is now
`repos,issues,pull_requests,actions,context` (read-only/lightweight).
Adds a debug log when no identity tool is exposed, so a skipped check is
diagnosable.
3. **Detailed failure messages.** Health-check failures now include the
tool name and params (`health check tool '<name>' with params {} failed
- ...`), per the toolset error-detail contract (CodeRabbit).
## Testing
`tests/test_mcp_toolset.py`: health-check, auto-detect,
skipped-check-logging, and error-message tests
(`TestMCPHealthCheckTool`). Full suite passing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added authentication credential validation for MCP servers at startup
via health-check tools
* Health-check tools are auto-detected from identity tools or can be
explicitly configured
* Improved error messages when authentication validation fails
* **Documentation**
* New section documenting health-check validation, configuration, and
troubleshooting
* **Chores**
* Updated default Helm values to include context tool for authentication
validation
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Claude <noreply@anthropic.com>
Signed-off-by: alonelish <alon.elish@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Roi Glinik <groi.tech@gmail.com>
Copy file name to clipboardExpand all lines: docs/data-sources/remote-mcp-servers.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -391,6 +391,32 @@ MCP servers can forward HTTP headers from the incoming request to the MCP backen
391
391
392
392
For full details on template syntax, blocked headers, precedence rules, and examples for other toolset types, see [HTTP Header Propagation](header-propagation.md).
393
393
394
+
**Validating Authentication at Startup (Health Check)**
395
+
396
+
Many MCP servers return their full tool list even when the configured credential is invalid (a bad token, expired key, etc.). Because of this, simply connecting and listing tools does not prove that authentication works — the toolset can appear "connected" while every real call would fail.
397
+
398
+
To catch this at startup, Holmes can invoke a single read-only tool during the toolset's health check. If the call fails (e.g. `401 Unauthorized`), the toolset is marked **disabled** with the underlying error surfaced, instead of showing as enabled.
399
+
400
+
-**Automatic:** if the server exposes a well-known identity tool — `get_me`, `get_current_user`, `get_authenticated_user`, or `whoami` — Holmes auto-detects and uses it. No configuration needed.
401
+
-**Explicit:** for any other server, set `health_check_tool` to a tool of your choice. This takes precedence over auto-detection.
402
+
403
+
The chosen tool **must be read-only, take no required arguments** (it is called with empty arguments `{}`), and actually exercise the credential. If `health_check_tool` is unset and the server exposes none of the known identity tools, the auth health check is skipped and the toolset loads as long as listing tools succeeds.
404
+
405
+
```yaml
406
+
mcp_servers:
407
+
my_server:
408
+
description: "My custom MCP server"
409
+
config:
410
+
url: "http://my-mcp:8000/mcp"
411
+
mode: streamable-http
412
+
headers:
413
+
Authorization: "Bearer {{ env.MY_API_KEY }}"
414
+
# Invoked with empty args at startup to verify the credential is valid.
415
+
# Must be a read-only, no-argument tool exposed by your server.
416
+
health_check_tool: get_current_user
417
+
llm_instructions: "..."
418
+
```
419
+
394
420
## Configuration Format Migration
395
421
396
422
The MCP server configuration format has been updated. The `url` field must now be inside the `config` section.
"description" "GitHub MCP Server - access repositories, pull requests, issues, and GitHub Actions. Debug CI failures, search code, and delegate tasks to Copilot."
"description" "GitHub MCP Server - access repositories, pull requests, issues, and GitHub Actions. Debug CI failures, search code, and delegate tasks to Copilot."
0 commit comments