---
title: Apps
description: Web Apps and MCP Servers, through which people and agents use the Ontology.
---

{/* vale off */}

An **App** is a Resource through which people or agents use the Ontology. A web App serves people in a browser, and an **MCP Server** serves agents and the MCP clients they run in. Every App works the same way, whatever its kind:

- **It declares its interface.** You declare an App with `app()` in your Project: the Queries, Mutations, and Actions it may call, and whether its users must sign in. Apply commits that interface, and the App reaches nothing else.
- **It is its own Vite app.** An App that serves pages has a Vite configuration of its own, in or below the directory of the Project's `tractorbeam.config.ts`, which names the App with `tractorbeam({ app })`. `tractorbeam dev` runs its dev server against your personal Branch. In the Project's directory, `tractorbeam build` builds the **App Bundle** of every App against its interface, and `tractorbeam deploy --app <name>` builds one App's and deploys it to a Branch.
- **It acts as its user.** Every request an App makes runs as the principal it acts for, as [Who an App acts for](#who-an-app-acts-for) describes.

The kinds differ only in what the App Bundle holds:

- A **web App**'s Bundle holds its pages and assets, and its server, when it has one. It serves them at its App Route.
- An **MCP Server** serves a tool for each Function it lists at its App Route's `/mcp`. An MCP client that connects to `/mcp?codemode=true` also gets an `execute` tool, which runs an agent's JavaScript function against them. `codemode` also takes `1`, `yes`, or `on` to turn code mode on, and `false`, `0`, `no`, or `off` to leave it off; the route refuses any other value. Its Bundle holds its **Views**: pages that an MCP client that supports [MCP Apps](https://modelcontextprotocol.io/extensions/apps/overview), such as Claude, renders inline in a conversation. The model shows a View by calling its `show_<view>` tool with the View's input, and the page calls the MCP Server's Queries, Mutations, and Actions through their tools, which the MCP client runs for it as the same user. Each View's page is `src/views/<view>/index.html` in the MCP Server's Vite app, and the build makes each one a single self-contained page. An MCP client that doesn't render Views sees the MCP Server without them, and an MCP Server without Views needs no Vite app, as a Project needs none for its other Resources.

## App Routes

An **App Route** is an App's hostname on a Branch. The same App can serve one Route for `main` and another for a Branch under review, each reading that Branch's data and serving the App Bundle deployed there.

## Who an App acts for

An App's requests act for a principal: a signed-in user, a service user, or an anonymous principal, such as a visitor to a public App. The principal's Markings decide which data each request reaches.
