I built an MCP server using the official typescript SDK to expose a tool to my Retell agents. I am able to connect and establish sessions.
In the UI chat/voice test interface and in production there are no issues with the MCP handshake and extracting dynamic variables from the responses, however there is an issues with MCP tools in the Simulation environment/test runne.
Test id: test_job_ccef7f93000a
Agent id: agent_eb6e4b956b4ac772e4120fccf5
Test:
{
"name":"Normal Flow - Printer Offline Issue",
"dynamic_variables":{
"assigned_tech":"John Martinez",
"ticket_number":"T20231222-0145",
"transfer_phone":""
},
"metrics":[
"Ticket created successfully",
"User received ticket number",
"Proper issue categorization",
"Clear next steps provided",
"Call completed under 3 minutes"
],
"user_prompt":"[Calling from +15555551234] Hi, my name is Alex Johnson. I'm calling because my office printer on the second floor has been offline since this morning. I've tried turning it off and on again but it's still not showing up on the network. The model is HP LaserJet Pro and it's the one next to the break room. We have several documents that need to be printed urgently for a client meeting this afternoon. Can you help me get this resolved?",
"creation_timestamp":1734883200000,
"user_modified_timestamp":1734883200000,
"type":"simulation",
"tool_mocks":[
{
"output":"{\"status\":\"success\",\"ticket_id\":\"12345\",\"ticket_number\":\"T20231222-0145\",\"assigned_tech\":\"John Martinez\",\"transfer_phone\":\"+17734699726\"}",
"input_match_rule":{
"type":"any"
},
"type":"mcp",
"tool_name":"createTicket"
}
],
"llm_model":"gpt-4.1-mini"
}
Retell Conversation:
Agent: Creating your ticket now.
Tool Invocation: createTicket
tool_call_id: bc147b96b4241315
{
"contactName": "Alex Johnson",
"contactPhone": "+15555551234",
"contactEmail": "alex.johnson@example.com",
"preferredContactMethod": "phone",
"title": "HP LaserJet Pro printer offline - second floor break room",
"issueDescription": "HP LaserJet Pro printer located next to the break room on the second floor has been offline since this morning. User has tried restarting the printer but it's still not showing up on the network. No error lights or messages displayed on the printer itself. Other devices on the second floor are connecting to the network without issues. User needs this resolved urgently for client meeting this afternoon - no reliable workaround available as other printers are too far or busy. Work is currently blocked.",
"ticketType": "2",
"priority": "1",
"externalID": "playground",
"execution_message": "Creating your ticket now."
}
Tool Result
tool_call_id: bc147b96b4241315
"Not connected"
MCP Server logs:
> @layer7systems/autotask-mcp-retell@0.1.0 dev
> tsx src/index.ts
[dotenv@17.2.3] injecting env (10) from .env.development -- tip: ⚙️ specify custom .env file path with { path: '/custom/path/.env' }
[11:06:01.068] INFO (56344): Loaded IP addresses from whitelist
count: 3
file: "/Users/richardalvarez/Dev/layer7-systems/autotask-mcp-retell/.whitelist"
[11:06:01.072] INFO (56344): MCP server created with tool registered
toolName: "createTicket"
[11:06:01.072] INFO (56344): MCP server instance created
[11:06:01.074] INFO (56344): MCP server started
port: 3000
auth: "enabled"
ipWhitelist: "enabled (3 IPs)"
autotaskConfigured: true
[11:07:00.585] INFO (56344): Incoming HTTP request
method: "POST"
path: "/mcp"
sessionId: "none"
authorization: "present"
[11:07:00.600] INFO (56344): MCP request received
method: "initialize"
sessionId: "none"
id: 0
[11:07:00.602] INFO (56344): Initializing new session
[11:07:00.602] INFO (56344): Connecting transport to MCP server
[11:07:00.603] INFO (56344): Handling initialize request
[11:07:00.605] INFO (56344): Session initialized - transport stored
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
[11:07:00.876] INFO (56344): Incoming HTTP request
method: "POST"
path: "/mcp"
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
authorization: "present"
[11:07:00.877] INFO (56344): MCP request received
method: "notifications/initialized"
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
[11:07:00.878] INFO (56344): Handling request with existing transport
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
method: "notifications/initialized"
[11:07:01.065] INFO (56344): Incoming HTTP request
method: "GET"
path: "/mcp"
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
authorization: "present"
[11:07:01.065] INFO (56344): SSE connection request
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
activeSessions: 1
[11:07:01.065] INFO (56344): New SSE stream establishing
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
[11:07:01.166] INFO (56344): Incoming HTTP request
method: "POST"
path: "/mcp"
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
authorization: "present"
[11:07:01.167] INFO (56344): MCP request received
method: "tools/list"
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
id: 1
[11:07:01.167] INFO (56344): Handling request with existing transport
sessionId: "943105e7-5906-4f09-a52f-8d264407484e"
method: "tools/list"
Verified behavior:
- MCP Handshake happens when a test is run.
- Tool execution fails and mock function responses for MCP tools are not being used at runtime.
- The format for MCP responses is not made explicit in the documentation (MCP Node - Retell AI). Following the MCP specification, I should be able to respond with
structuredContentto Retell along with a systems message. Right now, I send stringified JSON objects using thetextresponse type.
Preventing me from being able to unit test my agents without unintended mock API calls. And even if I wanted to run tools with my live MCP server, it seems as though the test runner cannot connect and execute them properly!
Hope this helps and we can solve it.