Skip MCP era probe for Bailian-compatible connect.

Omit Client versionNegotiation so the SDK stays on legacy initialize; Bailian answers the 2026 server/discover probe with HTTP 500 and never reaches search.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-10-10 15:10:46 +08:00
parent 4b4a1e4460
commit ada788a236
3 changed files with 11 additions and 5 deletions

View file

@ -32,9 +32,12 @@ export async function callMcpSearch(server, key, args, signal) {
}
let runtime;
// Do not opt into MCP 2026 era negotiation. SDK default is legacy (plain
// 2025 initialize, no server/discover probe). Bailian/DashScope answers
// that probe with HTTP 500 and connect fails before any search call.
const client = new Client(
{ name: 'dsh-search-mcp', version: '0.2.41' },
{ capabilities: {}, versionNegotiation: { mode: 'auto' } },
{ name: 'dsh-search-mcp', version: '0.2.42' },
{ capabilities: {} },
);
try {
runtime = server.transport === 'stdio'

View file

@ -1,6 +1,6 @@
{
"name": "dsh-search-mcp",
"version": "0.2.41",
"version": "0.2.42",
"description": "Replace dsh's built-in web search with search MCP servers (Tavily / Brave / Exa / Perplexity / DuckDuckGo / custom), configured from the web Settings page. When this plugin is enabled the built-in DeepSeek search provider is disabled.",
"type": "module",
"main": "lib/index.js",

View file

@ -12,7 +12,7 @@ test('package exports resolve and peerDependencies stay open', async () => {
assert.equal(pkg.exports['.'], './lib/index.js')
assert.equal(pkg.exports['./client'], './lib/client.browser.js')
assert.equal(pkg.engines.node, '>=20')
assert.equal(pkg.version, '0.2.41')
assert.equal(pkg.version, '0.2.42')
assert.equal(pkg.dsh.client.immediately, false)
assert.equal(pkg.dependencies['@modelcontextprotocol/client'], '2.0.0')
assert.ok(!Object.hasOwn(pkg.dependencies, '@modelcontextprotocol/sdk'))
@ -99,7 +99,10 @@ test('HTTP transport inherits DSH proxy with env fallback and pins DNS on direct
assert.match(transport, /parseHttpEndpoint/)
assert.match(transport, /validateHttpEndpoint\(server\.url, \{ signal \}\)/)
assert.match(transport, /redirect: 'error'/)
assert.match(transport, /versionNegotiation:\s*\{\s*mode:\s*['"]auto['"]/)
// Bailian rejects the MCP 2026 era probe (HTTP 500); keep Client options
// at legacy default (capabilities only — no negotiation field).
assert.match(transport, /\{\s*capabilities:\s*\{\s*\}\s*\}/)
assert.doesNotMatch(transport, /mode:\s*['"]auto['"]/)
})
test('bundle inserts search-mcp without pinning web.searchProvider (Desktop 0.2 boot-safe)', async () => {