Model Context Protocol (MCP) provides a standardized way to connect AI agents to external services with type-safe, well-documented interfaces.
The Model Context Protocol is an open standard that allows AI models to securely interact with external data sources and tools. MCP provides:
Consistent API patterns across all integrations
Strong typing for parameters and return values
OAuth, API keys, and scoped permissions
Payments, invoices, subscriptions
// Stripe MCP tools
const stripeTools = [
"stripe_create_customer", // Create a new customer
"stripe_create_invoice", // Generate invoice
"stripe_create_payment_link", // Payment link for rent
"stripe_list_charges", // View payment history
"stripe_create_refund", // Process refunds
"stripe_get_balance", // Check balance
]
// Example: Create invoice for rent
const result = await agent.useTool("stripe_create_invoice", {
customer: "cus_xxx",
items: [
{ price: "price_rent_monthly", quantity: 1 },
{ price: "price_utilities", quantity: 1 }
],
due_date: "2024-02-01",
auto_advance: true
})Documents, databases, knowledge base
// Notion MCP tools
const notionTools = [
"notion_search", // Search across workspace
"notion_fetch", // Get page/database content
"notion_create_page", // Create new page
"notion_update_page", // Update existing page
"notion_query_database", // Query database
]
// Example: Create property listing page
const result = await agent.useTool("notion_create_page", {
parent: { database_id: "property_listings_db" },
properties: {
"Name": { title: [{ text: { content: "123 Main St" } }] },
"Status": { select: { name: "Available" } },
"Price": { number: 2500 },
"Bedrooms": { number: 3 }
},
children: [
{ type: "paragraph", paragraph: { rich_text: [{ text: { content: "Beautiful 3BR apartment..." } }] } }
]
})Issue tracking, project management
// Linear MCP tools
const linearTools = [
"linear_create_issue", // Create maintenance ticket
"linear_update_issue", // Update issue status
"linear_list_issues", // Get open issues
"linear_add_comment", // Add comment to issue
]
// Example: Create maintenance request
const result = await agent.useTool("linear_create_issue", {
title: "HVAC Repair - Unit 4B",
description: "Tenant reports AC not cooling properly",
teamId: "maintenance_team",
priority: 2,
labels: ["urgent", "hvac", "tenant-request"],
assigneeId: "technician_001"
})Team communication, notifications
// Slack MCP tools
const slackTools = [
"slack_send_message", // Send channel message
"slack_send_dm", // Direct message
"slack_create_channel", // Create new channel
"slack_upload_file", // Share documents
]
// Example: Alert team about urgent issue
const result = await agent.useTool("slack_send_message", {
channel: "#property-alerts",
text: "🚨 Urgent maintenance request",
blocks: [
{
type: "section",
text: {
type: "mrkdwn",
text: "*Water leak reported at 123 Main St, Unit 2A*\nTenant: John Smith\nPriority: High"
}
},
{
type: "actions",
elements: [
{ type: "button", text: { type: "plain_text", text: "Assign Technician" }, action_id: "assign" },
{ type: "button", text: { type: "plain_text", text: "View Details" }, action_id: "view" }
]
}
]
})Scheduling, reminders, appointments
// Google Calendar MCP tools
const calendarTools = [
"calendar_create_event", // Schedule viewing
"calendar_list_events", // Get availability
"calendar_update_event", // Reschedule
"calendar_delete_event", // Cancel appointment
]
// Example: Schedule property viewing
const result = await agent.useTool("calendar_create_event", {
summary: "Property Viewing - 123 Main St",
description: "Showing for prospective tenant Sarah Johnson",
start: { dateTime: "2024-02-15T14:00:00", timeZone: "Pacific/Auckland" },
end: { dateTime: "2024-02-15T14:30:00", timeZone: "Pacific/Auckland" },
attendees: [
{ email: "sarah@example.com" },
{ email: "agent@realaroha.com" }
],
reminders: {
useDefault: false,
overrides: [
{ method: "email", minutes: 1440 },
{ method: "popup", minutes: 30 }
]
}
})// lib/mcp/config.ts
import { createMcpClient } from "@/lib/mcp/client"
export const mcpClients = {
stripe: createMcpClient({
name: "stripe",
transport: "stdio",
config: {
apiKey: process.env.STRIPE_SECRET_KEY,
webhookSecret: process.env.STRIPE_WEBHOOK_SECRET,
},
permissions: ["payments:read", "payments:write", "invoices:*"],
}),
notion: createMcpClient({
name: "notion",
transport: "stdio",
config: {
token: process.env.NOTION_TOKEN,
},
permissions: ["pages:read", "pages:write", "databases:read"],
}),
linear: createMcpClient({
name: "linear",
transport: "stdio",
config: {
apiKey: process.env.LINEAR_API_KEY,
},
permissions: ["issues:*", "comments:write"],
}),
}
// Assign MCP tools to an agent
const maintenanceAgent = createAgent({
name: "Maintenance Coordinator",
mcpClients: [mcpClients.linear, mcpClients.slack],
// Agent can now use linear_* and slack_* tools
})