@@ -780,6 +780,102 @@ async function runTests() {
780
780
"tools/list" ,
781
781
) ;
782
782
783
+ console . log (
784
+ `\n${ colors . YELLOW } === Running Default Server Tests ===${ colors . NC } ` ,
785
+ ) ;
786
+
787
+ // Create config with single server for auto-selection
788
+ const singleServerConfigPath = path . join ( TEMP_DIR , "single-server-config.json" ) ;
789
+ fs . writeFileSync (
790
+ singleServerConfigPath ,
791
+ JSON . stringify (
792
+ {
793
+ mcpServers : {
794
+ "only-server" : {
795
+ command : "npx" ,
796
+ args : [ "@modelcontextprotocol/server-everything" ] ,
797
+ } ,
798
+ } ,
799
+ } ,
800
+ null ,
801
+ 2 ,
802
+ ) ,
803
+ ) ;
804
+
805
+ // Create config with default-server
806
+ const defaultServerConfigPath = path . join ( TEMP_DIR , "default-server-config.json" ) ;
807
+ fs . writeFileSync (
808
+ defaultServerConfigPath ,
809
+ JSON . stringify (
810
+ {
811
+ mcpServers : {
812
+ "default-server" : {
813
+ command : "npx" ,
814
+ args : [ "@modelcontextprotocol/server-everything" ] ,
815
+ } ,
816
+ "other-server" : {
817
+ command : "node" ,
818
+ args : [ "other.js" ] ,
819
+ } ,
820
+ } ,
821
+ } ,
822
+ null ,
823
+ 2 ,
824
+ ) ,
825
+ ) ;
826
+
827
+ // Create config with multiple servers (no default)
828
+ const multiServerConfigPath = path . join ( TEMP_DIR , "multi-server-config.json" ) ;
829
+ fs . writeFileSync (
830
+ multiServerConfigPath ,
831
+ JSON . stringify (
832
+ {
833
+ mcpServers : {
834
+ "server1" : {
835
+ command : "npx" ,
836
+ args : [ "@modelcontextprotocol/server-everything" ] ,
837
+ } ,
838
+ "server2" : {
839
+ command : "node" ,
840
+ args : [ "other.js" ] ,
841
+ } ,
842
+ } ,
843
+ } ,
844
+ null ,
845
+ 2 ,
846
+ ) ,
847
+ ) ;
848
+
849
+ // Test 29: Config with single server auto-selection
850
+ await runBasicTest (
851
+ "single_server_auto_select" ,
852
+ "--config" ,
853
+ singleServerConfigPath ,
854
+ "--cli" ,
855
+ "--method" ,
856
+ "tools/list" ,
857
+ ) ;
858
+
859
+ // Test 30: Config with default-server auto-selection
860
+ await runBasicTest (
861
+ "default_server_auto_select" ,
862
+ "--config" ,
863
+ defaultServerConfigPath ,
864
+ "--cli" ,
865
+ "--method" ,
866
+ "tools/list" ,
867
+ ) ;
868
+
869
+ // Test 31: Config with multiple servers and no default (should fail)
870
+ await runErrorTest (
871
+ "multi_server_no_default" ,
872
+ "--config" ,
873
+ multiServerConfigPath ,
874
+ "--cli" ,
875
+ "--method" ,
876
+ "tools/list" ,
877
+ ) ;
878
+
783
879
console . log (
784
880
`\n${ colors . YELLOW } === Running HTTP Transport Tests ===${ colors . NC } ` ,
785
881
) ;
@@ -799,7 +895,7 @@ async function runTests() {
799
895
800
896
await new Promise ( ( resolve ) => setTimeout ( resolve , 3000 ) ) ;
801
897
802
- // Test 29 : HTTP transport inferred from URL ending with /mcp
898
+ // Test 32 : HTTP transport inferred from URL ending with /mcp
803
899
await runBasicTest (
804
900
"http_transport_inferred" ,
805
901
"http://127.0.0.1:3001/mcp" ,
@@ -808,7 +904,7 @@ async function runTests() {
808
904
"tools/list" ,
809
905
) ;
810
906
811
- // Test 30 : HTTP transport with explicit --transport http flag
907
+ // Test 33 : HTTP transport with explicit --transport http flag
812
908
await runBasicTest (
813
909
"http_transport_with_explicit_flag" ,
814
910
"http://127.0.0.1:3001/mcp" ,
@@ -819,7 +915,7 @@ async function runTests() {
819
915
"tools/list" ,
820
916
) ;
821
917
822
- // Test 31 : HTTP transport with suffix and --transport http flag
918
+ // Test 34 : HTTP transport with suffix and --transport http flag
823
919
await runBasicTest (
824
920
"http_transport_with_explicit_flag_and_suffix" ,
825
921
"http://127.0.0.1:3001/mcp" ,
@@ -830,7 +926,7 @@ async function runTests() {
830
926
"tools/list" ,
831
927
) ;
832
928
833
- // Test 32 : SSE transport given to HTTP server (should fail)
929
+ // Test 35 : SSE transport given to HTTP server (should fail)
834
930
await runErrorTest (
835
931
"sse_transport_given_to_http_server" ,
836
932
"http://127.0.0.1:3001" ,
@@ -841,7 +937,7 @@ async function runTests() {
841
937
"tools/list" ,
842
938
) ;
843
939
844
- // Test 33 : HTTP transport without URL (should fail)
940
+ // Test 36 : HTTP transport without URL (should fail)
845
941
await runErrorTest (
846
942
"http_transport_without_url" ,
847
943
"--transport" ,
@@ -851,7 +947,7 @@ async function runTests() {
851
947
"tools/list" ,
852
948
) ;
853
949
854
- // Test 34 : SSE transport without URL (should fail)
950
+ // Test 37 : SSE transport without URL (should fail)
855
951
await runErrorTest (
856
952
"sse_transport_without_url" ,
857
953
"--transport" ,
0 commit comments