# mcp.server.serverFromEnvironment

**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#L187
- **Page:** https://libtmux.org/en/ts/latest/mcp/reference/mcp-server-serverfromenvironment/

```
function serverFromEnvironment(
  environment: Readonly<
    Record<string, string | undefined>
  > = process.env,
): Server
```

The tmux server this process was pointed at.

An MCP client launches this with an environment and a command line, and
nothing else, so the environment is the only place a socket can come from.
The library itself never reads these — a library that picks up ambient
configuration is a library that surprises its caller — which is why the
reading happens out here, at the edge that has a process to belong to.

## Parameters

- `environment` (`Readonly<Record<string, string | undefined>>`)
  Default: `process.env`.

## Guides

Pages that discuss `serverFromEnvironment`.

- [TypeScript MCP API](/en/ts/latest/mcp/reference/)
