11import { AssistantConfig } from "@continuedev/sdk" ;
2- import { describe , it , expect , beforeEach , afterEach , vi } from "vitest" ;
2+ import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
33
44import { MCPService } from "./MCPService.js" ;
55
@@ -21,6 +21,14 @@ vi.mock("@modelcontextprotocol/sdk/client/stdio.js", () => ({
2121 StdioClientTransport : vi . fn ( ) ,
2222} ) ) ;
2323
24+ vi . mock ( "@modelcontextprotocol/sdk/client/sse.js" , ( ) => ( {
25+ SSEClientTransport : vi . fn ( ) ,
26+ } ) ) ;
27+
28+ vi . mock ( "@modelcontextprotocol/sdk/client/streamableHttp.js" , ( ) => ( {
29+ StreamableHTTPClientTransport : vi . fn ( ) ,
30+ } ) ) ;
31+
2432describe ( "MCPService" , ( ) => {
2533 let mcpService : MCPService ;
2634 let mockAssistant : AssistantConfig ;
@@ -152,4 +160,56 @@ describe("MCPService", () => {
152160 await expect ( mcpService . cleanup ( ) ) . resolves . not . toThrow ( ) ;
153161 } ) ;
154162 } ) ;
163+
164+ describe ( "transport types" , ( ) => {
165+ it ( "should support SSE transport" , async ( ) => {
166+ const sseAssistant : AssistantConfig = {
167+ name : "sse-assistant" ,
168+ version : "1.0.0" ,
169+ mcpServers : [
170+ {
171+ name : "sse-server" ,
172+ type : "sse" ,
173+ url : "https://example.com/sse" ,
174+ } ,
175+ ] ,
176+ } as AssistantConfig ;
177+
178+ await expect ( mcpService . initialize ( sseAssistant ) ) . resolves . not . toThrow ( ) ;
179+ } ) ;
180+
181+ it ( "should support streamable-http transport" , async ( ) => {
182+ const httpAssistant : AssistantConfig = {
183+ name : "http-assistant" ,
184+ version : "1.0.0" ,
185+ mcpServers : [
186+ {
187+ name : "http-server" ,
188+ type : "streamable-http" ,
189+ url : "https://example.com/http" ,
190+ } ,
191+ ] ,
192+ } as AssistantConfig ;
193+
194+ await expect ( mcpService . initialize ( httpAssistant ) ) . resolves . not . toThrow ( ) ;
195+ } ) ;
196+
197+ it ( "should default to stdio transport when type is not specified" , async ( ) => {
198+ const defaultAssistant : AssistantConfig = {
199+ name : "default-assistant" ,
200+ version : "1.0.0" ,
201+ mcpServers : [
202+ {
203+ name : "default-server" ,
204+ command : "npx" ,
205+ args : [ "-v" ] ,
206+ } ,
207+ ] ,
208+ } as AssistantConfig ;
209+
210+ await expect (
211+ mcpService . initialize ( defaultAssistant ) ,
212+ ) . resolves . not . toThrow ( ) ;
213+ } ) ;
214+ } ) ;
155215} ) ;
0 commit comments