Skip to main content

DeepSeek Search Fetch MCP

English | 简体中文

An MCP server that exposes DeepSeek Search API and Fetch API as two tools for AI agents. AI agents can fetch the latest information from the web, filter results by site, language, and date, and then get content from specified websites in Markdown format, all without leaving the MCP workflow.

Python 3.11+ PyPI License: MIT

Features

  • Safe inputs: validate parameters before sending upstream requests
  • MCP over stdio: run directly with uvx and integrate with any MCP-compatible client
  • ds_web_search: search the current web through the DeepSeek Search API
  • ds_web_fetch: fetch public HTTP/HTTPS pages through the DeepSeek Fetch API

MCP Client Configuration

Prerequisites

  • Need to install uv
  • Python 3.11 or later
  • A DeepSeek API key

Minimal configuration

This template uses the API key only. The timeout and all Search env fall back to their defaults.

{
  "mcpServers": {
    "deepseek-search-fetch": {
      "command": "uvx",
      "args": ["deepseek-search-fetch-mcp"],
      "env": {
        "DEEPSEEK_API_KEY": "sk-**********"
      }
    }
  }
}

Full configuration

This template includes every supported environment variable. Optional values can be removed or changed for your search policy. For descriptions of each environment variable, see the Environment Variables section.

{
  "mcpServers": {
    "deepseek-search-fetch": {
      "command": "uvx",
      "args": ["deepseek-search-fetch-mcp"],
      "env": {
        "DEEPSEEK_API_KEY": "sk-**********",
        "DEEPSEEK_API_TIMEOUT": "30",
        "DEEPSEEK_SEARCH_COUNT": "20",
        "DEEPSEEK_SEARCH_LOCALIZATION": "18.8.8.8",
        "DEEPSEEK_SEARCH_NEED_CONTENT": "false",
        "DEEPSEEK_SEARCH_LANG": "zh,en",
        "DEEPSEEK_SEARCH_EXCLUDE_WORDS": "word1|word2",
        "DEEPSEEK_SEARCH_EXCLUDE_SITES": "csdn.net|baidu.com"
      }
    }
  }
}

DeepSeek Harness (DSH)

There is no need to use this MCP; DSH provides the built-in @deepseek-ai/dsh-web-search-deepseek plugin.

If you are using a third-party model, you need to add

DEEPSEEK_API_KEY=sk-********************

to the refs field in the $DSH_HOME/.credentials.yaml file and then restart DSH; this will enable the third-party model to use dsh-web-search-deepseek.

ChatGPT Desktop (Codex)

Zcode

Environment Variables

Variable Required Default Description
DEEPSEEK_API_KEY Yes - DeepSeek API key. It must match ^sk-[a-zA-Z0-9]+$
DEEPSEEK_API_TIMEOUT No 30 Request timeout in seconds. Must be greater than 0. Requests are not retried
DEEPSEEK_SEARCH_COUNT No 10 Default result count for ds_web_search, from 1 to 50. The tool parameter takes precedence
DEEPSEEK_SEARCH_LOCALIZATION No - Globally routable unicast IPv4 address passed to the Search API for result localization. Usually unnecessary
DEEPSEEK_SEARCH_NEED_CONTENT No - Whether the Search API should include page content in results. Accepts true, 1, false, or 0, case-insensitively. Not recommended because it can consume substantial context
DEEPSEEK_SEARCH_LANG No - Default language restriction as comma-separated ISO 639-1 codes, such as zh,en. The lang tool parameter takes precedence
DEEPSEEK_SEARCH_EXCLUDE_WORDS No - Global word blacklist separated by |. Each word is added as an excluded phrase and cannot contain double quotes or control characters. Not commonly used; use no more than 3 words because they consume the 128-character query limit
DEEPSEEK_SEARCH_EXCLUDE_SITES No - Global domain blacklist separated by |. Each entry must be a valid bare domain and is added as an excluded site. Use no more than 3 sites because they consume the 128-character query limit

Empty optional variables are ignored. A non-empty value is validated when the server starts, and invalid configuration causes the server to exit instead of accepting requests.

Tools

