Hardening an MCP Server: Five Engineering Priorities, from DeepSeek Super-Agent

The real engineering priorities are:

  1. A deletion that cannot happen by accident.
  2. A result that can be reproduced and replayed.
  3. A write operation that cannot be applied twice by accident.
  4. An artifact whose complete provenance can be reconstructed.
  5. A system that captures its own misses and learns from them — without relying on an agent’s memory.

Here is what I need to amend in the MCP server I built, borrowing the Super-Agent’s code-level approach rather than relying on agent instructions alone:

Authorization enforced in code. Require explicit target confirmation for destructive calls, and bind the execution scope to the work being performed — restricting both data access and data manipulation to that scope.

Fully traceable artifact provenance. Extend artifact metadata to capture the source tool and operation, the full input parameters used in the call, the git commit and version of the code that ran, the execution timestamp, and the relevant context. Is that too much to do? The Super-Agent’s mandate says no: every artifact should be traceable to the exact process that produced it.

Idempotency keys for write operations, so a retried or repeated call can never apply the same write twice.

One consistent job structure and status format. Callers should learn a single contract, instead of adapting to different conventions for each tool.

The server captures its own failures and misses. It should not rely on agents to remember logs and failed operations; the learning loop belongs to the system itself.

FYI the structure of deepseek super agent

dsh-superagent-prototype/
├── docs/ # numbered design docs — the real specification
│ ├── 000-philosophy.md “take as little human attention as possible”
│ ├── 001-domain.md Source·Trigger·Thread·Eval·Mandate·Ticket·Assignment·Subscription
│ ├── 002-authorization.md gate, admission tables, accept modes
│ ├── 003-execution.md stages, worker slots, concurrency, recovery
│ ├── 004–006 prompts / panel / deployment
│ ├── 007-architecture.md 70KB: classes, dependency rules, persistence
│ └── 008-cookbook.md how to add a new Source
├── prompts/ # the agents themselves are plain markdown
│ ├── orchestrator.md + dispatch.md the Router: assess & route, never code
│ ├── admission.md judging proactive candidates
│ └── worker.md + work.md the Worker: own the ticket, verify, report
├── skills/ # github / feishu know-how packs the agents load
└── src/
├── core/ # deterministic domain Engine — no LLM in here
│ # engine.ts is one transactional entry coordinating
│ # Intake · Evals · Tickets · Assignments · Replies
├── policy.ts # allowed lists, admission table, accept mode (off/observe/auto)
├── sources/ # intake adapters: github.ts (polls the notifications API),
│ # feishu*.ts, poll.ts (cursors + dedupe)
├── executor/ # dsh.ts (biggest file): worker session lifecycle on Harness
├── app/ # runtime glue: store, sessions, delivery/outbox, panel API
└── client/ # React web panel — lists only what needs a person

Scalable Agent Workflow

  • Batch order intake: Absorb multiple orders at once through event-driven intake.
  • 14-day thread polling: Continue polling threads for 14 days after their last activity to capture follow-ups.
  • Two-level filtering: Level 1 uses cheap, deterministic code rules; Level 2 uses an AI model only when needed.
  • Explicit authorization: Represent authorization as a structured, verifiable object, not a vague instruction or agent assumption.
  • Four routing verbs: Standardize routing through four consistent operations.
  • One ticket, one worker: Isolate each ticket in its own worker.
  • Asynchronous execution: Keep workers independent and non-blocking.
  • Free follow-up routing: Use subscriptions to automatically capture and route subsequent updates.
  • Dependency-based ticket stages: Classify ticket status by what it is waiting for (authorization, user input, execution, external response, etc.).
  • Exactly-once acknowledgment: Acknowledge each logical request once.
  • Honest simulations: Disclose assumptions, limitations, and uncertainty; never overstate precision.

Leave a Reply