Call Desearch web search through MCP-Bridge

    Call Desearch web search through MCP-Bridge

    Tested 17 November 2026.

    For developers evaluating MCP-Bridge's direct tool API. This example configures its native stdio MCP client, discovers Desearch tools and invokes web-search through the bridge's REST endpoint. It requires no model call or LLM account.

    Tested version: MCP-Bridge 0.5.1 at commit df1dcc58cac7bf2a4ead5f5630eb970f42999c57, with its committed uv.lock, MCP SDK 1.7.1 and Desearch MCP server 0.3.3. The upstream README describes MCP-Bridge as soft deprecated; assess its maintenance status before adopting it.

    Before you begin

    Use Node.js 24.16.0, Python 3.11.15 and uv 0.12.1. These examples were tested on macOS with Apple Silicon on 17 November 2026. You need a Desearch API key with available credits, and network access to the npm and Python package registries and Desearch. Set DESEARCH_API_KEY in your shell using your secret manager before running the example. Keep it out of source files.

    Desearch API requests use your account credits. Check Desearch pricing for current rates. This example calls the web-search tool once. Search titles and links can change between runs.

    Keep the accompanying assets folder beside this guide. Run the commands in that directory. The package lock fixes Desearch MCP server 0.3.3 and its npm dependencies. The Python lock fixes the tested dependency set.

    Download the assets

    Save these files in an assets folder in your working directory, keeping the paths shown:

    Install the pinned dependencies

    bash
    mkdir -p server configs vendor cp assets/desearch-mcp-server/package.json server/package.json cp assets/desearch-mcp-server/package-lock.json server/package-lock.json cp assets/mcpbridge.json configs/mcpbridge.json npm ci --prefix server git clone https://github.com/SecretiveShell/MCP-Bridge.git vendor/MCP-Bridge git -C vendor/MCP-Bridge checkout df1dcc58cac7bf2a4ead5f5630eb970f42999c57 uv sync --project vendor/MCP-Bridge --python 3.11.15 --frozen --no-dev

    The accompanying configuration contains environment placeholders. The example supplies the resolved server path, your Desearch key and a random local bridge key in the child environment. It binds the bridge to loopback and disables telemetry. No credentials are written into the configuration file.

    Run a search

    Save this as mcpbridge_search.py in the same directory:

    python
    import json,os,secrets,signal,subprocess,time from pathlib import Path import httpx root=Path.cwd() master=secrets.token_urlsafe(32) env=dict(os.environ,MCP_BRIDGE__CONFIG__FILE=str(root/'configs/mcpbridge.json'),MCPBRIDGE_LOCAL_KEY=master,DESEARCH_MCP_PATH=str(root/'server/node_modules/desearch-mcp-server/build/index.js')) gateway=subprocess.Popen([str(root/'vendor/MCP-Bridge/.venv/bin/python'),'-m','mcp_bridge.main'],env=env,stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL,start_new_session=True) try: with httpx.Client(timeout=60,headers={'Authorization':'Bearer '+master}) as client: for _ in range(300): if gateway.poll() is not None:raise RuntimeError('MCP-Bridge exited before readiness') try: listed=client.get('http://127.0.0.1:19970/mcp/tools') if listed.status_code==200:break except httpx.ConnectError:pass time.sleep(.1) else:raise RuntimeError('MCP-Bridge readiness timeout') assert any(t['name']=='web-search' for t in listed.json()['desearch']['tools']) unauth=httpx.get('http://127.0.0.1:19970/mcp/tools',timeout=10) assert unauth.status_code in (401,403),unauth.status_code result=client.post('http://127.0.0.1:19970/mcp/tools/web-search/call',json={'query':'Python official documentation'}) result.raise_for_status();body=result.json();assert not body.get('isError'),body payload=json.loads(next(c['text'] for c in body['content'] if c['type']=='text')) first=payload['data'][0];assert first['title'] and first['link'] print(json.dumps({'unauthenticated_tools_status':unauth.status_code,'title':first['title'],'link':first['link']},indent=2)) finally: try:os.killpg(gateway.pid,signal.SIGTERM) except ProcessLookupError:pass gateway.wait(timeout=15)

    Run with DESEARCH_API_KEY already set by your secret manager:

    bash
    vendor/MCP-Bridge/.venv/bin/python mcpbridge_search.py

    Success prints unauthenticated_tools_status: 401 and a nonempty title and link. The test returned Our Documentation | Python.org and a Desearch redirect path beginning /go/v1/. Results and redirect tokens can change. The example stops the bridge process group, including its stdio MCP child, after the call.

    Troubleshooting

    Use an unused loopback port 19970. This fixture uses POSIX process groups and was tested on macOS; its cleanup code requires adaptation on Windows.

    Keep ${DESEARCH_API_KEY}, ${DESEARCH_MCP_PATH} and ${MCPBRIDGE_LOCAL_KEY} as literal placeholders in the configuration file. MCP-Bridge resolves them from the environment. Its API key protects the bridge endpoint; your Desearch key authorizes the upstream search. Missing bridge authentication returned HTTP 401. Successful tool discovery alone does not prove upstream API access. Check the Desearch key and account balance if the tool reports authentication or credit errors.

    This guide calls /mcp/tools/web-search/call with the tool arguments as the request body. It does not test the bridge's chat-completion or sampling features, which require a tool-capable inference service.

    Official references