Bug Report: Custom headers can’t be set for MCP servers from the UI
Description
The MCP tool already supports custom headers on the backend. In docsgpt/agents/tools/mcp_tool.py:
self.custom_headers = config.get("headers", {})
and the config docstring documents headers: Custom headers for requests.
However, the Add MCP Server modal (frontend/src/modals/MCPServerModal.tsx) never sends a headers field. buildToolConfig() only sends server_url, auth_type, timeout, and auth-specific fields. The only header the UI can set is api_key_header (API Key auth, a single header).
So MCP servers that require extra headers (e.g. tenant/org IDs or additional auth headers) can't be configured from the UI. This was also noted as out of scope in #2702.
Confirmed on current main.
Expected behavior
The Add MCP Server modal offers an optional key/value "Custom headers" section. Headers are included in buildToolConfig(), loaded back when editing a saved server, and sent with MCP requests.
Proposed fix
- Add an optional key/value headers editor to
MCPServerModal.tsx - Send
headersinbuildToolConfig()and prefill them when editing an existing server - Add tests, and make sure custom headers don't override auth headers
Willing to submit a PR?
Yes, I'd like to work on this.
@asadmulani5, you're assigned.
- Open a PR or post progress here within 14 days; otherwise the issue goes back to other contributors.
- Read
CONTRIBUTING.mdandfrontend/DESIGN.md. - Cover headers in Test Connection, saving and reopening a server. Add tests that custom headers cannot override auth headers, including differently capitalized names.
- Include a screenshot or short recording of the UI change.
Automated triage. A maintainer will follow up.
@arc53-machine feel free to assign this issue to me if theres no progress within 14 days , thank you
@bhushan4work, @asadmulani5 is currently assigned. Their 14-day progress window ends on November 2. If there is no progress or open PR by then, please comment here again so the assignment can be reassessed.
Automated triage. A maintainer will follow up.
Draft PR is up: #3159. Backend, UI, tests and all eight locales are done; adding the UI screenshot next, then I'll mark it ready for review.
I'm going to close this as not planned. The MCP modal already covers bearer, an API key under any header name, basic and OAuth, and nobody has come up with a server that needs something those can't do. Custom headers would mean a second encrypted-secret path through save, create, update and the tool executor, which is a lot to carry for a case we haven't seen. If you run into an MCP server that needs extra headers, open a new issue naming the server and what it expects and we'll look at it then.