# Swift MCP API

Source: https://libtmux.org/en/swift/latest/mcp/reference/

> Find Swift embedding types, typed tool authority, and the separate protocol catalog.

For MCP client requests, use the [tool reference](../tools/). This page
covers language APIs for embedding or extending the server.

[`LibTmuxMCP`](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Package.swift)
is a SwiftPM library product.
`libtmux-mcp` wraps it in a stdio executable. Public Swift types and
MCP wire operations have separate names and responsibilities.

## Swift embedding API

`TmuxTools(server:)` constructs a readonly tool surface.
`ToolAuthority` selects `Toolset` groups and named tool inclusions or
exclusions. `visibleDefinitions` reports the selection;
`call(ToolCall)` invokes an operation and returns structured data or
throws `ToolError`.

`MCPRequestHandler` and `MCPService` provide protocol composition.
`ServerConfiguration` parses the executable's environment and builds
its libtmux endpoint.

[Embedding contract](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmuxMCP/README.md)
and [configuration source](https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmuxMCP/Configuration.swift).

## MCP contract

The [tool reference](../tools/) describes the wire catalog and schemas.
Follow-up calls use opaque references returned by hierarchy discovery.

The static `tmux://capabilities` resource reports the startup-frozen
surface. Live state comes from inspect tools. The current surface has no
workflow prompts or dynamic resource templates.

The [Workspace builder API](../../workspace/reference/) owns workspace decoding
and construction; those operations are separate from the MCP catalog.

## API declarations

- [CallerIdentity](https://libtmux.org/en/swift/latest/mcp/reference/calleridentity/)
- [InputSink](https://libtmux.org/en/swift/latest/mcp/reference/inputsink/)
- [JSONValue](https://libtmux.org/en/swift/latest/mcp/reference/jsonvalue/)
- [MCPRequestHandler](https://libtmux.org/en/swift/latest/mcp/reference/mcprequesthandler/)
- [MCPService](https://libtmux.org/en/swift/latest/mcp/reference/mcpservice/)
- [OutputClass](https://libtmux.org/en/swift/latest/mcp/reference/outputclass/)
- [ProcessReach](https://libtmux.org/en/swift/latest/mcp/reference/processreach/)
- [ProgressReporter](https://libtmux.org/en/swift/latest/mcp/reference/progressreporter/)
- [ServerConfiguration](https://libtmux.org/en/swift/latest/mcp/reference/serverconfiguration/)
- [ServerProvenance](https://libtmux.org/en/swift/latest/mcp/reference/serverprovenance/)
- [TmuxEffect](https://libtmux.org/en/swift/latest/mcp/reference/tmuxeffect/)
- [TmuxFormatControl](https://libtmux.org/en/swift/latest/mcp/reference/tmuxformatcontrol/)
- [TmuxTools](https://libtmux.org/en/swift/latest/mcp/reference/tmuxtools/)
- [ToolAnnotations](https://libtmux.org/en/swift/latest/mcp/reference/toolannotations/)
- [ToolArgument](https://libtmux.org/en/swift/latest/mcp/reference/toolargument/)
- [ToolAuthority](https://libtmux.org/en/swift/latest/mcp/reference/toolauthority/)
- [ToolCall](https://libtmux.org/en/swift/latest/mcp/reference/toolcall/)
- [ToolDefinition](https://libtmux.org/en/swift/latest/mcp/reference/tooldefinition/)
- [ToolError](https://libtmux.org/en/swift/latest/mcp/reference/toolerror/)
- [ToolOperation](https://libtmux.org/en/swift/latest/mcp/reference/tooloperation/)
- [ToolOutcome](https://libtmux.org/en/swift/latest/mcp/reference/tooloutcome/)
- [Toolset](https://libtmux.org/en/swift/latest/mcp/reference/toolset/)

[Protocol catalog](https://libtmux.org/en/swift/latest/mcp/tools.json)
