Skip to content
Open
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
4 changes: 4 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { createLazyAuthCoordinator } from './lib/coordination'
async function runClient(
serverUrl: string,
callbackPort: number,
callbackPath: string,
headers: Record<string, string>,
transportStrategy: TransportStrategy = 'http-first',
host: string,
Expand Down Expand Up @@ -66,6 +67,7 @@ async function runClient(
const authProvider = new NodeOAuthClientProvider({
serverUrl: discoveryResult.authorizationServerUrl,
callbackPort,
callbackPath,
host,
clientName: 'MCP CLI Client',
staticOAuthClientMetadata,
Expand Down Expand Up @@ -183,6 +185,7 @@ parseCommandLineArgs(process.argv.slice(2), 'Usage: npx tsx client.ts <https://s
({
serverUrl,
callbackPort,
callbackPath,
headers,
transportStrategy,
host,
Expand All @@ -194,6 +197,7 @@ parseCommandLineArgs(process.argv.slice(2), 'Usage: npx tsx client.ts <https://s
return runClient(
serverUrl,
callbackPort,
callbackPath,
headers,
transportStrategy,
host,
Expand Down
9 changes: 9 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,14 @@ export async function parseCommandLineArgs(args: string[], usage: string) {
j++
}

// Parse callback path
let callbackPath = '/oauth/callback' // Default
const callbackPathIndex = args.indexOf('--callback-path')
if (callbackPathIndex !== -1 && callbackPathIndex < args.length - 1) {
callbackPath = args[callbackPathIndex + 1]
log(`Using callback path: ${callbackPath}`)
}

// Parse auth timeout
let authTimeoutMs = 30000 // Default 30 seconds
const authTimeoutIndex = args.indexOf('--auth-timeout')
Expand Down Expand Up @@ -932,6 +940,7 @@ export async function parseCommandLineArgs(args: string[], usage: string) {
return {
serverUrl,
callbackPort,
callbackPath,
headers,
transportStrategy,
host,
Expand Down
4 changes: 4 additions & 0 deletions src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { createLazyAuthCoordinator } from './lib/coordination'
async function runProxy(
serverUrl: string,
callbackPort: number,
callbackPath: string,
headers: Record<string, string>,
transportStrategy: TransportStrategy = 'http-first',
host: string,
Expand Down Expand Up @@ -67,6 +68,7 @@ async function runProxy(
const authProvider = new NodeOAuthClientProvider({
serverUrl: discoveryResult.authorizationServerUrl,
callbackPort,
callbackPath,
host,
clientName: 'MCP CLI Proxy',
staticOAuthClientMetadata,
Expand Down Expand Up @@ -170,6 +172,7 @@ parseCommandLineArgs(process.argv.slice(2), 'Usage: npx tsx proxy.ts <https://se
({
serverUrl,
callbackPort,
callbackPath,
headers,
transportStrategy,
host,
Expand All @@ -184,6 +187,7 @@ parseCommandLineArgs(process.argv.slice(2), 'Usage: npx tsx proxy.ts <https://se
return runProxy(
serverUrl,
callbackPort,
callbackPath,
headers,
transportStrategy,
host,
Expand Down