* This page is part of the open-source Flyte v2 docs.
* Full index: https://www.union.ai/docs/v2/flyte/llms.txt
* Flyte is the open-source project. Union.ai is a commercial superset of it and uses the same `flyte` SDK and CLI, so the Union.ai docs cover everything here and more.
* If a question is not answered in these docs, or is about a feature that may be commercial, check the Union.ai v2 docs at https://www.union.ai/docs/v2/union/llms.txt
* These are the v2 docs. v1 is out of date and deprecated. Only refer to v1 docs if asked explicitly about v1. The v1 index is at https://www.union.ai/docs/v1/flyte/llms.txt

Serve Model Context Protocol servers for AI assistants to interact with, hosted on Flyte.

# Build an MCP

Flyte supports serving [Model Context Protocol (MCP)](https://modelcontextprotocol.io) servers over HTTP.

There are two main MCP environment types:

| Environment | Purpose |
|-------------|---------|
| **`MCPAppEnvironment`** | Serve any FastMCP instance with custom tools |
| **`FlyteMCPAppEnvironment`** | Flyte-specific server that exposes Flyte operations as tools |

See the sub-pages for detailed guides:

- [User-defined MCP servers](https://www.union.ai/docs/v2/flyte/user-guide/agents/build-mcp/mcp_server.md): Build and deploy your own FastMCP instances
- [Flyte MCP servers](https://www.union.ai/docs/v2/flyte/user-guide/agents/build-mcp/flyte_mcp_server.md): Use Flyte-specific tools to interact with your cluster

## HTTP layout

All MCP app environments expose the same HTTP endpoints:

- `GET /health`: Liveness/readiness check (`{"status": "healthy"}`)
- `POST {mcp_mount_path}/mcp` or `{mcp_mount_path}/sse`: MCP protocol endpoint (default: `/mcp` for generic, `/flyte-mcp` for Flyte)

## Quickstart

The fastest way to try Flyte MCP is locally (no deployment needed):

```bash
uvx --from "flyte[mcp]>=2.5.18" flyte-mcp --transport stdio
```

`--transport stdio` is required when a client launches the server as a subprocess. The CLI defaults to `streamable-http`, which starts an HTTP listener instead.

For client setup, tool selection, allowlists, and remote deployment, see [Flyte MCP server](https://www.union.ai/docs/v2/flyte/user-guide/agents/build-mcp/flyte_mcp_server.md).

{{< subpage-cards >}}

## Subpages

- [User-defined MCP server](https://www.union.ai/docs/v2/flyte/user-guide/agents/build-mcp/mcp_server.md) - Deploy any FastMCP instance as a long-running app serving its tools over HTTP.
  - When to use it
  - How it works
  - Basic example
  - HTTP layout
  - Choosing a transport
  - Connecting a client
  - Claude Code
  - OpenCode
  - Configuration tips
  - Best practices
- [Flyte MCP server](https://www.union.ai/docs/v2/flyte/user-guide/agents/build-mcp/flyte_mcp_server.md) - Expose Flyte operations as MCP tools so an AI assistant can drive your workloads.
  - When to use it
  - How to run it
  - Running locally with `uvx`
  - Basic example
  - Scoping the server
  - 1. Tool groups
  - 2. Individual tools
  - 3. Allowlists
  - Enabling the search tools
  - Putting it together: a filtered server
  - Connecting a client
  - Claude Code: local (stdio)
  - OpenCode: local
  - Best practices
  - MCP tools reference

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/user-guide/agents/build-mcp/_index.md
**HTML**: https://www.union.ai/docs/v2/flyte/user-guide/agents/build-mcp/
