DocsGPT icon indicating copy to clipboard operation
DocsGPT copied to clipboard

Bug Report: Custom headers can’t be set for MCP servers from the UI

Open asadmulani5 opened this issue 1 month ago • 5 comments

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 headers in buildToolConfig() 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 avatar Oct 19 '26 01:10 asadmulani5

@asadmulani5, you're assigned.

  • Open a PR or post progress here within 14 days; otherwise the issue goes back to other contributors.
  • Read CONTRIBUTING.md and frontend/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 avatar Oct 19 '26 01:10 arc53-machine

@arc53-machine feel free to assign this issue to me if theres no progress within 14 days , thank you

bhushan4work avatar Oct 21 '26 18:10 bhushan4work

@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.

arc53-machine avatar Oct 21 '26 18:10 arc53-machine

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.

asadmulani5 avatar Oct 23 '26 20:10 asadmulani5

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.

ManishMadan2882 avatar Oct 30 '26 00:10 ManishMadan2882