Skip to main content
It can be useful for your voice agents to use Model Context Protocol (MCP) to fetch live data or perform external actions — for example, retrieving docs, querying databases, or running custom APIs. This guide shows you how to connect your AI SDK app to an MCP server and expose those tools to your Layercode voice agent.

Prerequisites

This guide assumes you already have tool calling set up and working with Layercode. If not, start here first:
👉 Tool calling in Next.js with Layercode
Once that’s working, you can extend your agent with MCP-based tools.

Example Setup

Note: The MCP URL https://docs.layercode.com/mcp below is just an example endpoint that connects to the Layercode Docs MCP server.
Replace this with your own MCP server URL — for example, one that connects to your company’s data, APIs, or private knowledge.