Skip to content

Commit eb51db0

Browse files
committed
Update resources.md
1 parent c5dba5e commit eb51db0

File tree

1 file changed

+40
-33
lines changed

1 file changed

+40
-33
lines changed

docs/specification/server/resources.md

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ The Model Context Protocol (MCP) provides a standardized way for servers to expo
1212

1313
## User Interaction Model
1414

15-
Resources in MCP are designed to be application-driven, with clients determining how to incorporate context based on their needs. Applications can expose resources through UI elements for explicit selection, while implementing intelligent features for automatic context inclusion, searching and filtering. A recommended pattern is a context picker showing resources in a tree/list view that combines manual selection with automated context handling.
15+
Resources in MCP are designed to be **application-driven**, with clients determining how to incorporate context based on their needs.
16+
17+
For example, applications could:
18+
* Expose resources through UI elements for explicit selection, in a tree or list view
19+
* Allow the user to search through and filter available resources
20+
* Implement automatic context inclusion, based on heuristics or the AI model's selection
1621

1722
![Example of resource context picker](resource-picker.png)
1823

19-
However, implementations are free to expose resources through any interface pattern that suits their needs - the protocol itself does not mandate any specific user interaction model.
24+
However, implementations are free to expose resources through any interface pattern that suits their needs—the protocol itself does not mandate any specific user interaction model.
2025

2126
## Capabilities
2227

23-
Servers that support resources MUST include a `resources` capability in their `ServerCapabilities` during initialization. The capability object can specify optional features:
28+
Servers that support resources **MUST** declare the `resources` capability:
2429

2530
```json
2631
{
@@ -33,7 +38,11 @@ Servers that support resources MUST include a `resources` capability in their `S
3338
}
3439
```
3540

36-
Both `subscribe` and `listChanged` are optional - servers can support neither, either, or both:
41+
The capability supports two optional features:
42+
- `subscribe`: whether the client can subscribe to be notified of changes to individual resources.
43+
- `listChanged`: whether the server will emit notifications when the list of available resources changes.
44+
45+
Both `subscribe` and `listChanged` are optional—servers can support neither, either, or both:
3746

3847
```json
3948
{
@@ -63,15 +72,11 @@ Both `subscribe` and `listChanged` are optional - servers can support neither, e
6372
}
6473
```
6574

66-
The capability supports two optional features:
67-
- `subscribe`: Server supports subscribing to resource updates
68-
- `listChanged`: Server supports notifications about changes to the resource list
69-
7075
## Protocol Messages
7176

7277
### Listing Resources
7378

74-
To discover available resources, clients send a `resources/list` request. This operation supports pagination through the standard cursor mechanism.
79+
To discover available resources, clients send a `resources/list` request. This operation supports [pagination]({{< ref "/specification/server/utilities/pagination" >}}).
7580

7681
**Request:**
7782
```json
@@ -94,7 +99,7 @@ To discover available resources, clients send a `resources/list` request. This o
9499
"resources": [
95100
{
96101
"uri": "file:///project/src/main.rs",
97-
"name": "Main source file",
102+
"name": "main.rs",
98103
"description": "Primary application entry point",
99104
"mimeType": "text/x-rust"
100105
}
@@ -139,7 +144,7 @@ To retrieve resource contents, clients send a `resources/read` request:
139144

140145
### Resource Templates
141146

142-
Resource templates allow servers to expose parameterized resources using URI templates ([RFC 6570](https://datatracker.ietf.org/doc/html/rfc6570)):
147+
Resource templates allow servers to expose parameterized resources using [URI templates](https://datatracker.ietf.org/doc/html/rfc6570):
143148

144149
**Request:**
145150
```json
@@ -255,22 +260,31 @@ Resources can contain either text or binary data:
255260

256261
## Common URI Schemes
257262

258-
The protocol defines several standard URI schemes:
263+
The protocol defines several standard URI schemes. This list not exhaustive&mdash;implementations are always free to use additional, custom URI schemes.
264+
265+
### https://
266+
267+
Used to represent a resource available on the web.
268+
269+
Servers **SHOULD** use this scheme only when the client is able to fetch and load the resource directly from the web on its own—that is, it doesn’t need to read the resource via the MCP server.
259270

260-
| Scheme | Description | Notes |
261-
|-----------|---------------------------------------|------------------------------------------|
262-
| file:// | Filesystem-like resources | Primary scheme for code and text files |
263-
| https:// | Web resources | For directly fetchable web content |
264-
| s3:// | S3-compatible storage | For cloud storage access |
265-
| git:// | Git repositories | For version control integration |
266-
| data: | Inline data | For small embedded resources |
271+
For other use cases, servers **SHOULD** prefer to use another URI scheme, or define a custom one, even if the server will itself be downloading resource contents over the internet.
272+
273+
### file://
274+
275+
Used to identify resources that behave like a filesystem. However, the resources do not need to map to an actual physical filesystem.
276+
277+
MCP servers **MAY** identify file:// resources with an [XDG MIME type](https://specifications.freedesktop.org/shared-mime-info-spec/0.14/ar01s02.html#id-1.3.14), like `inode/directory`, to represent non-regular files (such as directories) that don’t otherwise have a standard MIME type.
278+
279+
### git://
280+
281+
Git version control integration.
267282

268283
## Error Handling
269284

270285
Servers SHOULD return standard JSON-RPC errors for common failure cases:
271286

272-
- Resource not found: `-32001`
273-
- Permission denied: `-32002`
287+
- Resource not found: `-32002`
274288
- Internal errors: `-32603`
275289

276290
Example error:
@@ -279,7 +293,7 @@ Example error:
279293
"jsonrpc": "2.0",
280294
"id": 5,
281295
"error": {
282-
"code": -32001,
296+
"code": -32002,
283297
"message": "Resource not found",
284298
"data": {
285299
"uri": "file:///nonexistent.txt"
@@ -290,14 +304,7 @@ Example error:
290304

291305
## Security Considerations
292306

293-
1. Servers MUST validate all resource URIs
294-
2. Access controls SHOULD be implemented for sensitive resources
295-
3. Binary data MUST be properly encoded
296-
4. Resource permissions SHOULD be checked before operations
297-
298-
## See Also
299-
300-
{{< cards >}}
301-
{{< card link="/server/utilities/pagination" title="Pagination" icon="document-duplicate" >}}
302-
{{< card link="/server/utilities/progress" title="Progress Tracking" icon="arrow-circle-right" >}}
303-
{{< /cards >}}
307+
1. Servers **MUST** validate all resource URIs
308+
2. Access controls **SHOULD** be implemented for sensitive resources
309+
3. Binary data **MUST** be properly encoded
310+
4. Resource permissions **SHOULD** be checked before operations

0 commit comments

Comments
 (0)