# mcp.server.main

**MCP concept example** A working example of the core library. It can change without notice.

- **Module:** mcp.server
- **Package:** @libtmux/mcp
- **Language:** TypeScript
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ts/blob/46cccfef2a546de55ce8b308249b8c76339089a0/packages/mcp/src/server.ts#L233
- **Page:** https://libtmux.org/en/ts/latest/mcp/reference/mcp-server-main/

```
async function main(): Promise<void>
```

Serve until stdin or the protocol closes, then join the backend.

## tmux command

The tmux commands behind `main`.

- [`display-message`](/en/tmux/latest/manual/display-message/) (unless an explicit launch finds no server)
- [`list-sessions`](/en/tmux/latest/manual/list-sessions/) (an explicit launch)
- [`show-options`](/en/tmux/latest/manual/show-options/) (a minimal launch, no explicit selection)
- [`start-server`](/en/tmux/latest/manual/start-server/) (a minimal launch, no explicit selection)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_display_message_entry`](/en/tmux/latest/reference/c-variable-cmd_display_message_entry/) (attribute)
- [`cmd_display_message_exec`](/en/tmux/latest/reference/c-function-cmd-display-message-c-cmd_display_message_exec/) (function)
- [`cmd_list_sessions_entry`](/en/tmux/latest/reference/c-variable-cmd_list_sessions_entry/) (attribute)
- [`cmd_list_sessions_exec`](/en/tmux/latest/reference/c-function-cmd-list-sessions-c-cmd_list_sessions_exec/) (function)
- [`cmd_show_options_entry`](/en/tmux/latest/reference/c-variable-cmd_show_options_entry/) (attribute)
- [`cmd_show_options_exec`](/en/tmux/latest/reference/c-function-cmd-show-options-c-cmd_show_options_exec/) (function)
- [`cmd_start_server_entry`](/en/tmux/latest/reference/c-variable-cmd_start_server_entry/) (attribute)
- [`cmd_kill_server_exec`](/en/tmux/latest/reference/c-function-cmd-kill-server-c-cmd_kill_server_exec/) (function)
