File size: 1,592 Bytes
07af8f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
title: "Logs"
description: "Access and manage server logs."
---

import { Card, Cards } from 'mintlify';

<Card
  title="GET /api/logs"
  href="#get-all-logs"
>
  Get all logs.
</Card>

<Card
  title="DELETE /api/logs"
  href="#clear-logs"
>
  Clear all logs.
</Card>

<Card
  title="GET /api/logs/stream"
  href="#stream-logs"
>
  Stream logs in real-time.
</Card>

---

### Get All Logs

Retrieves all stored logs.

- **Endpoint**: `/api/logs`
- **Method**: `GET`
- **Success Response**:
  ```json
  {
    "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**:
  ```json
  {
    "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"}}
  ```