MCP & Integrations
Connect your agents to external tools and services
MCP (Model Context Protocol) Integration Guide
MCP enables your VOISA AI agents to interact with external tools and services, transforming them from conversational agents into powerful automation systems.
π― What is MCP?
Overview
Model Context Protocol (MCP) is a standardized way for AI agents to:
- Connect to external services
- Execute actions beyond conversation
- Access real-time data
- Integrate with existing systems
Key Capabilities
- Calendar Integration: Book appointments directly
- Database Access: Query and update records
- API Connectivity: Interact with any REST API
- CRM Integration: Manage customer data
- Payment Processing: Handle transactions
- Email/SMS: Send notifications
ποΈ MCP Architecture
Components
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β VOISA Agent ββββββΆβ MCP Server ββββββΆβ External Tool β
β βββββββ βββββββ β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
Request Process Execute
Response Validate Return
How It Works
- Agent receives user request
- Identifies required tool
- Sends request to MCP server
- MCP server executes action
- Returns result to agent
- Agent communicates result to user
π Setting Up MCP
Step 1: Access MCP Tools
- Log in to voisa.ai/admin
- Navigate to "MCP Tools" in sidebar
- View available MCP servers
Step 2: Add MCP Server
Server Configuration
Click "+ Add MCP Server" and configure:
Basic Information:
Name: "Calendar Integration Server"
Description: "Manages appointment bookings and calendar operations"
URL: https://api.yourservice.com/mcp
Transport Type:
- SSE (Server-Sent Events): Real-time updates
- HTTP: Standard request/response
Approval Policy:
- Auto-approve all: Tools immediately available
- Require approval: Manual review needed
Authentication Setup
No Authentication:
{
"transport": "http",
"url": "https://api.example.com/mcp"
}
API Key Authentication:
{
"transport": "http",
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
OAuth Authentication:
{
"transport": "http",
"url": "https://api.example.com/mcp",
"auth": {
"type": "oauth2",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
}
}
Step 3: Discover Tools
Once connected, the system discovers available tools:
- Click on your MCP server
- View "Available Tools"
- Each tool shows:
- Name and description
- Required parameters
- Return values
π Common MCP Integrations
Calendar Integration
Google Calendar Setup
MCP Server Configuration:
{
"name": "Google Calendar MCP",
"transport": "http",
"url": "https://mcp-google-calendar.voisa.ai",
"auth": {
"type": "oauth2",
"scopes": ["calendar.events"]
}
}
Available Tools:
createEvent: Book appointmentscheckAvailability: Check free slotsupdateEvent: Modify bookingscancelEvent: Cancel appointmentslistEvents: View schedule
Usage Example:
User: "I want to book an appointment for next Tuesday at 2 PM"
Agent: [Uses createEvent tool]
Agent: "I've booked your appointment for Tuesday at 2 PM.
You'll receive a confirmation email shortly."
CRM Integration
Salesforce Setup
MCP Server Configuration:
{
"name": "Salesforce MCP",
"transport": "http",
"url": "https://mcp-salesforce.voisa.ai",
"auth": {
"type": "oauth2",
"instance_url": "https://yourinstance.salesforce.com"
}
}
Available Tools:
createLead: Add new leadsupdateContact: Modify contact infogetAccountInfo: Retrieve account detailscreateCase: Log support ticketsaddNote: Add conversation notes
Database Integration
PostgreSQL Setup
MCP Server Configuration:
{
"name": "Database MCP",
"transport": "http",
"url": "https://mcp-database.yourcompany.com",
"config": {
"connection_string": "postgresql://user:pass@host/db",
"ssl": true
}
}
Available Tools:
queryInventory: Check stock levelsupdateOrder: Modify order statusgetCustomerHistory: Retrieve past orderscheckPricing: Get current prices
Payment Processing
Stripe Integration
MCP Server Configuration:
{
"name": "Stripe MCP",
"transport": "http",
"url": "https://mcp-stripe.voisa.ai",
"auth": {
"api_key": "sk_live_..."
}
}
Available Tools:
createPaymentIntent: Initialize paymentconfirmPayment: Process paymentrefundPayment: Issue refundsgetPaymentStatus: Check status
π§ Creating Custom MCP Tools
Tool Definition
Structure:
{
"name": "bookAppointment",
"description": "Books an appointment in the calendar system",
"parameters": {
"date": {
"type": "string",
"description": "Date in YYYY-MM-DD format",
"required": true
},
"time": {
"type": "string",
"description": "Time in HH:MM format",
"required": true
},
"duration": {
"type": "integer",
"description": "Duration in minutes",
"default": 30
},
"customer_name": {
"type": "string",
"required": true
},
"service": {
"type": "string",
"enum": ["consultation", "treatment", "follow-up"]
}
},
"returns": {
"type": "object",
"properties": {
"booking_id": "string",
"confirmation_url": "string",
"status": "string"
}
}
}
Implementation Example
Node.js MCP Server:
const express = require('express');
const app = express();
// MCP endpoint
app.post('/mcp/tools/bookAppointment', async (req, res) => {
const { date, time, duration, customer_name, service } = req.body;
try {
// Your booking logic here
const booking = await calendarAPI.createBooking({
date,
time,
duration,
customer_name,
service
});
res.json({
success: true,
booking_id: booking.id,
confirmation_url: booking.url,
status: "confirmed"
});
} catch (error) {
res.json({
success: false,
error: error.message
});
}
});
// Tool discovery endpoint
app.get('/mcp/tools', (req, res) => {
res.json({
tools: [{
name: "bookAppointment",
description: "Books appointments",
// ... full tool definition
}]
});
});
π Assigning Tools to Agents
Step 1: Navigate to Agent
- Go to "Agents" tab
- Select your agent
- Click "Edit" or "Manage Tools"
Step 2: Assign Tools
- Navigate to "Tools" section
- View available tools from all MCP servers
- Select tools to enable:
β bookAppointment β checkAvailability β cancelAppointment β processPayment (not needed for this agent)
Step 3: Configure Tool Settings
Per-Tool Configuration:
{
"bookAppointment": {
"enabled": true,
"permissions": {
"max_bookings_per_call": 1,
"allowed_services": ["consultation", "follow-up"],
"advance_booking_days": 30
},
"defaults": {
"duration": 30,
"send_confirmation": true
}
}
}
Step 4: Update System Prompt
Include tool awareness in your agent's prompt:
You have access to the following tools:
1. bookAppointment: Use this to schedule appointments
- Ask for preferred date and time
- Confirm customer details
- Specify service type
2. checkAvailability: Check available time slots
- Use before suggesting times
- Offer multiple options
3. cancelAppointment: Cancel existing bookings
- Require booking ID or customer details
- Confirm cancellation
Always confirm important details before using tools.
After tool execution, clearly communicate the result.
π§ͺ Testing MCP Tools
Test Scenarios
Basic Tool Execution:
User: "I want to book an appointment"
Agent: "I'd be happy to help. What date works for you?"
User: "Next Monday"
Agent: "What time would you prefer?"
User: "2 PM"
Agent: [Executes bookAppointment tool]
Agent: "Perfect! I've booked your appointment for Monday at 2 PM."
Error Handling:
User: "Book me for tomorrow at 3 PM"
Agent: [Tool returns error: slot unavailable]
Agent: "I apologize, but 3 PM tomorrow is not available.
Would 2 PM or 4 PM work instead?"
Testing Checklist
- Tool discovery works
- Authentication successful
- Parameters validated
- Successful execution
- Error handling works
- Results communicated clearly
- Timeouts handled
- Fallbacks available
π Monitoring MCP Performance
Key Metrics
Availability:
- Server uptime: > 99.9%
- Tool availability: > 99.5%
- Response time: < 2 seconds
Usage:
- Calls per tool
- Success rate
- Error frequency
- Average execution time
Quality:
- Task completion rate
- User satisfaction
- Error recovery rate
Analytics Dashboard
Monitor in real-time:
- Go to "Analytics"
- Select "MCP Performance"
- View metrics by:
- Tool
- Server
- Time period
- Agent
π Security Considerations
Best Practices
Authentication:
- Use secure tokens
- Rotate API keys regularly
- Implement OAuth when possible
- Use HTTPS only
Authorization:
- Limit tool permissions
- Implement rate limiting
- Validate all inputs
- Audit tool usage
Data Protection:
- Encrypt sensitive data
- Minimize data exposure
- Follow GDPR guidelines
- Implement retention policies
Security Checklist
- Secure authentication configured
- SSL/TLS enabled
- Input validation implemented
- Rate limiting active
- Audit logging enabled
- Error messages sanitized
- Sensitive data protected
- Regular security reviews
π¨ Troubleshooting MCP
Common Issues
Tool Discovery Fails:
Problem: Tools not appearing
Solution:
1. Check server URL
2. Verify authentication
3. Test discovery endpoint
4. Check network connectivity
Authentication Errors:
Problem: 401/403 errors
Solution:
1. Verify credentials
2. Check token expiration
3. Confirm permissions
4. Review auth headers
Tool Execution Fails:
Problem: Tool returns errors
Solution:
1. Validate parameters
2. Check server logs
3. Test manually
4. Review error messages
Timeout Issues:
Problem: Tools timing out
Solution:
1. Increase timeout settings
2. Optimize server performance
3. Implement async handling
4. Add retry logic
π Advanced MCP Features
Batch Operations
Execute multiple tools in sequence:
{
"batch": [
{
"tool": "checkAvailability",
"params": { "date": "2025-01-20" }
},
{
"tool": "bookAppointment",
"params": { "slot": "${result[0].available_slots[0]}" }
},
{
"tool": "sendConfirmation",
"params": { "booking_id": "${result[1].id}" }
}
]
}
Conditional Execution
Tools with logic:
{
"tool": "processBooking",
"conditions": {
"if": "availability.exists",
"then": "bookAppointment",
"else": "addToWaitlist"
}
}
Event Webhooks
Real-time updates:
{
"webhooks": {
"onToolSuccess": "https://your-app.com/webhook/success",
"onToolError": "https://your-app.com/webhook/error",
"onTimeout": "https://your-app.com/webhook/timeout"
}
}
π― MCP Best Practices
Design Principles
- Keep Tools Focused: Single responsibility
- Clear Naming: Descriptive, action-oriented
- Comprehensive Docs: Full parameter descriptions
- Error Messages: Helpful, actionable
- Idempotency: Safe to retry
Implementation Tips
- Start Simple: Basic tools first
- Test Thoroughly: All scenarios
- Monitor Closely: Track performance
- Document Well: Clear instructions
- Version Control: Track changes
Optimization Strategies
- Cache Results: Reduce redundant calls
- Batch Operations: Combine related actions
- Async Processing: Non-blocking execution
- Retry Logic: Handle transient failures
- Circuit Breakers: Prevent cascade failures
π Resources
Documentation
Examples
Support
- Technical: tech@voisa.ai
- Integration: integrations@voisa.ai
- Community: community.voisa.ai
βοΈ Next Steps
MCP transforms your agents from conversational to transactional! π