# Build Claude-enabled apps

Build web and SaaS applications on Ferrite that work natively inside Claude across web, desktop, mobile, Cowork, and Claude Code, for both consumers and enterprise teams.

When you build a product on Ferrite, the same Rust application can serve a browser interface and act as a remote MCP connector inside Claude (claude.ai, Claude desktop, Claude mobile, Cowork, and Claude Code). You declare your operations once with `agent-ready`, protect user accounts with your own isolated OAuth 2.1 issuer via `poppy-oauth`, and optionally accept enterprise Auto-connect assertions so corporate customers can roll your app out to every employee in one click.

This guide is for builders shipping consumer or B2B SaaS products that connect directly to Claude. If you are deploying internal company tools for your own team, see [Internal company apps in Claude](/developers/claude-internal-apps/).

## Start from one operation declaration

Create a Ferrite web application and add the `agent-ready` package:

```bash
ferrite new webapp studio --with-tests
cd studio
ferrite add agent-ready
```

Expose your `/mcp` endpoint alongside your discovery files in `ferrite.json` above the static `/` route:

```json
{ "prefix": "/mcp", "binding": "requests", "kind": "api", "public": true },
{ "prefix": "/openapi.json", "binding": "requests", "kind": "api", "public": true },
{ "prefix": "/llms.txt", "binding": "requests", "kind": "api", "public": true },
{ "prefix": "/.well-known/", "binding": "requests", "kind": "api", "public": true },
{ "prefix": "/", "binding": "content", "kind": "content", "public": true }
```

Declare each operation once in your `Surface` definition (see [Build for agents](/developers/build-for-agents/) for the full walkthrough). `agent-ready` projects those operations into `/mcp`, `/openapi.json`, `/llms.txt`, and Markdown twins from one source of truth, so browser clicks and Claude tool calls run the same Rust handler, atomic transactions, and authorization checks.

## Design your MCP surface for Claude

Claude evaluates remote connectors on discovery behavior, tool clarity, and prompt safety before listing or connecting them:

- **Challenge unauthenticated `/mcp` requests with `401` and RFC 9728 metadata.** When an app requires user authentication, return `401 Unauthorized` with `WWW-Authenticate: Bearer resource_metadata="https://<your-host>/.well-known/oauth-protected-resource/mcp"` on the very first unauthenticated request (including `initialize` and `tools/list`). That guarantees custom connectors in claude.ai, Pi, OpenCode, Cursor, Codex, and Claude Code all trigger browser OAuth or Auto-connect automatically with zero manual settings. (Only return `200 OK` anonymously on `tools/list` if your server intentionally serves unauthenticated public tools.)
- **Set all four MCP tool annotations.** Every tool in `tools/list` should declare explicit boolean values for `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`, plus a clear string `description` on every parameter in `inputSchema.properties`. Claude uses these hints to decide which reads can run without interrupting the user and which writes require confirmation.
- **Keep tool catalogs focused.** A compact, task-oriented set of tools uses far less context window than mirroring every low-level REST endpoint. For rich interactive flows (dashboards, forms, bookings, or visual pickers inside the Claude chat pane), return interactive HTML resources using [MCP Apps](/developers/mcp-apps/).
- **Require confirmation on consequential writes.** Use idempotency keys and [Ask before acting](/developers/mcp-elicitation/) or exact-terms confirmation so retries never duplicate a payment, booking, or deletion.

## Add isolated per-app sign-in for consumers and teams

Every Ferrite application keeps its own OAuth 2.1 issuer so user grants never cross between applications. Add `poppy-oauth` to run an isolated OAuth 2.1 server directly inside your application:

```bash
ferrite add poppy-oauth
```

Configure `OAuthServerConfig::from_poppy(...)` with your canonical origin, resource URLs, and declared scopes (see [Per-app OAuth (Poppy)](/developers/poppy-oauth/) for the full setup). `poppy-oauth` provides:

- RFC 9728 Protected Resource Metadata at `/.well-known/oauth-protected-resource/mcp`
- RFC 8414 Authorization Server Metadata at `/.well-known/oauth-authorization-server`
- PKCE `S256`, Client ID Metadata Documents (CIMD), `private_key_jwt`, RFC 8707 `resource` binding, RFC 9207 `iss` in authorization responses, rotating refresh tokens, and RFC 7009 revocation

With this in place, any Claude consumer (Free, Pro, Max, or Ultra) signs in to your app once on claude.ai and stays connected across web, desktop, mobile, and Claude Code.

## Enable zero-friction Auto-connect for enterprise customers

When a company on a Claude Team or Enterprise plan adopts your SaaS app, their administrator does not want every employee to click through an individual OAuth consent screen. Add Enterprise Managed Authorization (ID-JAG, `urn:ietf:params:oauth:grant-type:jwt-bearer`) to your `poppy-oauth` server with `handle_token_with_enterprise`:

```rust filename="src/oauth.rs"
let cfg = cfg.with_enterprise(vec![
    TrustedIdp::new(
        "https://identity.anthropic.com/issuers/<customer-org-id>",
        keys,
        vec![
            "https://claude.ai/oauth/mcp-oauth-client-metadata".to_string(),
            "https://claude.ai/oauth/mcp-oauth-client-metadata/confidential_client".to_string(),
        ],
        vec!["app:read".to_string(), "app:write".to_string()],
    )
    .with_tenant("<customer-tenant-id>"),
]);
```

You can trust either **Claude as the issuer** (`https://identity.anthropic.com/issuers/<org-id>`, requiring no external IdP at the customer) or a customer's **Okta** issuer via Cross-App Access (XAA). Keep these identity rules strict in your subject resolver:

- Match returning users by `(iss, sub)` (and `aud_tenant` when set) because Okta XAA assertions can omit the `email` claim.
- Match by `email` only when your application has verified the customer's corporate domain or pre-invited that address; never trust an unverified email or auto-provision accounts on consumer free-mail domains.
- Return `None` for anyone outside the customer's workspace so `poppy-oauth` refuses the grant without creating an account.

See [Enterprise-managed authorization](/developers/enterprise-managed-authorization/) for the complete verification rules and client exchange helpers.

## Security boundaries and economics

Your Claude connector runs inside the same compiled Rust process and `ferrite.json` capability envelope as your web app:

- **Declared egress only.** External API calls and IdP JWKS fetches must appear as explicit HTTPS prefixes in `ferrite.json`; undeclared hosts are blocked at the gateway.
- **Write-only secrets.** OAuth signing keys and third-party API credentials are stored write-only and never exposed in environment variables or source bundles. See [Secrets & Egress](/developers/secrets-egress/).
- **Bounded prepaid hosting.** Ferrite charges metered prepaid compute, storage, and requests with no per-seat fee; a small always-on application costs about $8 a month, with hard account spend caps and per-service memory and CPU ceilings.

## Next steps

- [Internal company apps in Claude](/developers/claude-internal-apps/) to deploy private company tools through `Ferrite Apps` without building per-app OAuth.
- [Enterprise-managed authorization](/developers/enterprise-managed-authorization/) for the ID-JAG token validation rules and `poppy-oauth` integration.
- [MCP Apps](/developers/mcp-apps/) to render interactive UI directly inside Claude conversations.
- [Build for agents](/developers/build-for-agents/) for the full `agent-ready` walkthrough.
