# mcp.Instance

- **Module:** mcp
- **Package:** github.com/libtmux/libtmux-go/mcp
- **Language:** Go
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-go/blob/52968a3181c1c9e6d1b26c565d4b170968ae61c0/mcp/instance.go#L30
- **Page:** https://libtmux.org/en/go/latest/mcp/reference/mcp-instance/

Instance owns the SDK server, all connected client sessions, and every resource allocated on their behalf. The SDK server is composed so Connect and Run cannot bypass lifecycle tracking.

## Members

- `Connect` (method): Connect starts and tracks one client session. It requires tmux 3.2a or newer and rejects an opaque transport unless [AssumeResponseCommit] marks its response-write contract. Incoming messages remain gated until the SDK session has an installed scope.
- `Run` (method): Run serves one tracked session until the client, context, or instance ends. Its transport requirements are the same as [Instance.Connect].
- `Close` (method): Close starts shutdown and waits on a bounded internal context.
- `CloseContext` (method): CloseContext starts shutdown unconditionally. ctx bounds only this call's wait; a later call can resume waiting for the same shutdown.
