Skip to main content

MCP (Model Context Protocol)

Manage Model Context Protocol servers to extend your assistants with custom functions and external integrations.
What is MCP?: The Model Context Protocol allows your assistants to call external functions, query databases, integrate with APIs, and perform custom business logic. Learn more in our MCP Guide.

Overview

MCP endpoints allow you to:
  • Register external function servers
  • Connect functions to specific assistants
  • Manage function availability and permissions
  • Monitor MCP server status and health

Authentication

All MCP endpoints require authentication via API key or Bearer token.
curl -H "Authorization: Bearer YOUR_API_KEY" \
     https://api.plati.ai/workspace/mcps

Core Workflow

1

Register MCP Server

Create and register your MCP server with Plati
2

Connect to Assistant

Attach the MCP functions to specific assistants
3

Use in Prompts

Functions become available as {{function.name()}} in prompts
4

Monitor & Manage

Track function usage and manage connections

Endpoints

Create MCP Server

Register a new Model Context Protocol server in your workspace.
curl -X POST https://api.plati.ai/workspace/mcps \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Order Management System",
    "transport": "http",
    "url": "https://your-domain.com/mcp",
    "headers": [
      {
        "key": "Authorization",
        "value": "Bearer YOUR_MCP_API_KEY"
      }
    ]
  }'

List MCP Servers

Get all registered MCP servers in your workspace.
curl -X GET https://api.plati.ai/workspace/mcps \
  -H "Authorization: Bearer YOUR_API_KEY"

Connect MCP to Assistant

Attach an MCP server to a specific assistant to make its functions available.
curl -X PUT https://api.plati.ai/assistant/ASSISTANT_ID/mcp/MCP_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

Delete MCP Server

Remove an MCP server from your workspace.
curl -X DELETE https://api.plati.ai/workspace/mcps/MCP_ID \
  -H "Authorization: Bearer YOUR_API_KEY"

Request/Response Examples

MCP Registration Response

{
  "id": "mcp_12345",
  "name": "Order Management System",
  "url": "https://your-domain.com/mcp",
  "status": "active",
  "functions": [
    {
      "name": "check_order_status",
      "description": "Check the status of a customer order"
    },
    {
      "name": "process_refund",
      "description": "Process a refund for an order"
    }
  ],
  "created_at": "2024-01-15T10:30:00Z"
}

Connection Response

{
  "message": "MCP connected to assistant successfully",
  "functions": [
    {
      "name": "check_order_status",
      "description": "Check the status of a customer order"
    },
    {
      "name": "process_refund", 
      "description": "Process a refund for an order"
    }
  ]
}

MCP Server Requirements

Your MCP server must implement these endpoints:

GET /tools

Return available functions and their schemas.
{
  "tools": [
    {
      "name": "check_order_status",
      "description": "Check order status and tracking",
      "input_schema": {
        "type": "object",
        "properties": {
          "order_id": {
            "type": "string",
            "description": "Order ID to check"
          }
        },
        "required": ["order_id"]
      }
    }
  ]
}

POST /call

Execute function calls from assistants.
{
  "name": "check_order_status",
  "arguments": {
    "order_id": "ORD-123"
  }
}

Error Handling

{
  "error": "Invalid MCP configuration",
  "details": "URL must be a valid HTTPS endpoint"
}
{
  "error": "Authentication failed",
  "details": "Invalid API key or insufficient permissions"
}
{
  "error": "MCP server not found",
  "details": "The specified MCP ID does not exist"
}
{
  "error": "MCP server unreachable",
  "details": "Failed to connect to MCP server at specified URL"
}

Best Practices

Security

  • Always use HTTPS for MCP servers
  • Implement proper authentication
  • Validate all function inputs
  • Rate limit function calls

Performance

  • Keep function responses under 1MB
  • Implement caching where appropriate
  • Use async patterns for long operations
  • Monitor function execution times

Reliability

  • Handle errors gracefully
  • Provide clear function descriptions
  • Test all function combinations
  • Implement health check endpoints

Monitoring

  • Log all function calls
  • Monitor success/failure rates
  • Track function usage patterns
  • Set up alerting for failures

Usage in Prompts

Once connected, MCP functions are available in your assistant prompts:
You are a customer service assistant with access to order management functions.

Available functions:
- {{function.check_order_status(order_id)}} - Get order status and tracking
- {{function.process_refund(order_id, reason)}} - Process customer refunds
- {{function.update_shipping(order_id, address)}} - Update shipping address

When customer asks about their order:
1. Ask for order number if not provided
2. Call {{function.check_order_status(order_id)}}
3. Provide helpful summary of results

For refund requests:
1. Verify order eligibility
2. Call {{function.process_refund(order_id, reason)}}
3. Confirm next steps with customer

Next Steps