Stage 4 of 5v1 · c1e1f8c9
Expose resources
List and read text resources by URI.
Build it in your language
The tester treats your program as a black box: any language works. These are just the most convenient ones for this project.
Resource Provider (resources/list and resources/read)
MCP Resources offer read-only context addresses identified by custom URIs (such as memo://welcome).
Mental Model: Catalog and Read Endpoints
resources/list: Publishes available resource descriptors.resources/read: Dispatches by URI and serves file/text contents.
Your Goal in this Stage
Implement resources/list and resources/read.
Input Format (resources/list)
{ "jsonrpc": "2.0", "id": 6, "method": "resources/list" }
Output Format (resources/list)
{
"jsonrpc": "2.0",
"id": 6,
"result": {
"resources": [
{
"uri": "memo://welcome",
"name": "Welcome memo",
"mimeType": "text/plain"
}
]
}
}
Input Format (resources/read)
{
"jsonrpc": "2.0",
"id": 7,
"method": "resources/read",
"params": { "uri": "memo://welcome" }
}
Output Format (resources/read)
{
"jsonrpc": "2.0",
"id": 7,
"result": {
"contents": [
{
"uri": "memo://welcome",
"mimeType": "text/plain",
"text": "Welcome to Shipcode MCP."
}
]
}
}
Step-by-Step Implementation Guide
- Handle
"resources/list": Return descriptor array containingmemo://welcome. - Handle
"resources/read": Check URI matchesmemo://welcomeand return payload contents. - Emit output: Print JSON response with matching
id.
Acceptance Criteria
- ✅ Exposes resource catalog.
- ✅ Reads resource text accurately.
Output and errors
Multiline examples are formatted for readability. Emit compact JSON without optional spaces, with properties in the order shown by the output examples, and a final newline. Keep logs off stdout. Tests compare exact text.