1
1
#!/usr/bin/env node
2
2
3
+ import { parseArgs } from "node:util" ;
3
4
import cors from "cors" ;
4
5
import EventSource from "eventsource" ;
5
6
@@ -16,6 +17,14 @@ import mcpProxy from "./mcpProxy.js";
16
17
// eslint-disable-next-line @typescript-eslint/no-explicit-any
17
18
( global as any ) . EventSource = EventSource ;
18
19
20
+ const { values } = parseArgs ( {
21
+ args : process . argv . slice ( 2 ) ,
22
+ options : {
23
+ env : { type : "string" , default : "" } ,
24
+ args : { type : "string" , default : "" } ,
25
+ } ,
26
+ } ) ;
27
+
19
28
const app = express ( ) ;
20
29
app . use ( cors ( ) ) ;
21
30
@@ -97,11 +106,16 @@ app.post("/message", async (req, res) => {
97
106
}
98
107
} ) ;
99
108
100
- app . get ( "/default-environment " , ( req , res ) => {
109
+ app . get ( "/config " , ( req , res ) => {
101
110
try {
102
- res . json ( getDefaultEnvironment ( ) ) ;
111
+ const defaultEnvironment = getDefaultEnvironment ( ) ;
112
+ res . json ( {
113
+ defaultEnvironment,
114
+ defaultCommand : values . env ,
115
+ defaultArgs : values . args ,
116
+ } ) ;
103
117
} catch ( error ) {
104
- console . error ( "Error in /default-environment route:" , error ) ;
118
+ console . error ( "Error in /config route:" , error ) ;
105
119
res . status ( 500 ) . json ( error ) ;
106
120
}
107
121
} ) ;
0 commit comments