@@ -1575,32 +1575,21 @@ test("adds, disconnects, and reconnects MCP servers at runtime", async () => {
15751575 await Effect . runPromise (
15761576 Effect . scoped (
15771577 Effect . gen ( function * ( ) {
1578+ const server = yield * resourceServer ( { modern : true , resources : false } )
1579+ const config = { type : "remote" , url : server . url , oauth : false , protocol : "2026-07-28" } as const
15781580 yield * Effect . gen ( function * ( ) {
15791581 const service = yield * Mcp . Service
15801582
15811583 expect ( ( yield * service . servers ( ) ) [ 0 ] ?. status ) . toEqual ( { status : "disabled" } )
15821584 expect ( published ) . toContain ( McpEvent . StatusChanged . type )
15831585 expect ( yield * service . connect ( "missing" ) . pipe ( Effect . flip ) ) . toBeInstanceOf ( Mcp . NotFoundError )
15841586 expect ( yield * service . disconnect ( "missing" ) . pipe ( Effect . flip ) ) . toBeInstanceOf ( Mcp . NotFoundError )
1585- yield * service . add (
1586- "dynamic" ,
1587- new ConfigMCP . Local ( {
1588- type : "local" ,
1589- command : [ process . execPath , path . join ( import . meta. dir , "fixture/mcp-output-schema.ts" ) ] ,
1590- } ) ,
1591- )
1587+ yield * service . add ( "dynamic" , new ConfigMCP . Remote ( config ) )
15921588 expect ( ( yield * service . servers ( ) ) . find ( ( server ) => server . name === "dynamic" ) ?. status ) . toEqual ( {
15931589 status : "connected" ,
15941590 } )
15951591
1596- yield * service . add (
1597- "dynamic" ,
1598- new ConfigMCP . Local ( {
1599- type : "local" ,
1600- command : [ process . execPath , path . join ( import . meta. dir , "fixture/mcp-output-schema.ts" ) ] ,
1601- disabled : true ,
1602- } ) ,
1603- )
1592+ yield * service . add ( "dynamic" , new ConfigMCP . Remote ( { ...config , disabled : true } ) )
16041593 expect ( ( yield * service . servers ( ) ) . find ( ( server ) => server . name === "dynamic" ) ?. status ) . toEqual ( {
16051594 status : "disabled" ,
16061595 } )
@@ -1628,11 +1617,7 @@ test("adds, disconnects, and reconnects MCP servers at runtime", async () => {
16281617 } ) . pipe (
16291618 Effect . provide (
16301619 resourceMcpLayer (
1631- new ConfigMCP . Local ( {
1632- type : "local" ,
1633- command : [ process . execPath , path . join ( import . meta. dir , "fixture/mcp-output-schema.ts" ) ] ,
1634- disabled : true ,
1635- } ) ,
1620+ new ConfigMCP . Local ( { type : "local" , command : [ "unused" ] , disabled : true } ) ,
16361621 undefined ,
16371622 undefined ,
16381623 { published } ,
@@ -1719,22 +1704,20 @@ testEffect(resourceMcpLayer(new ConfigMCP.Local({ type: "local", command: ["unus
17191704 ( ) =>
17201705 Effect . gen ( function * ( ) {
17211706 const service = yield * Mcp . Service
1707+ const server = yield * resourceServer ( { modern : true , resources : false } )
17221708
17231709 yield * Effect . scoped (
17241710 Effect . gen ( function * ( ) {
17251711 yield * service . transform ( ( editor ) => {
1726- editor . set ( "dynamic" , {
1727- type : "local" ,
1728- command : [ process . execPath , path . join ( import . meta. dir , "fixture/mcp-output-schema.ts" ) ] ,
1729- } )
1712+ editor . set ( "dynamic" , { type : "remote" , url : server . url , oauth : false , protocol : "2026-07-28" } )
17301713 } )
17311714 expect ( ( yield * service . servers ( ) ) . find ( ( server ) => server . name === "dynamic" ) ?. status . status ) . toBe (
17321715 "connected" ,
17331716 )
1734- expect ( yield * service . tools ( ) ) . toHaveLength ( 2 )
1717+ expect ( yield * service . tools ( ) ) . toHaveLength ( 1 )
17351718
17361719 yield * service . transform ( ( editor ) => editor . update ( "dynamic" , ( server ) => ( server . codemode = false ) ) )
1737- expect ( ( yield * service . tools ( ) ) . map ( ( tool ) => tool . codemode ) ) . toEqual ( [ false , false ] )
1720+ expect ( ( yield * service . tools ( ) ) . map ( ( tool ) => tool . codemode ) ) . toEqual ( [ false ] )
17381721
17391722 const settings = { disabled : true }
17401723 yield * service . transform ( ( editor ) => {
@@ -1750,7 +1733,7 @@ testEffect(resourceMcpLayer(new ConfigMCP.Local({ type: "local", command: ["unus
17501733 expect ( ( yield * service . servers ( ) ) . find ( ( server ) => server . name === "dynamic" ) ?. status . status ) . toBe (
17511734 "connected" ,
17521735 )
1753- expect ( yield * service . tools ( ) ) . toHaveLength ( 2 )
1736+ expect ( yield * service . tools ( ) ) . toHaveLength ( 1 )
17541737
17551738 const removed = yield * service . transform ( ( editor ) => editor . remove ( "dynamic" ) )
17561739 expect ( ( yield * service . servers ( ) ) . some ( ( server ) => server . name === "dynamic" ) ) . toBe ( false )
@@ -1760,7 +1743,7 @@ testEffect(resourceMcpLayer(new ConfigMCP.Local({ type: "local", command: ["unus
17601743 expect ( ( yield * service . servers ( ) ) . find ( ( server ) => server . name === "dynamic" ) ?. status . status ) . toBe (
17611744 "connected" ,
17621745 )
1763- expect ( yield * service . tools ( ) ) . toHaveLength ( 2 )
1746+ expect ( yield * service . tools ( ) ) . toHaveLength ( 1 )
17641747 } ) ,
17651748 )
17661749
@@ -2088,6 +2071,7 @@ test("serializes concurrent MCP lifecycle operations", async () => {
20882071 await Effect . runPromise (
20892072 Effect . scoped (
20902073 Effect . gen ( function * ( ) {
2074+ const server = yield * resourceServer ( { modern : true , resources : false } )
20912075 yield * Effect . gen ( function * ( ) {
20922076 const service = yield * Mcp . Service
20932077
@@ -2116,9 +2100,11 @@ test("serializes concurrent MCP lifecycle operations", async () => {
21162100 } ) . pipe (
21172101 Effect . provide (
21182102 resourceMcpLayer (
2119- new ConfigMCP . Local ( {
2120- type : "local" ,
2121- command : [ process . execPath , path . join ( import . meta. dir , "fixture/mcp-output-schema.ts" ) ] ,
2103+ new ConfigMCP . Remote ( {
2104+ type : "remote" ,
2105+ url : server . url ,
2106+ oauth : false ,
2107+ protocol : "2026-07-28" ,
21222108 disabled : true ,
21232109 } ) ,
21242110 ) ,
0 commit comments