---
title: "Why MCP sits next to your chat tools"
lesson_id: "01"
---

# Why MCP sits next to your chat tools

- **Lesson ID:** 01
- **Goal:** Split Foundation Models Tool from MCP. State why an Edge FDE keeps session.respond and adds tools over JSON-RPC.
- **Human lesson:** [01-why-mcp-next-to-tools.html](01-why-mcp-next-to-tools.html)

## Prerequisites

A LanguageModelSession that can call a compiled Swift Tool. iOS 27 or macOS 27, Xcode 27.

## Inputs, outputs, and artifacts

- **Inputs:** The Tool protocol, the MCP name, and the chat loop.
- **Outputs:** One sentence for Tool, one for MCP, and the rule that Foundation Models does not speak MCP by itself.
- **Artifacts:** Progressive .flow diagrams and an environment-setup block.

## Agent build steps

1. Set the environment: Xcode 27, iOS 27 or macOS 27, Foundation Models framework.
2. Define Tool as the compile-time Swift contract on LanguageModelSession.
3. Define MCP as a runtime JSON-RPC contract for list and call.
4. State that you write a bridge. Do not invent a first-party adapter.
5. Link [Run tools in a safe box](../on-device-sandboxed-tools/), [Stop prompt attacks and leaks](../on-device-guardrails/), and [Core AI vs Core ML vs MLX](../core-ai-vs-core-ml-vs-mlx/).

## Constraints

iOS 27 or later, or macOS 27 or later, and Xcode 27. Plain spoken English. No metaphor, quizzes, Mermaid, or em dashes. Do not invent a first-party Foundation Models MCP adapter. Show raw JSON-RPC 2.0. Confirm Tool and DynamicGenerationSchema names in the installed SDK docs.

## Key concepts

- A Foundation Models `Tool` is compiled in. MCP tools appear at runtime.
- Keep two contracts: the session plus Swift tools, and MCP for new capabilities.
- Xcode 27 uses MCP for IDE tools. This course hosts MCP inside your app.
- The bridge maps MCP tools into `Tool` so `respond` stays unchanged.

## Takeaways

- Keep `session.respond` as the chat loop.
- Do not invent a built-in Apple MCP adapter for Foundation Models.
- Add a server method when you need a new capability, not a session rewrite.

## Acceptance checks

- Tool and MCP have different jobs.
- The page says the chat loop stays session.respond.
- Sibling courses are linked with the exact relative URLs.
- Progressive .flow diagrams and an Agent brief link are present.
- [ ] Proceed to [lesson brief](02-raw-json-rpc.llms.md).
