Skip to main content
Glama
StevenBucher98

MCP RC Long-Running Task Prototype

README.md
# MCP RC Long-Running Task Prototype

Repository: https://github.com/StevenBucher98/mcp-rc-long-running-task-poc

Focused prototype for MCP `2026-07-28` behavior around:

- Long-running tool calls that return quickly with a task handle
- Task lifecycle methods: `tasks/get`, `tasks/update`, `tasks/cancel`
- Elicitation clarification while long-running work is still in progress

## What Is In Scope

The server intentionally exposes only two tools:

1. `start_report_task`
- Starts an async task and immediately returns `structuredContent.task.id`

2. `personalized_greeting`
- If name is not provided, returns `inputRequired` asking for a name
- Continue with `requestState` + `inputResponses.name` to get a random greeting

## Quick Start

Clone and run:

```bash
git clone https://github.com/StevenBucher98/mcp-rc-long-running-task-poc.git
cd mcp-rc-long-running-task-poc
npm install
npm run test:scenarios
```

Or, if you already have the repo locally:

```bash
npm install
npm run test:scenarios
```

The scenario runner builds and starts the server, runs the tests, prints UX-style and raw request/response output, then stops the server.

## Scenario Runner

```bash
npm run test:scenarios
```

This single command:

- builds the server
- starts the server
- runs both scenario suites
- prints UX-style and raw JSON-RPC request/response output
- stops the server when finished

What it verifies:

- Task lifecycle basics
  - create task via `tools/call` (`start_report_task`)
  - update progress via `tasks/update`
  - read status via `tasks/get`
  - cancel via `tasks/cancel`
- Long-running behavior
  - starts a long-running task (default `90000` ms)
  - confirms tool call returns quickly (non-blocking)
  - continues with other calls during execution (`personalized_greeting`, `tools/list`)
  - polls until completion and prints final result

## Optional Flags

```bash
node scripts/test-state-and-long-running.mjs \
  --long-duration-ms 90000 \
  --quick-threshold-ms 4000 \
  --wait-for-completion \
  --greeting-name Taylor
```

- `--long-duration-ms`: duration for long-running task
- `--quick-threshold-ms`: max acceptable create-call latency
- `--wait-for-completion`: wait until long-running task is complete (default behavior)
- `--no-wait-for-completion`: skip waiting at the end
- `--greeting-name <name>`: name used for greeting elicitation replay (if omitted and terminal is interactive, you will be prompted)

## Endpoints

- `POST /mcp`
- `GET /health`

## Share With Others

- Repo URL: https://github.com/StevenBucher98/mcp-rc-long-running-task-poc
- To run quickly: `npm install && npm run test:scenarios`

Maintenance

ActivitySlowing
ResponsivenessNo issues