---
name: viable-mcp
description: How to use @owlmeans/viable-mcp — the MCP CLI server a coding agent drives the OwlMeans Viable platform with, an edition of @owlmeans/viable-mcp-core — what its edition fixes (every flag, both targets and both inference modes, the token from the environment or ~/.owlmeans, the agent-setup tools, no profile, model tasks delivered), its unchanged public API and wire identity, `url` printing the /mcp address, the account inference preference, and what each mode offers. Auto-invoked when changing the viable-mcp package, its configuration, its sign-in or startup behaviour, or diagnosing a manual setup against /mcp or the npx server.
user-invocable: false
---
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->

# @owlmeans/viable-mcp

**Layer:** Tooling (CLI)
**Install:** nothing — a coding agent runs `npx -y @owlmeans/viable-mcp@^0.1.21`; bin name `viable-mcp`
**Closed-source** (this repo); `/closed-publishing` governs its manifest, README and tarball.

**An edition of [[viable-mcp-core]]** — the stdout guard, sign-in, the session holder, the
workspace scope, the inference preference and the server are the core's, and every tool is
`@owlmeans/viable-sdk`'s. The package holds `edition.ts` (`viableMcpEdition`), its constants,
`version.ts`, `config.ts`, `server.ts`, `capabilities.ts`, `index.ts` and `bin.ts`. Operator-facing
setup is the viable repo's `mcp.md`.

## What the edition fixes — and keeps exactly as every published version had it

This is the client production users run, so its behaviour is a contract: the only thing it adds over
the published releases is the header `x-viable-client: viable-mcp/<version>` on every request.

| Field | Value |
|---|---|
| `serverName` / `packageName` | `@owlmeans/viable-mcp` · log prefix `[viable-mcp]` |
| `client` | `ConnectClientKind.Mcp` (`viable-mcp`) — may act as the platform's inference |
| `credentials` | OAuth client `viable-mcp` ("Viable MCP"), `VIABLE_API_TOKEN` + `VIABLE_API_URL`, `fromEnvironment: true` |
| `flags` | `--api-url`, `--target`, `--llm`, `--harness`, `--project-dir`, `--http` |
| `targets` / `llms` | `local` (default) + `cloud` / `cloud` (provisional default) + `local` — the account's Connector preference decides when nothing names one |
| `extensions` | `harnessTools` (`describe_harness`, `install_harness`) from `@owlmeans/viable-harness` |
| `profile` | none — the SDK catalogue, instructions and results byte for byte |
| `modelTasks` | `true` — the delegated mode's task loop and handover |
| `hostedUrl` | none — `url` prints `resolveMcpUrl` (`VIABLE_MCP_URL`, environment over file, else `https://api.owlmeans.com/mcp`) |
| `identity` | `serverInfo.title` `OwlMeans`, a description, and two 128 × 128 PNG icons (light, dark) as data URIs (`src/edition/consts.ts`, the media pack's direct-MCP Juggler) — the tarball ships no image files |

A store or vendor need never changes this edition: it is a profile or a separate edition. Renaming
its OAuth client display name, its `~/.owlmeans` keys or its server name changes what a person
already consented to.

## Key Exports (the published API)

| Export | Description |
|--------|-------------|
| `makeViableMcpServer(cfg)` → `{ server, close }` | `makeMcpCoreServer(cfg, viableMcpEdition)` |
| `configHelper` — `.readConfig(argv, env)` (async) · `.parseArgs(argv)`; `HELP` | Flags over the merged environment + `~/.owlmeans` |
| `sessionCapabilities(cfg)` | The core's, bound to this edition |
| `viableMcpEdition` · `CLIENT_ID` (`viable-mcp`) · `DEFAULT_API_URL` · `DEFAULT_TARGET` (`local`) · `DEFAULT_LLM` (`cloud`) · `VERSION` | Constants; `VERSION` is READ from the package's own `package.json`, never a literal |
| `McpConfig`, `BuiltServer`, `HeldSession`, `ParsedArgs`, `SessionHolder` | Types, re-exported from the core |

## Credentials: the environment always wins

`readConfig` merges `~/.owlmeans` (moved by `OWLMEANS_CREDENTIALS`) under the process environment,
so an exported `VIABLE_API_TOKEN` (CI, a headless machine) is used as is and the browser never opens;
an EMPTY environment value is ignored, because a harness that expands an unset `${VIABLE_API_TOKEN:-}`
must not shadow the file. A refused environment token is reported (`VIABLE_API_TOKEN was refused`),
never replaced. The token is bound to the file's `VIABLE_API_URL` and only ever sent there.

`url` exists for `claude mcp add --transport http viable "$(npx -y @owlmeans/viable-mcp@^0.1.21 url)"`.

`VIABLE_API_URL` points the server at a self-hosted or development deployment's PUBLIC API origin —
path-less, `https://api-<web host>` for an OwlMeans Viable dev environment — never the web app's
`/api`. The device sign-in and `/oauth/revoke` run against the same origin, the token's issuer.

## Modes

`target=local` is the default, and inference follows the account's Connector preference unless
`--llm` or `VIABLE_LLM` (environment over file) names one (the core's provisional-cloud start).
Cloud inference: every model call is the platform's, billed to credits; no task loop. Local
inference: the session opens through the gated delegated route, `model` is advertised, the task
loop and the handover are on, and the SDK's request-now-collect-later transport names every write.

`--target cloud` keeps the tree and preview on the platform, so the catalogue offers the slot's file
tools, `preview_control`, the git and GitHub tools (the authorization completes in the person's
browser; the GitHub token is never answered), the production tools (`publish_production` with
`confirm: true`; never the client secret) and `file_changes` instead of the local run tools. Every
mode offers `list_slots`, the project settings and configuration, the organization's defaults, the
person's own records (no tool mints a token or gives a consent), the generated app's sign-in and the
cursor feeds. `describe_blueprints` is offered in every mode: it authenticates but opens no session,
spends nothing and bypasses the preference lookup.

## Tests

`bun test ./tests` — `edition.spec.ts` (names, client, credentials keys and OAuth client exactly as
published; every choice open; the default configuration; `model` only in the delegated mode),
`header.spec.ts` (the built bin sends `x-viable-client: viable-mcp/<manifest version>` with the
environment token, against the core's TLS fake platform), `stdio.spec.ts` (the built binary over a
real stdio transport against an unreachable API: what each mode announces, offline answers,
contained failures, nothing but JSON-RPC on stdout, `url`), `version.spec.ts`. They need
`build/bin.js` first. The shared parts' specs are the core's.

`inference.spec.ts` is gated by `VIABLE_TEST_API_URL` and `VIABLE_TEST_API_TOKEN`: a dedicated test
account on the explicitly named deployment, with the local-inference entitlement. It checks the
cloud/local preferences, the delegated session and flag/environment precedence, restores the
account's preference, creates no project and never reads the operator's credentials file.

## Depends On

- `@owlmeans/viable-mcp-core` — the server and the CLI
- `@owlmeans/viable-harness` — `harnessTools`, passed as the edition's extensions
- `@owlmeans/viable-sdk` · `@owlmeans/viable-common`

## Related

- [[viable-mcp-core]] — every rule about the stdio process
- [[viable-sdk]] — tools, deadlines, sessions and the local executor
- [[viable-harness]] — the agent-setup files and the single npx pin
- [[viable-claude]], [[viable-codex]] — the plugin editions beside it
