Skip to navigation

MCP

View as Markdown

This guide shows how to integrate the AgentDuet SDK with the Model Context Protocol (MCP) so live speech agents can call structured tools over a shared tool surface during phone calls.

Sample: OmniBank phone servicing (authenticate, fees, escalate).

Demo caller: Ava Chen, card ending 4821.

What this integration provides

  • AgentDuet answers inbound calls and streams PCM to Gemini Live
  • Gemini Live declares tools from an MCP server’s list_tools result
  • Tool calls dispatch to the MCP server over stdio (call_tool)
  • Swap mcp_tools_server.py to change capabilities without touching call wiring

How the pieces fit

Caller AgentDuet Gemini Live MCP tools mcp_tools_server
LayerOwns
AgentDuetConnector, answer/hangup, PCM in/out
Gemini LiveSpeech-to-speech + function calls
MCP client (main.py)Stdio connect, schema cleanup, dispatch
MCP server (mcp_tools_server.py)Bank tools (auth, summary, waiver, escalate)

Prerequisites

Step 1: Clone the sample

git clone https://github.com/AgentDuet/agentduet-samples.git
cd agentduet-samples/integrations/mcp/omnibank-servicing

Layout:

omnibank-servicing/
├── main.py # AgentDuet + Gemini Live + MCP client
├── mcp_tools_server.py # FastMCP bank tools (stdio)
├── requirements.txt
└── .env.example

Step 2: Install

python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

The sample pins agentduet==1.0.0.

Step 3: Configure .env

cp .env.example .env
AGENTDUET_API_KEY=your-connector-api-key
AGENTDUET_CONNECTOR_UUID=your-connector-uuid
GEMINI_API_KEY=

Step 4: Run

python main.py

main.py spawns mcp_tools_server.py over stdio, loads tool declarations into Gemini Live, then waits for calls.

Call your AgentDuet number. Say you are Ava Chen, card ending 4821.

Ask / doExpect
Give name + last 4Agent spells back, then authenticate_customer
Ask about feesLate fee 30+interest30 + interest 45.50 from tool result
Waive one feeprocess_fee_waiver approves (within $50 cap)
Waive both feesRefused or escalated (record_escalation)

Tools

ToolRole
authenticate_customerMatch name + last 4; return fees and waiver limit
get_account_summaryCard, balance, outstanding fees
process_fee_waiverWaive fees up to $50 total
record_escalationLog supervisor handoff; return reference

How AgentDuet and MCP connect

  1. On startup, the app opens an MCP stdio client to mcp_tools_server.py.
  2. list_tools becomes Gemini FunctionDeclarations (JSON Schema keys Gemini rejects are stripped).
  3. On each inbound call, AgentDuet answers and Gemini Live streams audio.
  4. When the model emits a tool call, the app runs call_tool and returns the result with send_tool_response.
  5. Hangup closes the Gemini session; the MCP server process stays up for the next call.

Next Step