ToolHive MCP proxy endpoint does not support CORS
Open
Nobody has claimed this yet.
bug
good-tenth-issue
proxy
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 300
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 184
Description
Description
The ToolHive MCP HTTP proxy (/mcp) lacks CORS support, blocking web-based clients (e.g., MCP Inspector). The server returns 405 Method Not Allowed on OPTIONS preflight and misses Access-Control-Allow-Origin.
Steps to Reproduce
- Add an MCP to thv.
- Configure a client, e.g. OpenCode.
- Get the proxy MCP URL from the client config, e.g.
http://localhost:43969/mcpand paste it in MCP inspector. - Attempt to connect.
- Connection fails due to 405 error and CORS.
Request URL http://localhost:43969/mcp
Request Method OPTIONS
Status Code 405 Method Not Allowed
Remote Address 127.0.0.1:43969
Referrer Policy strict-origin-when-cross-origin
GET http://localhost:43969/mcp net::ERR_FAILED
Access to fetch at 'http://localhost:43969/mcp' from origin 'http://localhost:6274' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Expected Behavior
OPTIONShandles preflight with200/204.- Proper
Access-Control-Allow-*headers present on the/mcproute.
Actual Behavior
OPTIONSrequest:405 Method Not Allowed.- Console error:
net::ERR_FAILED(missingAccess-Control-Allow-Origin).
Environment
- OS: macOS M4.
- ToolHive: Version 0.24.0 (0.24.0)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ToolHive MCP HTTP proxy /mcp endpoint and trace its HTTP method handling and response headers. Reproduce the OPTIONS request from MCP Inspector, then verify that preflight succeeds and /mcp responses include the expected Access-Control-Allow-* headers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100