MCP Async Server

MCP Async Server

๐Ÿš€ A high-performance Model Context Protocol (MCP) server implementation showcasing asynchronous task processing with robust status tracking and error handling.

<p align="center"> <em>Built with TypeScript โ€ข Powered by Node.js โ€ข MCP Protocol</em> </p>

โœจ Features

  • ๐Ÿ”„ Asynchronous Task Processing - Handle long-running operations efficiently
  • ๐Ÿ“Š Real-time Status Tracking - Monitor task progress with polling support
  • ๐Ÿงน Automatic Resource Management - Smart task cleanup and memory management
  • โฑ๏ธ Timeout Handling - Configurable timeouts for tasks
  • ๐Ÿ›ก๏ธ Robust Error Handling - Custom error types and comprehensive error reporting
  • ๐Ÿ“ TypeScript Support - Full type safety and modern JavaScript features
  • ๐Ÿ” Built-in Inspector - Debug and test your MCP server with ease

<a href="https://glama.ai/mcp/servers/k2os9maqr0"><img width="380" height="200" src="https://glama.ai/mcp/servers/k2os9maqr0/badge" alt="Async Server MCP server" /></a>

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 20.x or higher
  • npm 9.x or higher

Installing via Smithery

To install Async MCP Server for Claude Desktop automatically via Smithery:

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

Installation

# 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

Running the Server

npm start

Using the Inspector

npm run inspector

๐Ÿ“– API Reference

Available Tools

process_task

Creates a new asynchronous task.

{ "name": "process_task", "arguments": { "input": "Hello, World!", "delayMs": 5000, "timeoutMs": 30000 } }
ParameterTypeRequiredDefaultDescription
inputstringโœ…-The input string to process
delayMsnumberโŒ5000Processing delay in milliseconds
timeoutMsnumberโŒ30000Task timeout in milliseconds

check_task_status

Check the status of an existing task.

{ "name": "check_task_status", "arguments": { "taskId": "550e8400-e29b-41d4-a716-446655440000" } }
ParameterTypeRequiredDescription
taskIdstringโœ…The ID of the task to check

Task States

StatusDescription
๐Ÿ•’ pendingTask created but not started
โšก processingTask is being processed
โœ… completeTask completed successfully
โŒ errorTask failed

โš™๏ธ Configuration

Key configuration options in 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

๐Ÿ› ๏ธ Development

Project Structure

src/ โ”œโ”€โ”€ index.ts # Main server implementation โ”œโ”€โ”€ types.ts # TypeScript types and interfaces โ”œโ”€โ”€ constants.ts # Configuration constants โ””โ”€โ”€ utils.ts # Utility functions

Development Commands

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

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


<p align="center"> Made with โค๏ธ by the MCP community </p>

You must be authenticated.

A
security โ€“ no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

This server implements the Model Context Protocol (MCP) to handle asynchronous tasks with real-time status tracking, robust error handling, and automatic resource management.

  1. โœจ Features
    1. ๐Ÿš€ Quick Start
      1. Prerequisites
        1. Installing via Smithery
          1. Installation
            1. Running the Server
              1. Using the Inspector
              2. ๐Ÿ“– API Reference
                1. Available Tools
                  1. process_task
                    1. check_task_status
                    2. Task States
                    3. โš™๏ธ Configuration
                      1. ๐Ÿ› ๏ธ Development
                        1. Project Structure
                          1. Development Commands
                          2. ๐Ÿ“ License