---
title: "App MCP"
description: "Every app with tools is an MCP server, for Claude Code, Cursor and other AI clients."
canonical_url: "https://docs.lightdrop.cloud/guides/mcp"
---
# App MCP

> Every app with tools is an MCP server, for Claude Code, Cursor and other AI clients.

The tools in `server/tools/` (see [Browser agents](https://docs.lightdrop.cloud/guides/browser-agents)) are also served at
`/mcp`, over the [Model Context Protocol](https://modelcontextprotocol.io). AI clients outside the
browser (Claude Code, Cursor, claude.ai connectors, …) connect to it and use the app as the user
who signed in, with that user's permissions. Nothing to set up: an app with tools has it.

```bash
claude mcp add --transport http todos https://todos.lightdrop.cloud/mcp
```

<note>

This page is about an app serving its own tools. To build apps without a local setup, see
[Build MCP](https://docs.lightdrop.cloud/guides/build-mcp); to manage deployed apps without the CLI,
[Dashboard MCP](https://docs.lightdrop.cloud/guides/dashboard-mcp). An overview is in
[Agents](https://docs.lightdrop.cloud/guides/agents#which-mcp-server).

</note>

The first call opens the browser: sign in with wervt as usual and allow the client to use the app.
The client then keeps itself signed in.

## How it works

`/mcp` is an OAuth 2.1 resource server of wervt's login (`auth.lightdrop.cloud`):

1. Without a token, `/mcp` answers 401 and points to `/.well-known/oauth-protected-resource/mcp`,
which names the login.
2. The client registers itself with the login (dynamic client registration) and sends the user
there. The consent page shows which client wants to use which app.
3. The client gets an access token (a JWT) for exactly this app's `/mcp`. A token for one app is
rejected by every other app, and a client needs the user's consent for each app.
4. Every request carries the token. `@wervt/nuxt` checks its signature and audience and runs the
tool as the token's user: `useWervtUser(event)` returns that user, like on the page.

Tools behave exactly as they do for browser agents: same names, descriptions, input schemas and
validation. A thrown `createError` reaches the client with its status and message, and every call
is logged with `tool` and `mcp: true`.

## Private apps

On a private app the runtime checks the token before the app is reached, like the session cookie:
only users on the app's list (and admins) get in. Everyone else gets a 403.

## Native apps

A native app (iOS, Android, desktop) signs in the same way and then calls the app's API routes with
a token for the whole app (`resource=https://todos.lightdrop.cloud`): the runtime checks a wervt access
token on every path, public apps included. Registration, redirect URIs, refresh and the rest are
in [Native apps](https://docs.lightdrop.cloud/guides/native-apps).

## Options

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['@wervt/nuxt'],
  wervt: {
    mcp: {
      title: 'Todos',
      // Passed to the model: how the tools fit together.
      instructions: 'Call list-todos first to get ids for set-todo-done.',
    },
    // mcp: false turns /mcp off; webmcp: false keeps the tools for MCP only.
  },
})
```

The server name defaults to the app name, its version to the `package.json` version. `/mcp` needs
Nuxt 5; Nuxt 4 apps keep their tools for WebMCP and get a warning.

## The app's own tokens

Scripts and CI can't sign in through a browser. An app with its own API tokens accepts them on
`/mcp` through the `wervt:mcp:token` server hook, which runs for every bearer token that isn't a
wervt access token:

```ts [server/plugins/api-tokens.ts]
import { useServerHooks } from 'nuxt/server'
import { userForToken } from '../utils/api-tokens'

export default () => {
  useServerHooks().hook('wervt:mcp:token', async (ctx) => {
    const user = await userForToken(ctx.token)
    if (user) ctx.user = { id: user.id, email: user.email, name: user.name ?? undefined }
  })
}
```

Tools then see that user in `useWervtUser(event)`. Private apps only accept wervt access tokens:
the runtime checks them before the app runs. The `Authorization` header reaches every route of a
public app, so its own API routes can check such tokens too.

## Local development

`nuxt dev` has no wervt login, so `/mcp` serves every client as the dev user (`wervt.dev.user`),
without a token. Browser pages can't reach it (requests with an `Origin` header are refused).

```bash
claude mcp add --transport http todos-dev http://localhost:3000/mcp
```

To try the sign-in itself, run the auth app (`apps/auth` in the wervt repo, `AUTH_DEV_LOGIN=1` for
an email and password login) and start the app with `WERVT_AUTH_URL` pointing to it.
`WERVT_APP_URL` sets the app's own URL, the token audience (the dev server's origin by default):

```bash
WERVT_AUTH_URL=http://localhost:3400 WERVT_APP_URL=http://todos.localhost:3000 pnpm dev
```

The auth app registers an app's `/mcp` on its first sign-in when it is
`<app>.<WERVT_BASE_DOMAIN>/mcp` and the app's metadata names the auth app as its login. Other URLs
(like `http://localhost:3000/mcp`) go into `WERVT_MCP_RESOURCES` on the auth app.


## Sitemap

See the full [sitemap](https://docs.lightdrop.cloud/sitemap.md) for all pages.
