Skip to main content

Overview

The Servers API allows you to manage MCP servers, configure proxy settings, and monitor server health. All endpoints require authentication via API key.

Base URL

https://api.agentflare.com/v1/servers

Endpoints

List Servers

curl -X GET \
  "https://api.agentflare.com/v1/servers" \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json"
Response:
{
  "success": true,
  "data": [
    {
      "id": "srv_abc123",
      "name": "search-server",
      "type": "http",
      "endpoint": "https://search.example.com/mcp",
      "status": "active",
      "health": "healthy",
      "created_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 1,
    "pages": 1
  }
}

Create Server

curl -X POST \
  "https://api.agentflare.com/v1/servers" \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-server",
    "type": "http",
    "endpoint": "https://my-server.example.com/mcp",
    "authentication": {
      "type": "bearer",
      "token": "server-token"
    }
  }'
Request Parameters:
FieldTypeRequiredDescription
namestringYesUnique server name
typestringYesServer type: http, websocket, stdio
endpointstringYesServer endpoint URL
authenticationobjectNoAuthentication configuration
timeoutnumberNoRequest timeout in milliseconds (default: 30000)
retryobjectNoRetry configuration
Response:
{
  "success": true,
  "data": {
    "id": "srv_abc123",
    "name": "my-server",
    "type": "http",
    "endpoint": "https://my-server.example.com/mcp",
    "status": "active",
    "health": "unknown",
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
}

Get Server

curl -X GET \
  "https://api.agentflare.com/v1/servers/{server_id}" \
  -H "Authorization: Bearer <your-api-key>"

Update Server

curl -X PUT \
  "https://api.agentflare.com/v1/servers/{server_id}" \
  -H "Authorization: Bearer <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "updated-server-name",
    "timeout": 60000
  }'

Delete Server

curl -X DELETE \
  "https://api.agentflare.com/v1/servers/{server_id}" \
  -H "Authorization: Bearer <your-api-key>"

Server Health Check

curl -X GET \
  "https://api.agentflare.com/v1/servers/{server_id}/health" \
  -H "Authorization: Bearer <your-api-key>"
Response:
{
  "success": true,
  "data": {
    "status": "healthy",
    "response_time": 125,
    "last_check": "2024-01-01T00:00:00Z",
    "uptime": "99.9%",
    "error_rate": "0.1%"
  }
}

Server Configuration

HTTP/HTTPS Servers

{
  "name": "search-server",
  "type": "http",
  "endpoint": "https://search.example.com/mcp",
  "authentication": {
    "type": "bearer",
    "token": "your-server-token"
  },
  "timeout": 30000,
  "retry": {
    "enabled": true,
    "max_attempts": 3,
    "backoff": "exponential"
  }
}

WebSocket Servers

{
  "name": "realtime-server",
  "type": "websocket",
  "endpoint": "wss://realtime.example.com/mcp",
  "authentication": {
    "type": "oauth2",
    "client_id": "your-client-id",
    "client_secret": "your-client-secret"
  },
  "heartbeat": {
    "enabled": true,
    "interval": 30000
  }
}

Stdio Servers

{
  "name": "local-server",
  "type": "stdio",
  "command": "/usr/local/bin/mcp-server",
  "args": ["--config", "/etc/mcp/config.json"],
  "env": {
    "MCP_SERVER_TOKEN": "your-token",
    "LOG_LEVEL": "info"
  },
  "working_directory": "/app"
}

Error Responses

400 Bad Request

{
  "success": false,
  "error": {
    "code": "INVALID_REQUEST",
    "message": "Invalid server configuration",
    "details": {
      "field": "endpoint",
      "issue": "Invalid URL format"
    }
  }
}

404 Not Found

{
  "success": false,
  "error": {
    "code": "SERVER_NOT_FOUND",
    "message": "Server not found",
    "details": {
      "server_id": "srv_abc123"
    }
  }
}

409 Conflict

{
  "success": false,
  "error": {
    "code": "SERVER_NAME_EXISTS",
    "message": "A server with this name already exists",
    "details": {
      "name": "duplicate-server-name"
    }
  }
}

Rate Limits

  • List Servers: 100 requests per minute
  • Create Server: 10 requests per minute
  • Update Server: 30 requests per minute
  • Delete Server: 10 requests per minute
  • Health Check: 60 requests per minute

Next Steps

I