What is MCP Resource?
MCP Resource is a read-oriented context primitive exposed by an MCP Server, representing data such as files, records, documents, schemas, repository state, or generated views that an AI application can inspect.
Quick Facts
| Specification | Official Specification |
|---|
How It Works
An MCP Resource gives an AI application access to contextual data without necessarily performing an action. It is useful for exposing documents, file contents, database records, logs, API objects, or synthetic views such as a project summary. A resource should have a stable URI, clear content type, and permission rules. It should not be treated as harmless by default: resource content can include sensitive data or prompt-injection text that may influence downstream model behavior.
Key Characteristics
- Read-oriented primitive: exposes context rather than an executable operation
- Addressable data: commonly identified by a URI or another stable resource identifier
- Typed content: may include text, JSON, binary metadata, schemas, or structured records
- Permission-sensitive: should respect user, workspace, tenant, and data classification boundaries
- Injection-aware: untrusted resource content must be separated from instructions
Common Use Cases
- Providing a coding assistant with read-only access to selected project files
- Exposing database schema information without allowing arbitrary queries
- Returning a document or knowledge-base page for model grounding
- Making logs, metrics summaries, or issue details available as context
- Supplying reusable reference data to an agent before tool execution
Example
Loading code...Frequently Asked Questions
How is an MCP Resource different from an MCP Tool?
A resource is primarily context to read. A tool performs an operation. Reading a document is usually a resource pattern, while creating a ticket or sending a message is a tool pattern.
Can MCP Resources be dynamic?
Yes. A resource can represent generated or computed views, such as a current repository summary, provided the server describes and updates it consistently.
Are MCP Resources safe because they are read-only?
No. Read-only content can still contain secrets, personal data, or prompt-injection instructions. Hosts and agents should treat resource content as data, not trusted instructions.
What metadata should a resource expose?
Useful metadata includes URI, name, MIME type, description, source, freshness, permissions, and any identifiers needed for citation or audit.