# `Excessibility.MCP.ClientContext`
[🔗](https://github.com/lessthanseventy/excessibility/blob/v0.18.1/lib/excessibility/mcp/client_context.ex#L1)

Helpers for getting the MCP client's context (working directory, etc).

The MCP server runs from the excessibility project directory, but tools often
need to operate in the client's project directory. This module provides helpers
to determine the correct working directory.

The client's working directory is determined in this order:
1. `MCP_CLIENT_CWD` environment variable (set by the mcp-server wrapper script)
2. Explicit `cwd` parameter passed to the tool (for backward compatibility)
3. Current working directory (fallback)

# `client_path`

Builds a path relative to the client's working directory.

## Examples

    iex> ClientContext.client_path("test/excessibility/timeline.json")
    "/home/user/projects/my_app/test/excessibility/timeline.json"

# `cmd_opts`

Returns command options for System.cmd with the correct working directory.

## Examples

    iex> ClientContext.cmd_opts()
    [cd: "/home/user/projects/my_app"]

    iex> ClientContext.cmd_opts(stderr_to_stdout: true)
    [cd: "/home/user/projects/my_app", stderr_to_stdout: true]

# `get_cwd`

Gets the client's working directory.

## Options
  * `:cwd` - Explicit working directory override (for backward compatibility)

## Examples

    iex> ClientContext.get_cwd()
    "/home/user/projects/my_app"

    iex> ClientContext.get_cwd(cwd: "/custom/path")
    "/custom/path"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
