File tree Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export const parseAuthHeaders = (req: IncomingMessage): Partial<ClientOptions> =
10
10
const value = req . headers . authorization . slice ( scheme . length + 1 ) ;
11
11
switch ( scheme ) {
12
12
case 'Basic' :
13
- const rawValue = Buffer . from ( value ) . toString ( 'base64' ) ;
13
+ const rawValue = Buffer . from ( value , 'base64' ) . toString ( ) ;
14
14
return {
15
15
tokenId : rawValue . slice ( 0 , rawValue . search ( ':' ) ) ,
16
16
tokenSecret : rawValue . slice ( rawValue . search ( ':' ) + 1 ) ,
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ export const streamableHTTPApp = (options: McpOptions) => {
83
83
export const launchStreamableHTTPServer = async (
84
84
options : McpOptions ,
85
85
endpoints : Endpoint [ ] ,
86
- port : number | undefined ,
86
+ port : number | string | undefined ,
87
87
) => {
88
88
const app = streamableHTTPApp ( options ) ;
89
89
const server = app . listen ( port ) ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ async function main() {
26
26
await launchStdioServer ( options , selectedTools ) ;
27
27
break ;
28
28
case 'http' :
29
- await launchStreamableHTTPServer ( options , selectedTools , options . port ) ;
29
+ await launchStreamableHTTPServer ( options , selectedTools , options . port ?? options . socket ) ;
30
30
break ;
31
31
}
32
32
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export type CLIOptions = McpOptions & {
7
7
list : boolean ;
8
8
transport : 'stdio' | 'http' ;
9
9
port : number | undefined ;
10
+ socket : string | undefined ;
10
11
} ;
11
12
12
13
export type McpOptions = {
@@ -141,6 +142,10 @@ export function parseOptions(): CLIOptions {
141
142
type : 'number' ,
142
143
description : 'Port to serve on if using http transport' ,
143
144
} )
145
+ . option ( 'socket' , {
146
+ type : 'string' ,
147
+ description : 'Unix socket to serve on if using http transport' ,
148
+ } )
144
149
. help ( ) ;
145
150
146
151
for ( const [ command , desc ] of examples ( ) ) {
@@ -262,6 +267,7 @@ export function parseOptions(): CLIOptions {
262
267
list : argv . list || false ,
263
268
transport,
264
269
port : argv . port ,
270
+ socket : argv . socket ,
265
271
} ;
266
272
}
267
273
You can’t perform that action at this time.
0 commit comments