Understanding MCP Resources
Understanding MCP Resources
Resources represent data or files that an MCP client can read. This includes text, JSON, binary data, images, or any file content. This post explores how resources work using the SQLite MCP server as a case study.
TL;DR
Resources are data or files that can be read. Tools are functions that can be executed. The SQLite MCP server exposes table schemas as resources and provides a query tool. Models read the schemas, then write queries using the tool.
Case Study: SQLite MCP Server
The SQLite MCP server provides a clear example of resources in practice. You point it at any SQLite database file, and it exposes the schemas as resources.
What it exposes:
Resources:
schema://sqlite/{table}- The CREATE TABLE statement for any table in the databaseschema://sqlite/all- JSON mapping of all table schemas
Tool:
sql_query- Executes read-only SQL SELECT statements
How it works:
# Using the official MCP Python SDK
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
server_params = StdioServerParameters(
command="uvx",
args=["mcp-server-sqlite",
"--db-path", "my_database.db"]
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# 1. List available resources
resources = await session.list_resources()
# Returns URIs for whatever tables exist:
# schema://sqlite/products
# schema://sqlite/customers
# schema://sqlite/all
# 2. Read a schema resource
result = await session.read_resource(
uri="schema://sqlite/products"
)
schema = result.contents[0].text
# Returns the actual CREATE TABLE statement:
# CREATE TABLE products (
# id INTEGER PRIMARY KEY,
# name TEXT,
# price REAL
# )
# 3. Model sees the schema structure
# 4. Model calls the query tool
data = await session.call_tool(
"sql_query",
{
"query": "SELECT * FROM products WHERE price < 100"
}
)The model reads schema resources to understand table structure, then writes precise queries.
Resources vs Tools
Resources are data that can be read:
- Database table schemas
- Documentation files
- Configuration data
- Dataset descriptions
- Binary files, images
Tools are functions that can be executed:
- SQL queries
- File searches
- API calls
- Calculations
Resources provide information. Tools perform actions.
Current State
As of November 2025, Claude Desktop requires manual resource selection. Users click the plus icon to add resources to conversations. The MCP specification describes "automatic context inclusion based on the AI model's selection," but this is not widely implemented yet.
When to Use Resources
Use resources when you have data or files that models should read:
- Database schemas - Table structures that guide query construction
- Documentation - API references, guides, explanations
- Configuration - Settings, constants, available options
- Dataset descriptions - What data exists, its structure, date ranges
- Files - Text, JSON, binary data, images, any file content
Use tools when you have operations to execute:
- Queries - Search, filter, aggregate data
- Actions - Create, update, delete operations
- Computations - Calculate, transform, analyze
- External calls - Fetch URLs, call APIs
References
- SQLite MCP Server - Reference implementation showing schema resources
- Model Context Protocol Specification - Official MCP spec
- FastMCP Resources Documentation - Guide to building resources with FastMCP