MCP Async Server

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

MCP 异步服务器

🚀 高性能模型上下文协议 (MCP) 服务器实现,展示具有强大状态跟踪和错误处理的异步任务处理。


✨ 特点

  • 🔄异步任务处理- 高效处理长时间运行的操作
  • 📊实时状态跟踪- 通过轮询支持监控任务进度
  • 🧹自动资源管理- 智能任务清理和内存管理
  • ⏱️超时处理- 可配置任务超时
  • 🛡️强大的错误处理- 自定义错误类型和全面的错误报告
  • 📝 TypeScript 支持- 完整的类型安全性和现代 JavaScript 功能
  • 🔍内置检查器- 轻松调试和测试您的 MCP 服务器

🚀 快速入门

先决条件

  • Node.js 20.x 或更高版本
  • npm 9.x 或更高版本

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Async MCP Server:

npx -y @smithery/cli install @ViezeVingertjes/example-async-mcp --client claude

安装

# Clone the repository git clone https://github.com/ViezeVingertjes/example-async-mcp.git # Navigate to the project directory cd example-async-mcp # Install dependencies npm install # Build the project npm run build

运行服务器

npm start

使用检查器

npm run inspector

📖 API 参考

可用工具

process_task

创建一个新的异步任务。

{ "name": "process_task", "arguments": { "input": "Hello, World!", "delayMs": 5000, "timeoutMs": 30000 } }
范围类型必需的默认描述
输入细绳-要处理的输入字符串
延迟毫秒数字5000处理延迟(以毫秒为单位)
超时毫秒数字30000任务超时(以毫秒为单位)

check_task_status

检查现有任务的状态。

{ "name": "check_task_status", "arguments": { "taskId": "550e8400-e29b-41d4-a716-446655440000" } }
范围类型必需的描述
任务编号细绳要检查的任务的ID

任务状态

地位描述
🕒 pending任务已创建但尚未开始
processing任务正在处理中
complete任务已成功完成
error任务失败

⚙️ 配置

src/constants.ts中的关键配置选项:

export const DEFAULT_TASK_TIMEOUT_MS = 30000; // 30 seconds export const DEFAULT_TASK_DELAY_MS = 5000; // 5 seconds export const DEFAULT_POLL_DELAY_MS = 10000; // 10 seconds export const POLL_INTERVAL_MS = 100; // 100ms export const MAX_TASKS = 1000; // Maximum concurrent tasks

🛠️ 开发

项目结构

src/ ├── index.ts # Main server implementation ├── types.ts # TypeScript types and interfaces ├── constants.ts # Configuration constants └── utils.ts # Utility functions

开发命令

# Build the project npm run build # Watch for changes npm run watch # Run tests npm test # Run inspector npm run inspector

📝 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。


-
security - not tested
A
license - permissive license
-
quality - not tested

该服务器实现模型上下文协议 (MCP) 来处理异步任务,具有实时状态跟踪、强大的错误处理和自动资源管理功能。

  1. ✨ Features
    1. 🚀 Quick Start
      1. Prerequisites
      2. Installing via Smithery
      3. Installation
      4. Running the Server
      5. Using the Inspector
    2. 📖 API Reference
      1. Available Tools
      2. Task States
    3. ⚙️ Configuration
      1. 🛠️ Development
        1. Project Structure
        2. Development Commands
      2. 📝 License
        ID: k2os9maqr0