Skip to main content
Glama

MCP Async Server

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

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) 来处理异步任务,具有实时状态跟踪、强大的错误处理和自动资源管理功能。

  1. ✨ 特点
    1. 🚀 快速入门
      1. 先决条件
      2. 通过 Smithery 安装
      3. 安装
      4. 运行服务器
      5. 使用检查器
    2. 📖 API 参考
      1. 可用工具
      2. 任务状态
    3. ⚙️ 配置
      1. 🛠️ 开发
        1. 项目结构
        2. 开发命令
      2. 📝 许可证

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.
          Last updated -
          0
          4
          TypeScript
          MIT License
        • -
          security
          A
          license
          -
          quality
          MCP Server provides a simpler API to interact with the Model Context Protocol by allowing users to define custom tools and services to streamline workflows and processes.
          Last updated -
          2
          3
          TypeScript
          MIT License
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol (MCP) server that provides tools for managing todo items, including creation, updating, completion, deletion, searching, and summarizing tasks.
          Last updated -
          10
          22
          TypeScript
          MIT License
        • A
          security
          F
          license
          A
          quality
          A Model Context Protocol (MCP) server that provides a simple sleep/wait tool, useful for adding delays between operations such as waiting between API calls or testing eventually consistent systems.
          Last updated -
          1
          1
          14
          JavaScript

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/ViezeVingertjes/example-async-mcp'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server