Tool Purpose
ds_web_search Find relevant pages with optional site, language, date, and result-count filters
ds_web_fetch Read a known public URL as agent-friendly content
Parameter Required Type Description
query Yes string Search terms. Up to 100 characters. Wrap a phrase in double quotes for an exact match
ori_question No string Original user question, up to 128 characters, used to clarify search intent
count No integer Number of results, from 1 to 50. Overrides DEEPSEEK_SEARCH_COUNT; otherwise the API default is 10
sites No string[] Restrict results to bare domains such as github.com. Do not include schemes, paths, or wildcards
lang No string[] Restrict results with ISO 639-1 codes such as ["zh", "en"]. An empty list disables the environment default for that call
after No date Include results after this YYYY-MM-DD date
before No date Include results before this YYYY-MM-DD date. after must not be later than before

The server converts sites, lang, after, before, and the configured exclusions into DeepSeek search syntax. The final query, including generated filters, must be no longer than 128 characters.

ds_web_fetch

Parameter Required Type Description
url Yes string Public HTTP or HTTPS URL, up to 8192 characters

The URL must have a host, must not contain credentials or whitespace, and must not target localhost, a private address, or another non-public IP address.

Usage

Ask your MCP client to search for current information:

Search GitHub and Hugging Face for recent MCP server examples, then fetch the most relevant page.

The client may call ds_web_search with:

{
  "query": "MCP server Python",
  "sites": ["github.com", "huggingface.co"],
  "lang": ["en"],
  "count": 15,
  "after": "2026-01-01"
}

It can then call ds_web_fetch with a selected result:

{
  "url": "https://github.com/modelcontextprotocol/python-sdk"
}

ds_web_search returns a results array containing fields such as title, url, summary, content, site_name, date, authority, and rerank_score. ds_web_fetch returns the page title and content.

Behavior and Validation

  • Tool parameters are validated before any DeepSeek API request is made
  • count and lang tool parameters override their server-level environment defaults
  • Passing lang: [] disables the configured language restriction for that search
  • Site, language, date, and exclusion filters are converted to DeepSeek search syntax
  • Only public HTTP/HTTPS URLs are accepted by ds_web_fetch
  • Upstream error status, code, and type are included in MCP tool errors when available

Development

Clone the repository and install the project environment:

git clone https://github.com/festoney8/DeepSeek-Search-Fetch-MCP.git
cd DeepSeek-Search-Fetch-MCP
uv sync

Run the local server:

DEEPSEEK_API_KEY="sk-**********" uv run deepseek-search-fetch-mcp

Run the project checks:

uvx ruff format .
uvx ruff check --fix .
uvx ty check --fix .

Project layout

src/deepseek_search_fetch_mcp/
├── main.py        # FastMCP server and tools
├── env.py         # Environment loading and validation
├── request.py     # Request validation and search syntax construction
├── utils.py       # Domain and language normalization
└── api/
    ├── api.py     # DeepSeek HTTP client
    └── models.py  # Request and response models
scripts/           # Testing scripts

Tech Stack

  • FastMCP for the MCP server and tool schemas
  • aiohttp for asynchronous DeepSeek API requests
  • Pydantic for typed configuration and validation
  • validators for URL and domain checks
  • iso639-lang for ISO 639-1 language validation

Documentation

Metadata

Release files for deepseek-search-fetch-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deepseek-search-fetch-mcp 0.1.1
File Size Uploaded Provenance
deepseek_search_fetch_mcp-0.1.1.tar.gz 12.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for deepseek-search-fetch-mcp 0.1.1
File Interpreter ABI Platform
deepseek_search_fetch_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / deepseek_search_fetch_mcp-0.1.1.tar.gz

Download URL deepseek_search_fetch_mcp-0.1.1.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c7be7bf8d84bf0e6516be31499584e2760dd5371fc2e188ecbf19af6647d5d81
BLAKE2b-256 checksum
How to use checksums
dd45daa951552999cc600b09f98f83415333b1539a567effe3384feb465cb80e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / deepseek_search_fetch_mcp-0.1.1-py3-none-any.whl

Download URL deepseek_search_fetch_mcp-0.1.1-py3-none-any.whl
Size 15.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16f1a795f01b220af7464a4bf2540c53b6598c3b38b139e60172c71f8ef77946
BLAKE2b-256 checksum
How to use checksums
3cfc8ce270ca6a5f7c0a1f2ef43ba07ca1bf6411bca1282391cb2a059f260d4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for deepseek-search-fetch-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page