Skip to content

Commit c114663

Browse files
committed
Update logging.md
1 parent 4fd8cef commit c114663

File tree

1 file changed

+11
-43
lines changed

1 file changed

+11
-43
lines changed

docs/specification/server/utilities/logging.md

Lines changed: 11 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ The Model Context Protocol (MCP) provides a standardized way for servers to send
1010

1111
## User Interaction Model
1212

13-
Implementations are free to expose logging through any interface pattern that suits their needs - the protocol itself does not mandate any specific user interaction model.
13+
Implementations are free to expose logging through any interface pattern that suits their needs—the protocol itself does not mandate any specific user interaction model.
1414

1515
## Capabilities
1616

17-
Servers that support logging MUST include a `logging` capability in their `ServerCapabilities` during initialization:
17+
Servers that emit log message notifications **MUST** declare the `logging` capability:
1818

1919
```json
2020
{
@@ -26,7 +26,7 @@ Servers that support logging MUST include a `logging` capability in their `Serve
2626

2727
## Log Levels
2828

29-
The protocol defines standard syslog severity levels as specified in [RFC 5424](https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1):
29+
The protocol follows the standard syslog severity levels specified in [RFC 5424](https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1):
3030

3131
| Level | Description | Example Use Case |
3232
|------------|--------------------------------------|----------------------------------------|
@@ -43,7 +43,7 @@ The protocol defines standard syslog severity levels as specified in [RFC 5424](
4343

4444
### Setting Log Level
4545

46-
To configure the minimum log level, clients send a `logging/setLevel` request:
46+
To configure the minimum log level, clients **MAY** send a `logging/setLevel` request:
4747

4848
**Request:**
4949
```json
@@ -101,67 +101,35 @@ sequenceDiagram
101101
Note over Server: Only sends error level<br/>and above
102102
```
103103

104-
## Common Message Patterns
105-
106-
### Operation Progress
107-
```json
108-
{
109-
"level": "info",
110-
"logger": "file_processor",
111-
"data": {
112-
"operation": "scan",
113-
"progress": "50%",
114-
"filesProcessed": 150,
115-
"totalFiles": 300
116-
}
117-
}
118-
```
119-
120-
### Error Reporting
121-
```json
122-
{
123-
"level": "error",
124-
"logger": "git_clone",
125-
"data": {
126-
"error": "Repository unreachable",
127-
"details": {
128-
"repository": "github.com/example/repo",
129-
"attempt": 2,
130-
"maxAttempts": 3
131-
}
132-
}
133-
}
134-
```
135-
136104
## Error Handling
137105

138-
Servers SHOULD return standard JSON-RPC errors for common failure cases:
106+
Servers **SHOULD** return standard JSON-RPC errors for common failure cases:
139107

140108
- Invalid log level: `-32602` (Invalid params)
141109
- Configuration errors: `-32603` (Internal error)
142110

143111
## Implementation Considerations
144112

145-
1. Servers SHOULD:
113+
1. Servers **SHOULD**:
146114
- Rate limit log messages
147115
- Include relevant context in data field
148116
- Use consistent logger names
149117
- Remove sensitive information
150118

151-
2. Clients SHOULD:
152-
- Handle out-of-order messages
119+
2. Clients **MAY**:
120+
- Present log messages in the UI
153121
- Implement log filtering/search
154122
- Display severity visually
155-
- Support log persistence
123+
- Persist log messages
156124

157125
## Security
158126

159-
1. Log messages MUST NOT contain:
127+
1. Log messages **MUST NOT** contain:
160128
- Credentials or secrets
161129
- Personal identifying information
162130
- Internal system details that could aid attacks
163131

164-
2. Implementations SHOULD:
132+
2. Implementations **SHOULD**:
165133
- Rate limit messages
166134
- Validate all data fields
167135
- Control log access

0 commit comments

Comments
 (0)