Skip to content

[FEAT] Accept Headers in MCPServerConfig when type is HTTP #297

@wakeupmh

Description

@wakeupmh

I was trying to connect to an hf-mcp-server using the MCPServerConfig HTTPServerConfig as follows:

   const mcpConfig = new MCPConfiguration({
      servers: {
        "hf-mcp-server": {
          url: "https://huggingface.co/mcp",
          headers: {
            Authorization: "Bearer " + process.env.HF_TOKEN!,
          },
          type: "http",
        },
      },
    });

However I see the error below:
image

Describe alternatives you've considered

I overcame by doing a StudioServerConfig

const mcpConfig = new MCPConfiguration({
      servers: {
        "hf-mcp-server": {
          command: "npx",
          args: [
            "mcp-remote",
            "https://huggingface.co/mcp",
            "--header",
            "Authorization: Bearer " + process.env.HF_TOKEN!,
          ],
          type: "stdio",
        },
      },
    });

Should we accept headers when using http mcp connections?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions