feat: short timeout has now been added for clients like cursor

This commit is contained in:
stevehuynh 2025-05-14 20:40:43 +10:00
parent bd75a1cdf0
commit c1fe647a48
2 changed files with 56 additions and 7 deletions

View file

@ -32,6 +32,7 @@ async function runProxy(
callbackPort: number,
headers: Record<string, string>,
transportStrategy: TransportStrategy = 'http-first',
shortTimeout: boolean = false,
) {
// Set up event emitter for auth flow
const events = new EventEmitter()
@ -78,7 +79,7 @@ async function runProxy(
try {
// Connect to remote server with lazy authentication
const remoteTransport = await connectToRemoteServer(null, serverUrl, authProvider, headers, authInitializer, transportStrategy)
const remoteTransport = await connectToRemoteServer(null, serverUrl, authProvider, headers, authInitializer, transportStrategy, shortTimeout)
// Set up bidirectional proxy between local and remote transports
mcpProxy({
@ -136,8 +137,8 @@ to the CA certificate file. If using claude_desktop_config.json, this might look
// Parse command-line arguments and run the proxy
parseCommandLineArgs(process.argv.slice(2), 3334, 'Usage: npx tsx proxy.ts <https://server-url> [callback-port]')
.then(({ serverUrl, callbackPort, headers, transportStrategy }) => {
return runProxy(serverUrl, callbackPort, headers, transportStrategy)
.then(({ serverUrl, callbackPort, headers, transportStrategy, shortTimeout }) => {
return runProxy(serverUrl, callbackPort, headers, transportStrategy, shortTimeout)
})
.catch((error) => {
log('Fatal error:', error)