GET /api/logs

Get all logs.

DELETE /api/logs

Clear all logs.

GET /api/logs/stream

Stream logs in real-time.

Get All Logs

Retrieves all stored logs.
  • Endpoint: /api/logs
  • Method: GET
  • Success Response:
    {
      "success": true,
      "data": [
        {
          "timestamp": "2023-10-27T10:00:00.000Z",
          "level": "info",
          "message": "Server started successfully.",
          "service": "system"
        }
      ]
    }
    

Clear Logs

Deletes all stored logs.
  • Endpoint: /api/logs
  • Method: DELETE
  • Success Response:
    {
      "success": true,
      "message": "Logs cleared successfully"
    }
    

Stream Logs

Streams logs in real-time using Server-Sent Events (SSE). The connection will remain open, and new log entries will be sent as they occur.
  • Endpoint: /api/logs/stream
  • Method: GET
  • Response Format: The stream sends events with a data field containing a JSON object. The first event has type: 'initial' and contains all historical logs. Subsequent events have type: 'log' and contain a single new log entry.
  • Example Event:
    data: {"type":"log","log":{"timestamp":"2023-10-27T10:00:05.000Z","level":"debug","message":"Processing request for /api/some-endpoint","service":"mcp-server"}}