Skip to main content

๐Ÿš€ Getting Started

This guide will help you integrate the ClosedLoop MCP Server with your AI client (Claude, Cursor, or custom MCP client).

๐Ÿ“‹ Prerequisites

Required

  • Valid ClosedLoop AI account
  • API key from your team
  • MCP-compatible AI client

API Key Setup

  1. Visit ClosedLoop AI Dashboard
  2. Generate a new API key for your team
  3. Copy the 64-character API key
  4. Store it securely (environment variable recommended)

๐Ÿ”ง MCP Server Access

The ClosedLoop MCP Server is deployed as a standalone service and can be accessed via HTTP MCP protocol.

Server Information

  • Server URL: https://mcp.closedloop.sh
  • Protocol: HTTP MCP (JSON-RPC 2.0)
  • Authentication: Bearer token (API key) in Authorization header

Available Endpoints

  • MCP Protocol: POST https://mcp.closedloop.sh/
  • Health Check: GET https://mcp.closedloop.sh/health

MCP Protocol Usage

List Available Tools

curl -X POST https://mcp.closedloop.sh/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list"
  }'

Call a Tool

curl -X POST https://mcp.closedloop.sh/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "list_insights",
      "arguments": {
        "limit": 10
      }
    }
  }'

๐Ÿ” Security Configuration

Environment Variables

# Secure API key storage
export CLOSEDLOOP_API_KEY="your-secure-api-key"

# Optional: Custom server URL (default: https://mcp.closedloop.sh)
export MCP_SERVER_URL="https://mcp.closedloop.sh"

API Key Security

  • Never commit API keys to version control
  • Use environment variables or secure key management
  • Rotate API keys regularly
  • Monitor API key usage

Network Security

  • Use HTTPS for all connections
  • Consider VPN for sensitive environments
  • Monitor network traffic

๐Ÿงช Testing Your Integration

1. Verify Connection

{
  "name": "list_insights",
  "arguments": {
    "limit": 1
  }
}
Expected Response:
{
  "content": [
    {
      "type": "text",
      "text": "{\"success\": true, \"data\": {\"insights\": [...], \"pagination\": {...}}}"
    }
  ]
}

2. Test Date Filtering

{
  "name": "list_insights",
  "arguments": {
    "date_from": "2024-01-01",
    "date_to": "2024-01-31",
    "limit": 5
  }
}

3. Test Detail Retrieval

{
  "name": "get_insight_detail",
  "arguments": {
    "insight_id": "your-insight-id-here"
  }
}

๐Ÿ”ง Troubleshooting

For comprehensive troubleshooting information, see the Error Handling Guide.

Debug Mode

Enable Verbose Logging

export DEBUG=mcp-server:*
npx @closedloop-ai/mcp-client

Check Server Health

curl https://mcp.closedloop.sh/health
Expected Response:
{
  "status": "healthy",
  "timestamp": "2024-01-15T10:30:00Z",
  "version": "1.0.0"
}

๐Ÿ“Š Usage Examples

Basic Insight Analysis

{
  "name": "list_insights",
  "arguments": {
    "limit": 10,
    "date_from": "2024-01-01"
  }
}

Sentiment Analysis

{
  "name": "list_insights",
  "arguments": {
    "limit": 50,
    "date_from": "2024-01-01",
    "date_to": "2024-01-31"
  }
}

Detailed Investigation

{
  "name": "get_insight_detail",
  "arguments": {
    "insight_id": "123e4567-e89b-12d3-a456-426614174000"
  }
}

๐ŸŽฏ Best Practices

Efficient Data Usage

  • Use date ranges to limit results
  • Start with small page sizes for testing
  • Cache results when appropriate
  • Use get_insight_detail only when needed

Security

  • Store API keys securely
  • Monitor API key usage
  • Rotate keys regularly
  • Use least-privilege access

Performance

  • Use pagination for large datasets
  • Consider date ranges for historical data
  • Implement caching where appropriate

๐Ÿ”— Multiple Teams

To access data from multiple teams, use different API keys for each team:
# Team 1
curl -X POST https://mcp.closedloop.sh/ \
  -H "Authorization: Bearer TEAM1_API_KEY" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'

# Team 2  
curl -X POST https://mcp.closedloop.sh/ \
  -H "Authorization: Bearer TEAM2_API_KEY" \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}'

๐Ÿ“ž Support

Documentation

Contact

Community

  • GitHub Issues: Report bugs and request features
  • Discord: Join our community for discussions
  • Documentation: Check our comprehensive guides

Ready to Use MCP Tools?

Learn about the available MCP tools and how to use them effectively