Skip to main content
Glama

DSH Plugin Toolkit

5-layer breakthrough infrastructure + plugin loop development pipeline. The core has zero runtime dependencies; the Bridge layer is built on the official @modelcontextprotocol/sdk.

Five-Layer Architecture (v2)

Layer

Directory

Description

L1 MCP Bridge

src/bridge/

Official MCP SDK McpServer.registerTool + StdioServerTransport, natively compatible with all MCP clients such as Claude/Cursor; server-lite.ts keeps the dependency-free handwritten version

L2 A2A Cards

src/a2a/

Aligned with Google A2A Protocol v1.0 spec; dsh a2a serve starts a real A2A Server based on the @a2a-js/sdk (JSON-RPC + REST, skill-level routing)

L3 Loop Engineering

src/loop/

6 validators + 3D heuristic self-critique + linear fallback retry (covered by unit tests)

L4 Cost Governance

src/cost/

Three-tier budget state machine OK→WARNING→CRITICAL→EXCEEDED, throws CostExceededError to block when exceeded

L5 Multi-Agent Demo

src/demo/、src/agents/

Deterministic orchestration with a seeded PRNG, 4-stage parallel scheduling

Plugin discovery uses a three-level fallback: complete cordis.yml → runtime-count-only (count-only) → source regex extraction (regex). All tools share a unified contract: MCP entry parameter { input_data: string }.

Related MCP server: JMT x402 MCP Server

Quick Start

npm install
npm run build          # 编译核心 + 全部插件

npx dsh list           # 列出发现的插件与工具
npm test               # 单元测试 (node:test, 9 cases)
npx dsh bridge         # 启动官方 SDK MCP stdio 服务器
npx dsh a2a gen        # 生成 a2a-cards/*.agent-card.json (A2A v1.0)
npx dsh a2a serve      # 启动真实 A2A v1.0 服务器 (:41241)
npx dsh llm models     # 列出本地 Ollama 模型(免费推理)
npx dsh llm ask "..."  # 本地 LLM 生成 + L3 验证循环
npx dsh demo carbon [--llm]  # L5 多Agent Demo(--llm 用本地 Ollama 真实合成)
npx dsh serve [port]   # REST 网关: POST /invoke,API-Key 计费 + 限流 (:8787)
npx dsh registry gen   # 市场目录: registry.json + index.html

Built-in Plugins (20)

Finance and accounting: invoice-calc / bank-loan-calc / invest-growth / salary-tax / fx-rates Data and development: csv-stats / json-format / regex-lab / codec-kit / text-diff / date-math Content and marketing: seo-audit / text-summary / readability / markdown-report Life tools: health-metrics / unit-convert / color-kit / pass-forge Vertical industries: carbon-baseline

Iterate-Develop New Plugins

npx dsh scaffold my-tool   # 生成 plugins/dsh-tool-my-tool/
npm run build              # 编译后即刻被 Bridge/A2A/Demo 发现
npx dsh list               # 验证

In the generated src/index.ts file, implement the handler: input input_data: string and return a string. If the output ends with a disclaimer, it will pass all validators.

Budget Configuration

Place dsh.budget.json in the project root:

{ "monthly": 5000000, "user": 200000, "plugin": 50000 }

If not configured, no limit is applied (usage is only tracked).

Release Paths

  • MCP Marketplace: After running npm pack, connect to MCP clients such as Claude Desktop / Cursor via the stdio method (entry dist/bridge/server.js, official SDK implementation). You can debug it with npx @modelcontextprotocol/inspector node dist/bridge/server.js.

  • Koishi Plugin Marketplace: Run npx dsh pack <plugin> to generate a publish-ready package that conforms to marketplace requirements (i.e., koishi-plugin-* naming, peerDependencies.koishi, and koishi metadata). Then run cd publish/<plugin> && npm publish to publish it.

  • A2A Registry: a2a-cards/ is directly compatible with the Google A2A v1.0 spec and can be consumed with the official @a2a-js/sdk ClientBuilder.

CI

.github/workflows/ci.yml: build → unit tests → discovery/A2A/pack smoke tests → MCP protocol smoke tests → deterministic validation.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers