Environment setup
Use Xcode 27 on a Mac. Create a SwiftUI app with a minimum of iOS 27 or macOS 27. Add the Foundation Models framework to the target. You do not need a network server for this course.
xcode-select --install
xcodebuild -version
# Xcode 27. File > New > Project > App, Interface: SwiftUI
# Deployment: iOS 27 or macOS 27. Add FoundationModels to the target.
Exact Tool and DynamicGenerationSchema names can change in the installed SDK. Check the Xcode 27 docs before you copy a name.
A Foundation Models session can call Swift tools you compile into the app. MCP is a different contract. It lists and runs tools over JSON-RPC 2.0. An Edge FDE uses both so a new tool can land as a server method, not as a rewrite of the chat loop.
Apple's Tool type is compile-time. You write a struct, give it a name, and attach it when you create the session. MCP tools are runtime. The client asks tools/list, then calls tools/call. Foundation Models does not speak MCP by itself. You write a small bridge.
What you gain
If every new capability requires a new session setup, the chat loop grows and breaks. If the session always talks to a stable bridge, you add a method on the server and the model sees a new tool on the next turn.
Xcode 27 also uses MCP for IDE tools over XPC. That is a host talking to Xcode. This course is the other direction: your on-device app hosts a small MCP server, and your Foundation Models session is the client through a bridge.
Read Run tools in a safe box, Stop prompt attacks and leaks, and Core AI vs Core ML vs MLX after you have the bridge. Those courses cover isolation, injection checks, and when Foundation Models is the right stack.
session.respond as the chat loop. Put new work behind MCP methods. Do not invent a built-in Apple adapter.Next, look at the raw JSON-RPC messages those methods use.
Key concepts
- A Foundation Models
Toolis 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
Toolsorespondstays unchanged.
Takeaways
- Keep
session.respondas 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.