* 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

# flyte.ai.mcp

## Directory

### Classes

| Class | Description |
|-|-|
| [`FlyteMCPAppEnvironment`](https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.ai.mcp/flytemcpappenvironment.md) | Serve a Flyte-facing MCP server over HTTP (FastMCP + Starlette + Uvicorn). |
| [`MCPAppEnvironment`](https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.ai.mcp/mcpappenvironment.md) | Serve a FastMCP server over HTTP (Starlette + Uvicorn) or over stdio. |

### Methods

| Method | Description |
|-|-|
| [`resolve_tools()`](#resolve_tools) | Return the set of MCP tool names to expose. |

### Variables

| Property | Type | Description |
|-|-|-|
| `ALL_MCP_TOOLS` | `tuple` |  |
| `ALL_MCP_TOOL_GROUPS` | `tuple` |  |
| `READ_ONLY_MCP_TOOLS` | `tuple` |  |
| `TOOL_GROUP_MAPPING` | `dict` |  |

## Methods

#### resolve_tools()

```python
def resolve_tools(
    tool_groups: list[str] | None,
    tools: list[str] | None,
    read_only: bool = False,
) -> set[str]
```
Return the set of MCP tool names to expose.

If both `tool_groups` and `tools` are omitted, all tools are enabled. Otherwise pass
either one (not both). The `core` group selects no tools; only the HTTP routes are served.

| Parameter | Type | Description |
|-|-|-|
| `tool_groups` | `list[str] \| None` | Group names from `TOOL_GROUP_MAPPING` |
| `tools` | `list[str] \| None` | Explicit tool names from `ALL_MCP_TOOLS` |
| `read_only` | `bool` | Drop every tool that is not annotated `readOnlyHint=True` |

**Returns:** The enabled tool names

## Subpages

- [FlyteMCPAppEnvironment](https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.ai.mcp/flytemcpappenvironment.md) - Serve a Flyte-facing MCP server over HTTP (FastMCP + Starlette + Uvicorn).
  - Parameters
  - Properties
  - Methods
  - add_dependency()
  - clone_with()
  - container_args()
  - container_cmd()
  - container_command()
  - get_port()
  - on_shutdown()
  - on_startup()
  - resolve_scope()
  - resolved_allowed_hosts()
  - resolved_allowed_origins()
  - run_stdio()
  - run_stdio_async()
  - server()
- [MCPAppEnvironment](https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.ai.mcp/mcpappenvironment.md) - Serve a FastMCP server over HTTP (Starlette + Uvicorn) or over stdio.
  - Parameters
  - Properties
  - Methods
  - add_dependency()
  - clone_with()
  - container_args()
  - container_cmd()
  - container_command()
  - get_port()
  - on_shutdown()
  - on_startup()
  - run_stdio()
  - run_stdio_async()
  - server()

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flyte-sdk/flyte.ai.mcp/_index.md
**HTML**: https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.ai.mcp/
