Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,20 @@ To bypass authentication, or to emit custom headers on all requests to your remo
]
```

* To enable an outbound HTTP(S) proxy for mcp-remote, add the `--enable-proxy` flag. When enabled, mcp-remote will use the proxy settings from common environment variables (for example `HTTP_PROXY`, `HTTPS_PROXY`, and `NO_PROXY`).

```json
"args": [
"mcp-remote",
"https://remote.mcp.server/sse",
"--enable-proxy"
],
"env": {
"HTTPS_PROXY": "http://127.0.0.1:3128",
"NO_PROXY": "localhost,127.0.0.1"
}
```

* To ignore specific tools from the remote server, add the `--ignore-tool` flag. This will filter out tools matching the specified patterns from both `tools/list` responses and block `tools/call` requests. Supports wildcard patterns with `*`.

```json
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"dependencies": {
"express": "^4.21.2",
"open": "^10.1.0",
"strict-url-sanitise": "^0.0.1"
"strict-url-sanitise": "^0.0.1",
"undici": "^7.12.0"
},
"devDependencies": {
"@modelcontextprotocol/sdk": "^1.17.3",
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import fs from 'fs'
import { readFile, rm } from 'fs/promises'
import path from 'path'
import { version as MCP_REMOTE_VERSION } from '../../package.json'
import { fetch, setGlobalDispatcher, RequestInit, EnvHttpProxyAgent } from 'undici'

// Global type declaration for typescript
declare global {
Expand Down Expand Up @@ -642,6 +643,13 @@ export async function parseCommandLineArgs(args: string[], usage: string) {
log('Debug mode enabled - detailed logs will be written to ~/.mcp-auth/')
}

const enableProxy = args.includes('--enable-proxy')
if (enableProxy) {
// Use env proxy
setGlobalDispatcher(new EnvHttpProxyAgent())
log('HTTP proxy support enabled - using system HTTP_PROXY/HTTPS_PROXY environment variables')
}

// Parse transport strategy
let transportStrategy: TransportStrategy = 'http-first' // Default
const transportIndex = args.indexOf('--transport')
Expand Down
Loading