EDGE FDE
IntermediateOn-Device MCP for Foundation Models
Plug new tools into your Apple AI app without rewriting the chat loop.
Raw JSON-RPC MCP server and client mapped into Foundation Models Tool types.
Speak MCP in Swift. Keep LanguageModelSession as the chat loop. iOS 27 and macOS 27 only.
Lessons
Key concepts
- MCP lists and calls tools over JSON-RPC 2.0 at runtime.
- Foundation Models
Tooltypes are compile-time. Your bridge joins the two. LanguageModelSessionstays the chat loop.- On iOS 27 use an in-process Swift actor or XPC. There is no built-in Apple MCP adapter.
Takeaways
- You can plug new tools into an Apple AI app without rewriting the chat loop.
- You can speak MCP in Swift and keep
session.respond(to:)as the only chat entry point. - Your bridge is the only join between the model and the server.
Agent briefs
FAQ
What is MCP on device?
MCP lists and calls tools over JSON-RPC 2.0 at runtime. You speak MCP in Swift and keep LanguageModelSession as the chat loop. iOS 27 and macOS 27 only.
Does Apple ship an MCP adapter?
No. There is no built-in Apple MCP adapter. On iOS 27 use an in-process Swift actor or XPC.
How do MCP tools relate to Foundation Models?
Foundation Models Tool types are compile-time. Your bridge joins MCP tools to those types.
Do I rewrite the chat loop for each new tool?
No. Keep session.respond(to:) as the only chat entry point and plug new tools through the bridge.
What does the course build?
A raw JSON-RPC MCP server and client, then a map of those tools into Foundation Models Tool types.
Related courses
Run tools in a safe box · Stop prompt attacks and leaks · Make several agents agree first · Core AI vs Core ML vs MLX