Core Concepts
Resources
Expose static or templated MCP resources from src/resources/.
Resources are read-only MCP content the model can fetch with resources/read.
Add a resource folder
src/resources/inbox/
resource.tsDefine the resource
import { defineResource } from "bitmcp";
const inbox =
"# Inbox\n\n- Review quarterly report\n- Reply to design feedback";
export default defineResource({
uri: "notes://inbox",
name: "inbox",
title: "Inbox",
mimeType: "text/markdown",
async read() {
return { text: inbox };
},
});Test in dev
pnpm devCall resources/list and resources/read from your MCP client with URI notes://inbox.
Reference
Folder layout
| File | Registers |
|---|---|
resource.ts | Static resource (defineResource) |
template.ts | Parameterized template (defineResourceTemplate) |
Folder name is the module name. URI and name come from your definition.
defineResource options
| Field | Description |
|---|---|
uri | Stable resource URI |
name | Short name for listings |
title | Display title |
mimeType | MIME type returned on read |
read | Returns { text } or { blob } |
Resource templates
For dynamic URIs, use defineResourceTemplate with uriTemplate, read, and optional complete for argument completion.