[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3
SEQ. 4

Adding Resources & Prompts

🛠️ Build Your First Server10 min90 BASE XP

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 comprehensive 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

CapabilityUser InteractionLLM InteractionBest For
ToolInvisible (LLM calls it)Can call autonomouslyActions, API calls, mutations
ResourceCan browse/attach in UICan read when attachedFiles, configs, documentation
PromptClicks to activate in UIReceives as message contextComplex 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.
SYNAPSE VERIFICATION
QUERY 1 // 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
Watch: 139x Rust Speedup
Adding Resources & Prompts | Build Your First Server — MCP Academy