Echo MCP

Echo MCP

A lightweight server that enables AI agents to emit and validate structured messages through MCP tool call returns. It facilitates reliable programmatic consumption of agent outputs by echoing validated payloads against predefined schemas.

Category
访问服务器

README

Echo MCP

A lightweight MCP (Model Context Protocol) server that enables Agents to emit structured messages through MCP tool call returns.

TypeScript MCP License

English | 中文


Table of Contents


Background

In existing Agent systems, Agents typically communicate intermediate states, stage information, report outlines, and structured results only through natural language text. This creates several challenges:

  1. Clients struggle to extract specific structured data reliably
  2. Same-type data lacks unified schema and validation
  3. Business applications must extend SDKs or protocol layers to consume these messages
  4. Programmatic consumption of Agent outputs is unreliable with just natural language or loose JSON

Echo MCP solves this problem by providing a mechanism to carry structured messages via MCP tool call returns — without modifying the underlying ACP/SDK protocols.


What is Echo MCP

Echo MCP is a structured message carrier and validation toolkit that provides three core capabilities:

  1. Built-in Schema Config — Maintain available schemas through a server-side config file
  2. Schema Discovery — Query available built-in schemas
  3. Echo/Emit — Receive payloads, validate against specified schemas, and return unchanged

What Echo MCP IS NOT

  • ❌ A business workflow engine
  • ❌ An event bus
  • ❌ A rendering layer protocol
  • ❌ A permission management system
  • ❌ A state management framework

It only provides low-level capabilities without business-layer restrictions.


Key Design Decisions

1. MCP Tool Return as Message Carrier

Echo MCP's output is the MCP tool call return value.

  • No dependency on side-effect stream items
  • No additional protocol extensions required for clients
  • Clients only need to observe tool returns

2. Input Schema = Output Schema

Echo MCP receives valid payloads and returns them unchanged:

  • Input schema = Output schema
  • No payload transformation, normalization, or field injection
  • "Echo" means exact reproduction

3. Config-Driven Built-ins

  • Clients cannot register new schemas at runtime
  • Built-in schemas are maintained in config/builtin-schemas.json
  • The same built-in schema set is available to all sessions

4. No Schema Versioning

If a schema changes, use a new schema ID. No explicit version fields or migration mechanisms.

5. Built-in Schemaless Mode

A built-in __schemaless__ schema ID allows unvalidated structured output:

  • Useful for quick experiments, debugging, or coarse-grained structured output
  • Request envelope is still validated

6. Append Semantics (Not Update)

Echo MCP is designed for appending new structured messages, not updating previous ones.

If your business needs "updates", include identifiers in the payload (e.g., entity_id, sequence, revision) and let the client fold multiple append messages into the "current state".

7. Validation: JSON Schema (External) + Zod (Internal)

  • External schema expression: JSON Schema (for discovery, exchange, cross-language compatibility)
  • Internal runtime validation: Zod (for TypeScript/Node.js execution efficiency)

8. Structured Error Responses

All errors return machine-readable error codes with detailed field-level information:

{
  "ok": false,
  "error": {
    "code": "SCHEMA_VALIDATION_FAILED",
    "message": "Payload does not conform to schema...",
    "schema_id": "zenlix-agent-stage-v1",
    "details": [
      { "path": "/stage", "message": "must be string" }
    ]
  }
}

Quick Start (By Skill)

npx skills add https://github.com/ZenlixAI/echo-mcp --skill echo

Quick Start

Installation

# Clone the repository
git clone https://github.com/zenlix/echo-mcp.git
cd echo-mcp

# Install dependencies (requires pnpm)
pnpm install

Development Mode

pnpm dev

The server runs on http://localhost:3000 by default.

Open http://localhost:3000/inspector in your browser to test the server interactively.

Build for Production

pnpm build

Run Tests

pnpm test

Deploy

pnpm deploy

API Reference

Echo MCP exposes 3 MCP tools:

list_schemas

List all built-in schemas (including built-in __schemaless__).

Input: {}

Output:

{
  "schemas": [
    { "schema_id": "__schemaless__", "description": "...", "builtin": true },
    { "schema_id": "zenlix-agent-stage-v1", "description": "...", "builtin": true }
  ]
}

get_schema

Fetch the full definition of a specific schema.

Input: {"schema_id": "zenlix-agent-stage-v1"}

Output: Schema details including the full JSON Schema definition.

echo

Validate a payload against a schema and return it unchanged.

Input:

{
  "schema_id": "zenlix-agent-stage-v1",
  "payload": {
    "stage": "authentication",
    "stage_status": "start",
    "next_stage": "authorization",
    "extra": {
      "user_id": "u_123"
    }
  }
}

Output:

{
  "ok": true,
  "schema_id": "zenlix-agent-stage-v1",
  "payload": {
    "stage": "authentication",
    "stage_status": "start",
    "next_stage": "authorization",
    "extra": {
      "user_id": "u_123"
    }
  }
}

Examples

Example 1: Workflow Stage Notifications

zenlix-agent-stage-v1 is defined in config/builtin-schemas.json.

Emit stage updates:

{
  "schema_id": "zenlix-agent-stage-v1",
  "payload": {
    "stage": "authentication",
    "stage_status": "running",
    "next_stage": "authorization",
    "extra": {
      "user_id": "u_123",
      "user_name": "Alice"
    }
  }
}

Example 2: Minimal Stage Event

{
  "schema_id": "zenlix-agent-stage-v1",
  "payload": {
    "stage": "authorization"
  }
}

Example 3: Schemaless Output (Quick Debug)

{
  "schema_id": "__schemaless__",
  "payload": {
    "kind": "debug_snapshot",
    "raw": { "step": "retrieval_done", "hits": 12 }
  }
}

Project Structure

zenlix-echo-mcp/
├── index.ts              # Process entry point
├── config/
│   └── builtin-schemas.json # Built-in schema configuration
├── src/
│   ├── server.ts         # MCP server assembly and tool registration
│   ├── echo-service.ts   # Built-in schema discovery and echo protocol behavior
│   ├── builtin-schema-config.ts # Built-in schema config loader
│   └── json-schema-zod.ts # JSON Schema to Zod conversion
├── tests/
│   └── echo-service.test.ts  # Protocol and behavior tests
├── docs/
│   └── design-doc.md     # Comprehensive design documentation
├── AGENTS.md             # AI agent navigation guide
└── package.json

Documentation

  • Design Document — Comprehensive product and technical design
  • AGENTS.md — AI agent development guide for this repository

License

MIT © ZenlixAI

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选