# Model Context Protocol

Integrations connect your **app** to a service. **MCP** connects the **agent** to one instead. The Model Context Protocol is an open standard for giving an AI agent extra tools and data to work with as it builds your app.

## What MCP Adds

An MCP server exposes a set of **tools** and, sometimes, **data** the agent can use while it builds your app. Where an OAuth connection lets the finished app act with a service, MCP works one level up: it expands what the agent can do while it's working on your behalf.

That's useful when you want the agent to:

- **Read live documentation or references** for a library or API as it writes code.
- **Query a system or database** to inform what it builds.
- **Reach a specialized capability** that a particular MCP server provides.

> [!NOTE]
> MCP servers are scoped to a single project. They give the agent extra tools for that project and don't affect your other apps.

## Add an MCP Server

1. From **My Project**, open the ** More…** menu and click ** MCP Servers**. Alternatively, right-click the project or click **the ellipsis** in the Agent Chat to find this option.
2. Add the MCP Server entry under `mcpServers`, keyed by a server name, with the details that server needs.
3. Click **Save** to write the config file.
4. With the server added, the agent can call its tools while it works on your project. Describe what you want, and the agent reaches for the new tools when they help.

### Configure a Server

Each entry under `mcpServers` defines how its server is reached. Its **type** must be `stdio`, `sse`, or `http`:

- **A server name** as the key, so you can recognize it in the config.
- **A `stdio` server** is local: it declares a `command` to run, with optional `args`, `env`, and `cwd`.
- **An `sse` or `http` server** is remote: it declares a `url` (http or https) and may include `headers`, such as an authorization token.

Check the server's own documentation for the exact values it expects. The configuration is stored with the project in `.mcp.json`, so it stays with the app rather than needing set up again each time.

## Use It in a Prompt

The agent calls a tool when your prompt makes it the obvious way to get something done. To make that more likely:

- **Name the source in your prompt**: "Use the records from my database MCP server to seed the list" is clearer than hoping the agent reaches for it.
- **Describe the goal, not the mechanics**: Say what you want built; let the agent decide which tool fits.
- **Check the result**: If the agent didn't use a connected tool, say so and point it at the server explicitly.

## Expose Your App as an MCP Server

Everything above connects the **agent** to an outside MCP server. The `/create-mcp-server` command runs the other direction: it turns your **app** into an MCP server that other AI tools can connect to, exposing your app's own data and actions as tools.

Type **`/create-mcp-server`** in the Agent Chat composer. You can add free-text preferences after it, such as `/create-mcp-server read-only tools`, to shape what the server exposes.

The agent then scaffolds a server around your app's own data and actions:

- **A `stdio` server** by default: a local script that reads your app's data directory at runtime and exposes tools shaped around what your app stores. It works even while your app is closed.
- **An `http` server** on request: an in-app server bound to localhost, for cases that need your app's live, in-memory state rather than just its stored data. It works only while your app is running.

Before finishing, the agent runs a self-test, then gives you copy-paste install commands for Claude Code, Codex CLI, Cursor, or Claude Desktop.

> [!NOTE]
> This is separate from the Glaze agent MCP config mentioned above, where the agent connects to outside servers. If you'd like to use the server you just created as an MCP inside the agent, you can register it under `mcpServers` like any other, subject to the same approval step.

## MCP vs OAuth

MCP and an OAuth integration solve different problems, and an app can use both. An **OAuth integration** connects your finished app to a service so the running app can act as you, reading and writing that service's data on your behalf. **MCP** works one level up: it connects the **agent** to extra tools and data while it builds, expanding what the agent itself can do as it writes your app. In short, OAuth extends your app's reach; MCP extends the agent's.
