MCP

Resources

Serve structured data and files as MCP resources.

Resources

MCP resources are structured data objects that your server can expose — files, database records, API responses, or any context the model should be aware of.

Defining Resources

Each resource has a URI, a MIME type, and content. The agent can request specific resources by URI or list available ones from the server.

Resource Templates

Use resource templates with URI patterns to serve dynamic data. For example, file://{path} can serve any file from a mounted directory.

What are MCP resources?

Resources are structured data objects your MCP server exposes to agents — files, database records, API responses, documentation pages, or any content the agent should have access to. Unlike tools (which perform actions), resources are read-only data providers.

Resource anatomy

Each resource has a URI (a unique identifier), a name (human-readable), an optional description, and a MIME type. Common MIME types used in Queue: text/plain for source code, text/markdown for docs, application/json for structured data.

Defining static resources

server.resource( ‘docs://architecture’, ‘Architecture Overview’, ‘High-level overview of the system architecture.’, async () => ({ contents: [{ uri: ‘docs://architecture’, mimeType: ‘text/markdown’, text: architectureMarkdown }] }) );

Resource templates

Resource templates use URI patterns to serve dynamic data. The pattern uses {variableName} placeholders:

server.resourceTemplate( ‘file://{path}’, ‘Read a file from the workspace’, async ({ path }) => ({ contents: [{ uri: `file://${path}`, mimeType: ‘text/plain’, text: readFile(path) }] }) );

When to use resources vs tools

Use resources for data the agent should be able to request on demand — documentation, configuration, reference files. Use tools for actions: reading the filesystem dynamically, calling APIs, running code. The distinction helps the model understand whether it is reading context or taking an action.

On this page

Create a free website with Framer, the website builder loved by startups, designers and agencies.