PROMPT 01 Connection Scaffold
# Implementation Prompt 01: Connection GenStatem Scaffold
**Goal:** Create the `McpClient.Connection` module skeleton with data structure, callback mode, and init function. No state logic yet.
**Test Strategy:** Basic compilation and initialization tests pass. All tests green, no warnings.
---
## Context: What You're Building
You're implementing the core Connection module for an MCP (Model Context Protocol) client library in Elixir. This module uses OTP's `gen_statem` behavior to manage connection lifecycle through explicit states.
---
## Complete Specification
### States (from STATE_TRANSITIONS.md)
The state machine has 5 states:
| State | Description |
|-------|-------------|
| `:starting` | Initial state; spawning/attaching transport |
| `:initializing` | MCP initialize handshake in progress; initialize request sent |
| `:ready` | Normal operation; can process requests |
| `:backoff` | Exponential backoff; reconnection scheduled; transport inactive |
| `:closing` | Graceful shutdown in progress; no new operations accepted |
### Data Structure (from ADR-0003 and STATE_TRANSITIONS.md)when to use it
Community prompt sourced from the open-source GitHub repo nshkrdotcom/mcp_client (MIT). A "PROMPT 01 Connection Scaffold" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
businesscommunitygeneral
source
nshkrdotcom/mcp_client · MIT