Skip to content

Commit 70ff539

Browse files
authored
improvement(mcp): ditch custom mcp client in favor of mcp sdk (#1780)
1 parent 6cd82f0 commit 70ff539

File tree

13 files changed

+154
-1250
lines changed

13 files changed

+154
-1250
lines changed

apps/sim/app/api/mcp/servers/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const dynamic = 'force-dynamic'
1717
* Check if transport type requires a URL
1818
*/
1919
function isUrlBasedTransport(transport: McpTransport): boolean {
20-
return transport === 'http' || transport === 'sse' || transport === 'streamable-http'
20+
return transport === 'streamable-http'
2121
}
2222

2323
/**

apps/sim/app/api/mcp/servers/test-connection/route.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ export const dynamic = 'force-dynamic'
1313

1414
/**
1515
* Check if transport type requires a URL
16+
* All modern MCP connections use Streamable HTTP which requires a URL
1617
*/
1718
function isUrlBasedTransport(transport: McpTransport): boolean {
18-
return transport === 'http' || transport === 'sse' || transport === 'streamable-http'
19+
return transport === 'streamable-http'
1920
}
2021

2122
/**
@@ -151,16 +152,21 @@ export const POST = withMcpAuth('write')(
151152
client = new McpClient(testConfig, testSecurityPolicy)
152153
await client.connect()
153154

154-
result.success = true
155155
result.negotiatedVersion = client.getNegotiatedVersion()
156156

157157
try {
158158
const tools = await client.listTools()
159159
result.toolCount = tools.length
160+
result.success = true
160161
} catch (toolError) {
161-
logger.warn(`[${requestId}] Could not list tools from test server:`, toolError)
162+
logger.warn(`[${requestId}] Connection established but could not list tools:`, toolError)
163+
result.success = false
164+
const errorMessage = toolError instanceof Error ? toolError.message : 'Unknown error'
165+
result.error = `Connection established but could not list tools: ${errorMessage}`
162166
result.warnings = result.warnings || []
163-
result.warnings.push('Could not list tools from server')
167+
result.warnings.push(
168+
'Server connected but tool listing failed - connection may be incomplete'
169+
)
164170
}
165171

166172
const clientVersionInfo = McpClient.getVersionInfo()

0 commit comments

Comments
 (0)