support reading headers from a file instead of cli args

This commit is contained in:
Ryan Kophs 2025-05-15 11:39:06 -04:00
parent 7eecc9ca3f
commit 40a9f30755
No known key found for this signature in database
2 changed files with 53 additions and 1 deletions

View file

@ -34,7 +34,9 @@ All the most popular MCP clients (Claude Desktop, Cursor & Windsurf) use the fol
### Custom Headers
To bypass authentication, or to emit custom headers on all requests to your remote server, pass `--header` CLI arguments:
To bypass authentication, or to emit custom headers on all requests to your remote server, there are two options:
#### Option 1: Using `--header` CLI arguments
```json
{
@ -72,6 +74,33 @@ To bypass authentication, or to emit custom headers on all requests to your remo
},
```
#### Option 2: Using `--headerFile` to read headers from a file
You can also provide headers from a file using the `--headerFile` argument. The file should contain one header per line in the format `Name:Value`. Lines starting with `#` are treated as comments and ignored.
```json
{
"mcpServers": {
"remote-example": {
"command": "npx",
"args": [
"mcp-remote",
"https://remote.mcp.server/sse",
"--headerFile",
"/path/to/headers.txt"
]
},
}
}
```
Example headers file:
```
# Headers for MCP Remote
Authorization:Bearer my-token
X-Custom-Header:custom-value
```
### Flags
* If `npx` is producing errors, consider adding `-y` as the first argument to auto-accept the installation of the `mcp-remote` package.