mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-14 14:12:44 +00:00
fix(mcp): add skip_preflight config option for servers serving HTML on GET
Some MCP servers (e.g. Spring Boot apps with a React SPA) serve their
frontend on any unmatched GET route. The MCP endpoint works perfectly
via POST (JSON-RPC), but a GET to /mcp falls through to the SPA
controller and returns text/html. Hermes's preflight content-type probe
sees HTML instead of application/json or text/event-stream and refuses
to connect.
This adds a per-server config option that
bypasses the content-type probe, letting the SDK connect directly via
POST where it works fine.
```yaml
mcp_servers:
stirling-pdf:
url: http://localhost:8090/mcp
headers:
X-API-KEY: <key>
skip_preflight: true
```
Related: #52460 (OAuth redirect preflight), #51600 (skip probe on mcp add),
#40366 (skip probe on reconnect — already merged).
This commit is contained in:
parent
32c1c47eef
commit
549def3a21
1 changed files with 1 additions and 1 deletions
|
|
@ -2489,7 +2489,7 @@ class MCPServerTask:
|
|||
# re-probing is a redundant round-trip. Also skip for OAuth servers:
|
||||
# without a cached token the endpoint returns HTML or 401, which
|
||||
# would incorrectly block the OAuth flow before it can run.
|
||||
if config.get("transport") != "sse" and not self._ready.is_set() and self._auth_type != "oauth":
|
||||
if config.get("transport") != "sse" and not config.get("skip_preflight") and not self._ready.is_set() and self._auth_type != "oauth":
|
||||
try:
|
||||
_probe_headers = dict(config.get("headers") or {})
|
||||
await self._preflight_content_type(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue