mirror of
https://github.com/hansjone/dsh-search-mcp.git
synced 2026-10-12 04:00:45 +08:00
Migrate search-mcp to @modelcontextprotocol/client for Desktop 0.2.
Replace the removed monolith SDK import so link/Desktop hosts can resolve MCP from the 0.2 package graph instead of failing import with MODULE_NOT_FOUND. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
9d7de03933
commit
229a36d5f3
5 changed files with 99 additions and 1062 deletions
|
|
@ -1,7 +1,12 @@
|
|||
/** MCP transport layer for one search. */
|
||||
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
||||
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
||||
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
||||
/**
|
||||
* MCP transport layer for one search.
|
||||
*
|
||||
* Desktop 0.2 ships the split MCP client package (v2). Import that package so
|
||||
* link:/Desktop profiles can resolve it from the host graph without a local
|
||||
* `node_modules` copy of the legacy monolith SDK.
|
||||
*/
|
||||
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
|
||||
import { StdioClientTransport } from '@modelcontextprotocol/client/stdio';
|
||||
import { WebError } from '@deepseek-ai/dsh-web';
|
||||
import { Agent, fetch as undiciFetch } from 'undici';
|
||||
import { clampSearchResults } from './catalog.js';
|
||||
|
|
@ -17,7 +22,10 @@ export async function callMcpSearch(server, key, args, signal) {
|
|||
}
|
||||
|
||||
let runtime;
|
||||
const client = new Client({ name: 'dsh-search-mcp', version: '0.2.0' }, { capabilities: {} });
|
||||
const client = new Client(
|
||||
{ name: 'dsh-search-mcp', version: '0.2.39' },
|
||||
{ capabilities: {}, versionNegotiation: { mode: 'auto' } },
|
||||
);
|
||||
try {
|
||||
runtime = server.transport === 'stdio'
|
||||
? { transport: stdioTransport(server, key), close: async () => {} }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue