Introduction¶
DeepSeek Harness (DSH) extends its capabilities through a plugin mechanism. In particular, dsh-mcp-client globally registers the tools installed from MCP servers at the deployment scope. When numerous MCP servers are installed, every request must process the schema definitions for all tools. This creates fixed overhead and produces a large tool list, making it difficult for the model to choose the correct tool among many options.
dsh-mcp-loader is designed to address this issue. It introduces a loader tool for each multi-tool MCP server, and the real tools enter the model context only when the loader is invoked. This removes the fixed cost of tool schemas in every request and keeps the visible tool list concise.
Plugin Overview¶
- Name:
mikotomywife/dsh-mcp-loader - Maintainer: MikotoMyWife
- Positioning: A lazy-loading plugin for DSH MCP tools, supporting per-session masking and description engineering.
- License: MIT
- Core Value: Reduce token consumption, optimize the tool list, and improve the model’s selection efficiency in multi-MCP-server scenarios.
Core Features¶
The plugin provides the following capabilities:
-
Per-server loader toggle
Each multi-tool server is represented by a single loader tool (namedmcp_<server>by default). Invoking the loader can load, hide, or reload the real tools. The loading state is isolated per session: loading in one session is not visible to other sessions. -
Operating modes
auto: At startup, it checks the number of server tools once; servers with fewer tools than the threshold (singleToolThreshold) are kept resident, while others are registered behind a loader.lazy: Servers are always hidden behind a loader and loaded only when invoked; no probing is performed at startup.eager: Servers are kept resident and the loader is not used.
-
Per-agent tool masking (
hiddenTools)
After a server is loaded, specific tools can be masked. Masking is implemented usingrestrict({ deny })and supports exact names, public names (such asmcp__notes__*), and wildcards (such ase*,?). Masking only affects visibility; tools remain globally registered. -
Globally disabled tools (
disabledTools)
Matching tools are discarded directly at the registration layer, making them invisible to any agent. Wildcard rules are also supported. -
Description engineering
It supports description overrides per server or per tool, as well as truncation of parameter descriptions (maxParameterDescriptionChars). Theinstructionssent by a server are presented as attribution text in the loading result, instead of permanently occupying tokens in the loader description. -
Environment cleanup and resource bridging
- The child-process environment removes credential-like keys (such as
/KEY|PASSWORD|SECRET|TOKEN) andDSH_*facts, while preserving environment variables such asPATHandNPM_CONFIG_*. - An optional Resource Bridge is supported, exposing resources from loaded servers to the Harness resource service.
- The child-process environment removes credential-like keys (such as
-
Fault tolerance and boundaries
- Atomic registration: on failure, roll back to zero tools.
- Hard limits:
maxToolListPages,maxToolsPerServer, anddiscoveryTimeoutMsare enforced; loading that times out or exceeds the limits fails, while the loader remains available. - Ordered resynchronization: prevents concurrent loading from causing stale data to overwrite newer data.
Installation and Build¶
The plugin depends on a Node.js environment and @modelcontextprotocol/client 2.0.0.
- Clone the repository and install dependencies:
npm install
- Compile the code:
npm run build
- Configure the plugin:
Based on the configuration inpackage.json, the plugin is mounted viacordis.patch.yml.
Typical Usage¶
The workflow is as follows:
- Initial state: The tool list shows only loader tools (for example,
mcp_notes,mcp_browser). - First invocation: The model calls
mcp_notes({}). The system returnsokand exposes the real tools in the current session and its sub-agents (for example,mcp__notes__search). - Second invocation: The model calls
mcp_notes({})again. The system returnsok (N tool(s) hidden), hiding the real tools. - Third invocation: The model calls
mcp_notes({}). The system reloads and exposes the real tools.
For single-tool servers (those with a tool count below the threshold), the server is kept resident at startup and does not go through the loader workflow above.
Notes¶
- Node version: The plugin requires Node.js
>=20. - Registration scope: Tool registration is at the deployment scope (global), consistent with the official
dsh-mcp-client.hiddenToolsfilters visibility per session on top of the global registration. - Session isolation: Visibility is per session. The loading state in one session does not affect other sessions.
- Single-tool threshold: Setting
singleToolThreshold: 0forces all servers to use the per-session loader mode. - Permission security: The plugin runs with the permissions of the current DSH process. Review the source code and license before installing.
Conclusion¶
dsh-mcp-loader addresses context bloat in DSH when integrating many MCP tools through lazy loading and per-session masking. It preserves global tool registration while optimizing the model’s usage experience through fine-grained visibility control.