← Back to Dashboard
1. Project Scaffolding2. Registering Tools3. Adding Resources & Prompts4. Connecting & Publishing
Adding Resources & Prompts
Completing Your Server's Capabilities
A well-rounded MCP server doesn't just have tools - it also exposes Resources (data the AI can read) and Prompts (templates users can trigger).
Adding Resources
// Static Resource: Server documentation
server.resource(
"server-readme",
"file:///docs/README.md",
{ description: "Server documentation and usage guide" },
async (uri) => ({
contents: [{
uri: uri.href,
text: "# Notes Server\n\nThis MCP server manages your markdown notes..."
}]
})
);
// Dynamic Resource Template: Individual notes
server.resourceTemplate(
"note",
"notes://note/{filename}",
{ description: "Read a specific note by filename" },
async (uri, { filename }) => {
const content = await readFile(
join(process.env.NOTES_DIR || "./notes", filename),
"utf-8"
);
return {
contents: [{ uri: uri.href, text: content }]
};
}
);
Adding Prompts
// Prompt: Summarize all notes on a topic
server.prompt(
"summarize_topic",
{
topic: z.string().describe("The topic to summarize across all notes")
},
({ topic }) => ({
messages: [
{
role: "user",
content: {
type: "text",
text: `Search my notes for everything related to "${topic}" and create a complete summary. Include key facts, dates, and action items. Organize by theme.`
}
}
]
})
);
// Prompt: Daily review
server.prompt(
"daily_review",
{},
() => ({
messages: [
{
role: "user",
content: {
type: "text",
text: "Review all my recent notes from the last 7 days. Summarize key decisions, flag overdue action items, and suggest priorities for today."
}
}
]
})
);
When to Use Each Capability
| Capability | User Interaction | LLM Interaction | Best For |
|---|---|---|---|
| Tool | Invisible (LLM calls it) | Can call autonomously | Actions, API calls, mutations |
| Resource | Can browse/attach in UI | Can read when attached | Files, configs, documentation |
| Prompt | Clicks to activate in UI | Receives as message context | Complex workflows, templates |
🎯 Pro Tip: Resources shine when paired with Host UIs. In Claude Desktop, users can attach resources like files. In Cursor, resources appear in the context panel. Design your resources for how users will discover them.
🧪 Knowledge Check
Press 1-4 to select1 of 3
What is the key difference between how Tools and Resources are triggered?
Tools are faster
The LLM calls tools autonomously; resources are attached by users via the Host UI
Resources cost more tokens
There is no difference