dsh-mcp-progressive: Progressive Disclosure and Server Control for MCP Tools

Preface

In DeepSeek Harness (DSH), each remote tool exposes a tool entry (mcp__<server>__<tool>) to the model, and every request re-sends the full schema set. Multiple feature-rich MCP servers can consume tens of thousands of tokens in a single turn—even when never actually invoked. Progressive disclosure is a common design pattern: load only the relevant schemas on demand and keep the rest hidden. dsh-mcp-progressive brings this idea to DSH’s MCP tool management and adds an “MCP Servers” control tab for starting, stopping, and restarting servers.

Overview

  • Name: dsh-mcp-progressive
  • Maintainer: xiuerhuahuazi
  • Positioning: A client-side plugin for DeepSeek Harness that reduces model context consumption by applying progressive disclosure to MCP tool schemas, while providing runtime control over MCP servers.
  • Core value: Without altering MCP connections or global tool registration, it adjusts the “view layer” tool list, loads tool definitions on demand, and enables direct MCP server management within DSH.

Core Features

1. Progressive Disclosure of Tool Schemas

  • Tool hiding operates at the registration view level, not in the prompt: through per-agent scope restriction (agent.ctx.tools.restrict({ deny })), unloaded schemas are removed from schemas(agent) (the list read by the prompt provider) as well as from get/executable, so they neither enter the prompt nor can be directly invoked.
  • Tool loading re-registers definitions within the current agent scope, making them visible. The deny list is only rebuilt when the catalog changes (server connect/disconnect); load/unload actions are what actually rewrite the tool array in the request.
  • The plugin uses the global registry as its catalog source and only manages tools mounted at the global scope; tools mounted at the agent or preset scope are not part of the global catalog (see Limitations).

2. Meta-Tool Set (Default: manageServers enabled)

The plugin enables manageServers by default, providing five meta-tools:

  • mcp_search: Searches the hidden catalog for tools. Supports lookup by full name, single-line summary, and parameter signature. detail: "full" prints compact input schemas for up to two tools (total budget ~6000 characters). Supports OR-style matching: a single matching term is sufficient, preventing all related tools from being missed due to typos. Includes a built-in Simplified Chinese→English mapping table (e.g., “浏览器”→browser, “截图”→screenshot/capture, “b站”→bilibili, etc.), and supports case-insensitive server filtering. Empty results are distinguished into three cases: no catalog, server filter matched no servers, or query matched nothing—facilitating recovery.
  • mcp_load: Makes selected tools “native tools” starting from the next turn. unload: true unloads a tool. When called without arguments, lists currently loaded tools. For “reserved” tools, it honestly reports two states: loaded and native (directly callable), or loaded but invisible (possibly a shadow registration failure—suggests using unload:true then reloading).
  • mcp_call: Directly executes a hidden tool through the normal tool pipeline without requiring prior loading. Calls go through ctx.tools.execute, performing the full pre-execution flow (guards, policies, approvals, timeouts). Returns the MCP server’s own error text and preserves audit information (result includes (audit: dispatched <tool>; argument keys: …)). Does not emit session events, avoiding orphan tool messages; PTC rejection results are detectable.
  • mcp_servers: Lists all configured MCP servers with their runtime status (running/stopped/connecting with no tools/starting/stopping/error/unknown, etc.). Provides real-time status lines and diagnostic information.
  • mcp_server: Performs start, stop, or restart on a single MCP server (requires approval flow). Used in conjunction with the mcp_servers tab.

3. MCP Server Control Tab

  • In DSH’s “Plugins → MCP Servers” tab, each MCP server is displayed as a card:
  • Status label (running/stopped/connecting with no tools/starting/stopping/error/unknown)
  • Transport method and target address
  • Tool count
  • Real-time detail line and startup diagnostics when a connection has content
  • Restart button and host-switch toggle
  • Status and details preferentially read from the “live connection state” (Live MCP client cell), e.g., during reconnection it shows attempt budget and next retry time; credential blocking is explicitly indicated; on failure, the failure reason and last error are displayed.
  • For “stopped/stopping” rows, if the Host returns a statusDetail, it is shown in the detail line but does not inherit stale live-connection failure information.
  • For “starting” rows (including connecting/reconnecting/waiting for credentials/starting with no live connection), control buttons are disabled with the prompt “Stop or restart after startup completes” (Chinese prompt). This prevents premature termination within the version-negotiation spawn window, which could cause process group anomalies.
  • The plugin does not affect the loader behavior of @deepseek-ai/dsh-mcp-client: unused servers can be fully disconnected (their child processes exit) without uninstalling this plugin.

4. Input Signatures and Return Information

  • Input signature length is capped at 200 characters. detail: "full" prints compact JSON schemas for at most two tools under a ~6000-character total budget (comments removed; only type/enum/required fields retained). If even the compact form cannot fit, the output shows the signature, required parameter names, and schema omitted: too large (N chars)—no truncated JSON documents will appear.
  • For guessed but unavailable mcp__* calls, a correction hint is returned, distinguishing between “not loaded in this conversation” and “currently not in the MCP catalog.”
  • mcp_load status reporting works in coordination with the tools/pre-execute handler to avoid confusion from calling-then-loading within the same step.

5. Load State and Scope

  • Load state is tracked per “live agent” with in-memory storage, keyed by Agent object identity (WeakMap), so two agents that once shared an id do not share the same mask. A Harness restart resets load state.
  • eagerTools sets the baseline for the root conversation: sub-agents with origin: "subagent" or a positive delegationDepth start with an empty load set; agents lacking session metadata are treated as root.

Installation and Activation

This plugin is published via npm and must be enabled in DSH after installation. The install command is:

npm install dsh-mcp-progressive

After installation, enable the plugin from DSH’s plugin management page. The plugin will automatically inject the meta-tools and the MCP Servers control tab.

Typical Usage

  • Search and load a tool:
    1. Use mcp_search in conversation to search for tools, e.g., mcp_search: "bilibili".
    2. Once the target tool is confirmed from the results, use mcp_load: { tool: "mcp__bilibili__search" } to load it as a native tool.
    3. Subsequently call the tool directly without going through mcp_call again.
  • One-off call of a hidden tool:
    1. Use mcp_search to find the target tool.
    2. Use mcp_call: { tool: "mcp__bilibili__search", args: { ... } } to execute directly without loading.
  • Manage servers:
    1. Open the “Plugins → MCP Servers” tab to view all server statuses.
    2. For servers that fail to start or become unresponsive, click “Restart” or switch hosts and start again.

Use Cases and Notes

  • Suitable for scenarios where multiple MCP servers are integrated in DSH and model context size needs to be controlled.
  • The plugin runs with the current DSH process permissions; it is recommended to review the source code and license (MIT) before installing.
  • The plugin depends on @deepseek-ai/dsh-mcp-client; ensure your DSH version meets the requirement (dsh >= 0.2.2-rc.1 < 0.3.0-0).
  • Tools mounted only at the agent or preset scope are not included in the global catalog and therefore cannot be managed by this plugin (they must be loaded manually within their respective scopes).

Summary

dsh-mcp-progressive, without altering the underlying MCP connections or global tool registration, reduces model context consumption through view-layer restriction and on-demand loading, and provides visual start/stop/restart capabilities for MCP servers. For DSH users who need to manage multiple MCP servers, it is a practical plugin that balances performance with observability.

  • Plugin directory: https://www.skillhub.cn/plugins/xiuerhuahuazi/dsh-mcp-progressive
  • GitHub: https://github.com/xiuerhuahuazi/dsh-mcp-progressive
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye