# App Hub and Code Mode

Connect one six-tool MCP endpoint (mcp.ferrite.cloud/apps) to discover, inspect, call, and compose tools across all of your private and shared Ferrite applications inside a sandboxed QuickJS worker.

Connecting twenty separate MCP servers to an assistant creates two immediate problems: every server requires its own OAuth registration, and loading hundreds of tool schemas into the model's context window degrades latency and accuracy on every turn. Ferrite's **App Hub** (`https://mcp.ferrite.cloud/apps`) solves both by aggregating every deployed application a person or group is authorized to use behind a single OAuth-protected MCP `2026-07-28` endpoint with six fixed tools and sandboxed **Code Mode** execution.

## Connect through Claude, any MCP client, or the CLI

In Claude (web, desktop, mobile, Cowork, or Claude Code) or any OAuth-capable MCP client, connect the **Ferrite Apps** endpoint:

```text
https://mcp.ferrite.cloud/apps
```

On a Claude Team or Enterprise workspace, an administrator can enable Auto-connect once so every permitted member reaches their group's private apps without individual OAuth sign-in prompts; see [Internal apps in Claude](/developers/claude-internal-apps/) and [Enterprise-managed authorization](/developers/enterprise-managed-authorization/).

From a terminal, sign in to the App Hub with RFC 8628 Device Flow and inspect or invoke your applications directly:

```bash
ferrite mcp login --apps
ferrite apps list
ferrite apps search "invoice"
ferrite apps describe crm.lookup_account ledger.recent_invoices
```

During consent, you can scope the connection to specific `account/app` names, limit access to read-only operations, and toggle Code Mode execution. Permissions can be edited or revoked at any time under **Connected agents** in the Dashboard.

## The six App Hub tools

Whether your workspace runs two applications or fifty, the assistant sees the same six tools:

| Tool | Purpose |
| --- | --- |
| `apps_list` | List deployed applications the signed-in caller is permitted to reach (pass `refresh` to reload) |
| `search` | Search tools and skills across accessible apps by `query`, `app`, `read_only_only`, and `limit` |
| `describe` | Fetch full JSON input schemas for 1 to 10 qualified tool names (`app.tool`) |
| `call` | Invoke a single application tool with caller identity propagation and optional `idempotency_key` |
| `execute` | Run an async JavaScript function body inside a one-shot isolated QuickJS worker that chains multiple `await apps[app][tool](args)` calls on the server |
| `resume` | Check or retrieve the outcome of a pending human write approval (`approval_id`) or durable async task (`task_id`) |

The App Hub also indexes applications that expose an OpenAPI catalogue (`/.well-known/api-catalog`) alongside applications that expose `/mcp`, and surfaces application skills and tasks over the same endpoint.

## Combine multiple apps in one Code Mode script

Instead of shuttling large intermediate payloads through the model's context window across multiple turns, `execute` runs a short async JavaScript body in an isolated worker and returns only the filtered result:

```js filename="briefing.js"
const customer = await apps.crm.lookup_account({ domain: "acme.example" })
if (!customer) return { found: false }

const { invoices } = await apps.ledger.recent_invoices({
  account_id: customer.id,
  limit: 10,
})
const overdue = invoices.filter((inv) => inv.status === "overdue")
return {
  found: true,
  account: customer.name,
  overdue_count: overdue.length,
  total_cents: overdue.reduce((sum, inv) => sum + inv.amount_cents, 0),
}
```

Run the same script from the CLI with `ferrite apps execute "$(cat briefing.js)"`, or use bracket notation (`apps["team/billing-api"]["recent-invoices"]({ ... })`) when an app or tool name contains a slash or hyphen.

## Security boundary and execution limits

The App Hub separates app usage from platform administration: Hub tokens (`mcp.ferrite.cloud/apps`) occupy zero account bearer slots and are rejected by every build, deploy, secret, and administrative route on `mcp.ferrite.cloud/mcp`.

Each `execute` invocation runs inside a fresh OS-isolated QuickJS worker (`rquickjs`) with no network socket, no host filesystem, and no ambient environment variables. Every `apps[app][tool](...)` call crosses a bounded RPC channel back to the Hub, which re-verifies the caller's live group membership and app access policy on every call.

| Limit | Enforcement |
| --- | --- |
| Script size | 16 KiB maximum JavaScript body |
| Memory and stack | 48 MiB worker memory limit, 512 KiB maximum JS stack |
| Execution deadline | 5 seconds total per run; up to 3 seconds per downstream app call |
| Tool calls per run | 20 calls maximum, executed sequentially (including inside `Promise.all`) |
| Message size | 128 KiB per RPC message between worker and Hub (tool replies and final return value) |
| Rate and concurrency | 60 calls per minute per connection by default; 1 active run per connection |

Inside a script, failed calls throw an error with a structured `error.code` (`unknown_tool`, `invalid_arguments`, `access_denied`, `rate_limited`, `timeout`, or `app_error`). Effects from earlier calls in the script persist if a later call fails.

## Idempotent writes and human approval

- **Supply an `idempotency_key` on writes.** Both `call` and `execute` accept an `idempotency_key` (`--idempotency-key` in the CLI). Each write is bound to the exact deployment generation, tool name, and arguments; in `execute`, keys are derived deterministically by call position, so keep the script and arguments unchanged on retry.
- **24-hour result retention.** Completed write results are retained for 24 hours from the first attempt. Retries after expiry return `result_expired` while continuing to suppress duplicate writes for the lifetime of that connection.
- **Human write approvals.** When a policy requires owner approval before a write runs, `call` or `execute` returns an `approval_id`. After the owner approves or rejects the request in the Dashboard, pass that `approval_id` to `resume` to retrieve the result.

## Make a private app accept Hub assertions

For each admitted request, the App Hub sends a short-lived signed assertion addressed specifically to the target application. Verify it in your application with the `auth` package's `Auth::caller_for` helper and enforce explicit scopes:

- `apps:discover` to list tools and schemas
- `apps:read` for read-only tools
- `apps:write` for mutating tools

Because both read and write MCP tools arrive as `POST /mcp`, call `agent_ready::catalog::hub_scope(&surface, &req.body)` to resolve the required scope for the specific tool named in the JSON-RPC body before applying your application's own role and ownership checks.

## Next steps

- Roll out private internal apps across a Claude Team or Enterprise organization in [Internal apps in Claude](/developers/claude-internal-apps/).
- Build the MCP servers that App Hub indexes in [MCP Servers](/developers/mcp-servers/).
- Add governed third-party API access inside your apps with [Governed outbound connectors](/developers/governed-connectors/).
