@@ -43,9 +43,7 @@ type JsonRpcResponse = JsonRpcResponseOk | JsonRpcResponseErr;
4343/**
4444 * Single in-process MCP server. Speaks Streamable-HTTP MCP at `POST /mcp`
4545 * (JSON-RPC body, single JSON response). All five agent providers connect
46- * here by URL — no per-thread Node child process. Also exposes legacy
47- * `POST /<tool_name>` REST routes for backward compatibility with the old
48- * stdio bridge until the v2 ship lands.
46+ * here by URL — no per-thread Node child process.
4947 */
5048export class BrowserMcpIngress {
5149 private server : Server | null = null ;
@@ -189,18 +187,6 @@ export class BrowserMcpIngress {
189187 return ;
190188 }
191189
192- // Legacy REST: POST /<tool_name>. Retained so any older client still
193- // pointed at this endpoint continues to work during the transition.
194- if ( req . method === "POST" ) {
195- const tool = path . replace ( / ^ \/ + / , "" ) . replace ( / \/ + $ / , "" ) ;
196- if ( ! tool ) {
197- this . sendJson ( res , 404 , { error : "not found" } ) ;
198- return ;
199- }
200- await this . handleLegacyRest ( req , res , tool ) ;
201- return ;
202- }
203-
204190 this . sendJson ( res , 404 , { error : "not found" } ) ;
205191 } catch ( err ) {
206192 this . sendJson ( res , 500 , { error : ( err as Error ) . message ?? "internal" } ) ;
@@ -261,7 +247,7 @@ export class BrowserMcpIngress {
261247 result : {
262248 protocolVersion : MCP_PROTOCOL_VERSION ,
263249 capabilities : { tools : { } } ,
264- serverInfo : { name : "lightcode_browser " , version : "2.0.0" } ,
250+ serverInfo : { name : "browser " , version : "2.0.0" } ,
265251 } ,
266252 } ;
267253 }
@@ -329,40 +315,6 @@ export class BrowserMcpIngress {
329315 } ;
330316 }
331317 }
332-
333- private async handleLegacyRest (
334- req : IncomingMessage ,
335- res : ServerResponse ,
336- tool : string ,
337- ) : Promise < void > {
338- if ( ! isKnownToolName ( tool ) ) {
339- this . sendJson ( res , 404 , { error : `unknown tool: ${ tool } ` } ) ;
340- return ;
341- }
342- const ctx = this . buildContext ( ) ;
343- if ( ! ctx ) {
344- this . sendJson ( res , 503 , { error : "browser not ready" } ) ;
345- return ;
346- }
347- ctx . manager . revealPanel ( ) ;
348- const raw = await this . readBody ( req ) ;
349- let args : Record < string , unknown > = { } ;
350- if ( raw ) {
351- try {
352- const parsed = JSON . parse ( raw ) ;
353- if ( parsed && typeof parsed === "object" ) args = parsed as Record < string , unknown > ;
354- } catch {
355- this . sendJson ( res , 400 , { error : "invalid json" } ) ;
356- return ;
357- }
358- }
359- try {
360- const result = await dispatchTool ( tool , args , ctx ) ;
361- this . sendJson ( res , 200 , result ) ;
362- } catch ( err ) {
363- this . sendJson ( res , 500 , { error : ( err as Error ) . message ?? "internal" } ) ;
364- }
365- }
366318}
367319
368320function isJsonRpcRequest ( value : unknown ) : value is JsonRpcRequest {
0 commit comments