Developer Guide / MCP Integration

MCP Integration

Connect your AI voice agent to live business data and external services using Model Context Protocol servers.

What is MCP?

Model Context Protocol (MCP) is an open standard that lets AI agents connect to external tools and data sources through a standardized server interface. Instead of writing a custom webhook for every integration, you deploy an MCP server that exposes a set of named tools — and any AI that speaks MCP can discover and call them automatically.

Common MCP use cases include querying internal databases, looking up CRM records, checking inventory, reading calendars, or calling any REST API your business already has. Because the protocol is standardized, the same MCP server can be reused across different AI applications without modification.

Standardized

One protocol works across AI models and platforms — no custom glue code per integration.

Discoverable

The AI learns what tools an MCP server offers at runtime — no hard-coding of tool schemas.

Secure

Auth headers and an allowed-tools whitelist keep access scoped and controlled.

How VNS Uses MCP

When VNS receives your CallStart response it splits it in two: the VoiceElements_Instructions block is consumed by VNS itself, and the session.update portion — including any MCP server definitions in the tools array — is forwarded to the AI model. The AI handles connecting to MCP servers directly. Regular function tools and MCP server entries live side-by-side in the same array.

1

session.update sent to AI

VNS strips out the VoiceElements_Instructions block for its own use and forwards the session.update to the AI — including MCP server definitions ("type": "mcp" entries) alongside regular function tools.

2

AI connects to MCP servers

The AI uses the server_url and headers from each MCP definition to connect directly to the server and retrieve its list of available tools.

3

vns_allow_mcp_calls resolves

The AI calls vns_allow_mcp_calls as instructed. VNS holds the response and waits for the AI to send a confirmation that all MCP servers have finished loading. Once VNS receives that signal it unblocks and the session proceeds.

4

AI invokes MCP tools

With all servers ready, the AI calls MCP tools by name directly on each server. Results are returned to the AI to use in the ongoing conversation.

5

Approval gates (optional)

For tools marked require_approval.always, the AI sends an authorization request to VNS before calling the tool. VNS either approves it directly or forwards the request to your API endpoint for a decision, then returns the result to the AI.

vns_allow_mcp_calls

The AI connects to MCP servers asynchronously after the session starts, which takes a moment. The vns_allow_mcp_calls built-in tool solves the timing problem: when the AI calls it, VNS holds the response and waits for the AI to send back a confirmation that all MCP servers have finished loading. Once VNS receives that signal it unblocks and the AI is clear to use MCP tools.

You must include this tool whenever you use MCP. Without it the AI may attempt to invoke MCP tools before they are available, resulting in errors or missing functionality.

Tool Definition

Add this entry to the tools array in your CallStart response:

{
    "name": "vns_allow_mcp_calls",
    "description": "Call this function to ensure that the mcp servers are ready.",
    "type": "function",
    "parameters": null
}

Example Instruction

Add something like this to your instructions string in the CallStart response so the AI knows to call this tool before using any MCP tools. While it waits, the AI should keep the caller engaged:

Before calling any MCP server tool you MUST first call vns_allow_mcp_calls to verify the MCP server is ready. While waiting for vns_allow_mcp_calls to return, tell the caller something like "One moment please, I'll be right with you" or "Just a moment while I get that ready for you".

MCP Server Configuration

Each MCP server is defined as an entry in the tools array of your CallStart response, identified by "type": "mcp".

{
    "type": "mcp",
    "server_label": "directory",
    "server_url": "https://mcp.voiceelements.com/mcp",
    "headers": {
        "Authorization": "Bearer some-key"
    },
    "allowed_tools": {
        "tool_names": [
            "login",
            "logout",
            "get_all_employees",
            "get_employees_by_department",
            "search_employees",
            "get_employee_by_id",
            "list_departments"
        ]
    },
    "require_approval": {
        "always": {
            "tool_names": [
                "login",
                "get_all_employees",
                "get_employee_by_id"
            ]
        },
        "never": {
            "tool_names": [
                "logout",
                "get_employees_by_department",
                "search_employees",
                "list_departments"
            ]
        }
    }

}

Field Reference

Field Description
type Must be "mcp". Tells VNS this entry is an MCP server rather than a regular function tool.
server_label A short identifier for this server. Used in logs and approval messages. Choose something descriptive like "directory" or "crm".
server_url The HTTPS URL of your MCP server endpoint.
headers HTTP headers sent with every request to the MCP server. Use this to pass an Authorization: Bearer token or any other required credentials.
allowed_tools Whitelist of tool names the AI is permitted to call on this server. Tools not listed here are hidden from the AI even if the MCP server exposes them.
require_approval Controls which tools require an approval step before VNS executes them. See Require Approval below.

Require Approval

Some MCP tools should not be called automatically — they may modify data, expose sensitive information, or require a human decision. The require_approval field lets you gate specific tools behind an approval step.

require_approval.always

When the AI wants to call one of these tools, it first sends an authorization request to VNS before proceeding. VNS either approves it directly or forwards the request to your API endpoint for a programmatic decision. Once the approval is returned the AI proceeds with the tool call. Use this for operations that write data, access personal records, or carry business risk.

require_approval.never

These tools are called automatically with no approval step. Use this for read-only lookups and searches where immediate execution is safe.

Tip: When in doubt, start with a tool in always during development so you can observe the approval flow before moving it to never in production.

Multiple MCP Servers

You can connect more than one MCP server in a single session. Add one entry per server to the tools array, each with its own server_label, URL, headers, and allowed tools. The vns_allow_mcp_calls tool waits for all defined servers to be ready before signaling the AI to continue.

// In your CallStart response tools array:
[
  { "name": "vns_allow_mcp_calls", "type": "function", ... },

  { "type": "mcp", "server_label": "directory",  "server_url": "https://...", ... },
  { "type": "mcp", "server_label": "scheduling", "server_url": "https://...", ... },

  { "name": "vns_end_conversation", "type": "function", ... }
]

Integration Checklist

  • MCP server is running and reachable over HTTPS.
  • vns_allow_mcp_calls is included in your tools array.
  • Your MCP server config entry ("type": "mcp") is in the same tools array.
  • allowed_tools lists only the tool names you want the AI to access.
  • Your instructions string tells the AI to call vns_allow_mcp_calls before using MCP tools.
  • require_approval is configured for any tools that should not run automatically.

Ready to Automate Your Phone Lines?

See Voice Nexus in action. Book a live demo with our team and we'll walk you through setup, integrations, and pricing.