Skip to main content
Glama
deepseek-tool-search

deepseek-tool-search

by Lphal

@lphal/deepseek-tool-search

English | 中文

An npx-friendly DeepSeek MCP server exposing web_search and web_fetch to any MCP client.

The implementation follows DeepSeek Harness's web tool split:

  • The default path calls DeepSeek's dedicated Search API without an auxiliary model response.

  • web_fetch calls the DeepSeek Fetch API and returns page Markdown directly.

  • An optional Messages-compatible mode mirrors Harness's legacy web_search_20250305 server-tool flow.

  • Multi-query results are merged by source rank, deduplicated by URL, and bounded by the total result limit.

  • The server includes local 5 QPS pacing, request timeouts, response validation, and credential-safe errors.

  • All web content is labeled as untrusted data so webpage text is not treated as instructions.

Requires Node.js 20.19 or newer.

The development toolchain is pinned to pnpm@10.23.0 and typescript@6.0.3.

Installation

After publishing to npm, an MCP client can use:

{
  "mcpServers": {
    "deepseek-search": {
      "command": "npx",
      "args": ["-y", "@lphal/deepseek-tool-search"],
      "env": {
        "DEEPSEEK_API_KEY": "sk-your-key"
      }
    }
  }
}

This is an MCP stdio configuration, not a DeepSeek REST URL for an HTTP/SSE endpoint. The MCP client starts the server through npx.

After publishing, register it with Codex CLI:

codex mcp add deepseek-search \
  --env DEEPSEEK_API_KEY="$DEEPSEEK_API_KEY" \
  -- npx -y @lphal/deepseek-tool-search

Use codex mcp list to inspect the configuration. --env writes the key into Codex's MCP configuration; use your client's preferred environment or secret-reference mechanism if local persistence is unsuitable.

Local development:

pnpm install
pnpm build
pnpm start -- --check
pnpm start

--check prints sanitized configuration without making network requests.

The working directory's .env is loaded automatically; .env.example documents the supported variables.

Related MCP server: AIE7-hw13-mcp

Tools

{
  "queries": ["DeepSeek API documentation", "DeepSeek web search API"],
  "count": 10,
  "original_question": "How do I connect the DeepSeek search API to MCP?"
}

count is the total number of sources after merging, from 1 to 50. When omitted, DEEPSEEK_SEARCH_COUNT is used.

web_fetch

{
  "url": "https://api-docs.deepseek.com/guides/search"
}

Configuration

Variable

Default

Purpose

DEEPSEEK_API_KEY

required

DeepSeek API key from the process environment or .env. It is used only in server request headers and is not written to tool results or logs.

DEEPSEEK_SEARCH_MODE

api

api uses the dedicated Search API; messages uses compatible Messages search.

DEEPSEEK_SEARCH_API_BASE_URL

https://api.deepseek.com/v1/tools

Search API base URL; the program appends /search.

DEEPSEEK_FETCH_API_BASE_URL

https://api.deepseek.com/v1/tools

Fetch API base URL; the program appends /fetch.

DEEPSEEK_MESSAGES_BASE_URL

https://api.deepseek.com/anthropic/v1

Messages-compatible base URL; the program appends /messages.

DEEPSEEK_SEARCH_MODEL

deepseek-v4-flash

Model used only by Messages mode.

DEEPSEEK_SEARCH_MAX_TOKENS

4096

Maximum output tokens for Messages mode.

DEEPSEEK_SEARCH_MAX_USES

5

Maximum server-tool searches in one Messages request.

DEEPSEEK_SEARCH_COUNT

10

Default total number of returned sources, from 1 to 50.

DEEPSEEK_MAX_QUERIES

10

Maximum queries per web_search call, from 1 to 20.

DEEPSEEK_SEARCH_REQUESTS_PER_SECOND

5

Per-process Search request pacing.

DEEPSEEK_HTTP_TIMEOUT_MS

30000

Timeout for one network request and any pacing wait.

DEEPSEEK_SEARCH_SUMMARY_MAX_CHARS

800

Character limit for each source summary.

DEEPSEEK_FETCH_MAX_OUTPUT_CHARS

200000

Output limit for one fetched page.

Custom proxy URLs must use http(s) and must not embed credentials. The API key must be a raw ASCII string without quotes, spaces, or newlines.

Harness Mapping

Harness

This project

web_search

MCP web_search

web_fetch

MCP web_fetch

web-deepseek-api.searchBaseURL

DEEPSEEK_SEARCH_API_BASE_URL

web-deepseek-api.fetchBaseURL

DEEPSEEK_FETCH_API_BASE_URL

web-search-deepseek.baseURL

DEEPSEEK_MESSAGES_BASE_URL

web-search-deepseek.model

DEEPSEEK_SEARCH_MODEL

web-search-deepseek.maxUses

DEEPSEEK_SEARCH_MAX_USES

Messages-compatible mode incurs the latency and token cost of a full model call for every search, making it slower and more expensive than the dedicated Search API. Use it only when a custom gateway does not provide /v1/tools/search.

Development

pnpm install
pnpm typecheck
pnpm test
pnpm test:live
pnpm pack

pnpm test uses local mocks. pnpm test:live calls the real DeepSeek Search and Fetch APIs and skips when DEEPSEEK_API_KEY is absent.

Available Tools

2 tools
web_fetchDeepSeek Web FetchB
Read-onlyIdempotent

Fetch a public web page through DeepSeek and return Markdown content. Intranet and loopback addresses are not reachable through this API.

Inputs: url (required). Returns: url, title, content, truncated

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 2 tools

    Disambiguation5/5

    web_search retrieves results from the live web while web_fetch retrieves the content of a specific URL; the descriptions make the search-then-fetch distinction unmistakable. There is no realistic scenario where an agent would confuse the two.

    Naming Consistency5/5

    Both names follow the same 'web_<verb>' pattern with parallel structure (search/fetch). Short, predictable, and immediately readable.

    Tool Count3/5

    Two tools is thin for the stated scope, though the pairing of search and fetch is a natural minimal set. It sits at the borderline of the 1-2 tool range flagged as under-scoped.

    Completeness4/5

    Search plus page fetch covers the core web-retrieval lifecycle with no dead ends for typical lookups. Minor gaps exist around pagination controls, multi-URL batch fetching, or result filtering, but agents can work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      B
      quality
      D
      maintenance
      MCP server using Tavily API for web search, enabling web search queries via stdio transport.
      5
      -
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that provides web search powered by DeepSeek's native search API, returning AI-generated answers with source links. Integrates with MCP-compatible clients like Claude Code and Cursor.
      1
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables MCP clients such as Claude Code to run real-time web searches and fetch public web pages as Markdown through DeepSeek's official search and fetch APIs, with result pagination and response caching. Runs over stdio and only requires a DeepSeek API key, needing no browser, Docker, or database.
      2
      1
      MIT