Call Desearch web search through ContextForge
Tested 17 November 2026.
For developers evaluating IBM ContextForge as a local MCP gateway. This example registers a pinned local Desearch MCP server, discovers the gateway's search tool and invokes it through ContextForge's JSON-RPC API.
Tested versions: mcp-contextforge-gateway 1.1.1 and Desearch MCP server 0.3.3. The local open-source path requires no hosted gateway account. Desearch API requests use your account credits.
Before you begin
Use Node.js 24.16.0, Python 3.12.13 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:
assets/contextforge.lockassets/desearch-mcp-server/package-lock.jsonassets/desearch-mcp-server/package.json
Install the pinned dependencies
This is a disposable local evaluation. It binds services to loopback, creates random gateway passwords and signing/encryption secrets in memory, and uses an in-memory SQLite database. The upstream key is registered with bearer authentication in that temporary database. No credentials are written into configuration files. Stopping the process removes its registration and gateway credentials.
The SQLite connection named keeper keeps the shared in-memory database alive while ContextForge's bootstrap opens and closes its own connections. Omitting it caused missing-table errors in this test. The fixture enables SSRF_ALLOW_LOCALHOST so the gateway can reach the local MCP server. Use the product's deployment documentation when configuring a persistent gateway.
Run a search
Save this as contextforge_search.py in the same directory:
Run with DESEARCH_API_KEY already set by your secret manager:
Success prints the discovered tool desearch-web-search, unauthenticated_tools_status: 401, and a nonempty title and link. The test returned Python 3.15.2 documentation and a Desearch redirect path beginning /go/v1/. Result content and redirect tokens can change. The example terminates both child processes after the call.
Troubleshooting
Keep loopback ports 19966 and 19969 free. Readiness failure means the local gateway did not become available; check the pinned lock and port availability before retrying.
ContextForge 1.1.1 validates its JWT secret, encryption secret and default/admin passwords at startup. Use the generated values in this example together. It authenticates through the local /auth/login endpoint and keeps its returned token in memory. admin@example.com is the gateway's documented local bootstrap username, not a hosted account signup.
The gateway prefixes the upstream tool name. Invoke the discovered desearch-web-search, not the upstream web-search name. Discovery alone does not validate a Desearch key: the upstream server permits discovery but returns HTTP 401 with isError: true for an unauthenticated tool call. For a rejected key or insufficient credits, check your Desearch key and account balance before retrying.