examples/servers/simple-task-interactive/README.md
A minimal MCP server demonstrating interactive tasks with elicitation and sampling.
cd examples/servers/simple-task-interactive
uv run mcp-simple-task-interactive
The server starts on http://localhost:8000/mcp by default. Use --port to change.
This server exposes two tools:
confirm_delete (demonstrates elicitation)Asks the user for confirmation before "deleting" a file.
task.elicit() to request user inputwrite_haiku (demonstrates sampling)Asks the LLM to write a haiku about a topic.
task.create_message() to request LLM completionIn one terminal, start the server:
cd examples/servers/simple-task-interactive
uv run mcp-simple-task-interactive
In another terminal, run the interactive client:
cd examples/clients/simple-task-interactive-client
uv run mcp-simple-task-interactive-client
When a client connects and calls the tools, you'll see:
Starting server on http://localhost:8000/mcp
[Server] confirm_delete called for 'important.txt'
[Server] Task created: <task-id>
[Server] Sending elicitation request to client...
[Server] Received elicitation response: action=accept, content={'confirm': True}
[Server] Completing task with result: Deleted 'important.txt'
[Server] write_haiku called for topic 'autumn leaves'
[Server] Task created: <task-id>
[Server] Sending sampling request to client...
[Server] Received sampling response: Cherry blossoms fall
Softly on the quiet pon...
[Server] Completing task with haiku
elicit() and create_message() for user interaction