Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.getmcp.com/llms.txt

Use this file to discover all available pages before exploring further.

What is a Resource?

Resources are a way to expose data content — documents, files, database query results, or any structured information — to AI clients via the MCP resources/read method. Unlike tools (which execute actions), resources provide read-only content that the AI can reference. Think of resources as:
  • Documentation or knowledge base articles the AI should be aware of
  • Real-time data from your database (e.g., product catalog, user list)
  • Static configuration or reference content
  • WordPress posts/pages exposed as MCP-readable content

Resource Properties

PropertyDescription
URIUnique identifier for the resource (e.g., docs://intro)
NameHuman-readable display name
DescriptionWhat the resource contains; used by AI for discovery
MIME TypeContent type (e.g., text/plain, application/json, text/markdown)
Data Source TypeWhere the content comes from
Data Source ConfigConfiguration object for the chosen data source
Template URIURI template (RFC 6570) for parameterized resources

Resource URI

Every resource has a unique URI that serves as its identifier. Any URI scheme is valid:
docs://getting-started
config://app-settings
resource://products/featured
file:///data/report.json
AI clients reference resources by URI when calling resources/read.

Data Source Types

TypeDescription
staticContent stored directly in data_source_config.content
urlContent fetched from an external URL at read time
wp_queryContent generated from a WordPress query (posts, pages, CPTs)
callbackContent generated by a custom registered PHP function

static

The simplest type. Define the content directly in the editor — it never changes unless you update it:
{
  "content": "# API Documentation\n\nThis server provides tools for managing customer records."
}
Use static resources for documentation, configuration, or any content that changes infrequently.

url

Content is fetched from an external URL each time the resource is read. The fetch happens server-side from WordPress, so it works behind firewalls:
{
  "url": "https://api.example.com/data.json",
  "cache_ttl": 300
}
cache_ttl (optional, seconds) caches the remote response to avoid hitting the upstream URL on every read. Default is 0 (no cache).

wp_query

Query your own WordPress database and expose the results as a resource. Accepts any standard WP_Query argument:
{
  "post_type": "post",
  "posts_per_page": 10,
  "orderby": "date",
  "order": "DESC",
  "post_status": "publish"
}
Common uses: blog post lists, WooCommerce products, custom post types, page content.

callback

Call a registered PHP function to generate content dynamically. The callback receives ($resource, $params) and must return a string:
{
  "callback": "my_plugin_inventory_callback"
}
Register the callback in your theme or plugin:
function my_plugin_inventory_callback( $resource, $params ) {
    $items = get_option( 'my_plugin_inventory', [] );
    return json_encode( $items );
}

Resource Templates

Resource templates allow parameterized resources using URI templates (RFC 6570). Instead of a fixed URI pointing to one piece of content, a template defines a pattern where part of the URI is a variable the AI client fills in at read time.

How Templates Work

Set the Template URI field to a pattern with {variable} placeholders:
resource://products/{product_id}
docs://posts/{slug}
config://users/{user_id}/settings
When an AI client calls resources/templates/list, it receives the template pattern. The client then substitutes concrete values and calls resources/read with the expanded URI:
# Template:
resource://products/{product_id}

# Expanded URI requested by client:
resource://products/123
resource://products/456

Static URI vs Template URI

Static URITemplate URI
MCP methodresources/listresources/templates/list
URIFixed, e.g. docs://introPattern, e.g. docs://posts/{slug}
Use caseSingle documentFamily of documents with variable parts
Data sourceAny typeTypically callback or url with the variable forwarded

Template Example

A resource that serves any WordPress post by slug:
FieldValue
URIwp://posts/latest
NamePost by Slug
Template URIwp://posts/{slug}
Data Source Typecallback
Data Source Config{ "callback": "getmcp_get_post_by_slug" }
function getmcp_get_post_by_slug( $resource, $params ) {
    $slug = $params['slug'] ?? '';
    $post = get_page_by_path( $slug, OBJECT, 'post' );
    if ( ! $post ) return 'Post not found.';
    return $post->post_title . "\n\n" . wp_strip_all_tags( $post->post_content );
}
The AI client calls resources/read with wp://posts/my-post-slug and receives that post’s content.

Creating a Resource

1

Open the Resources Tab

Inside a server, click the Resources tab.
2

Click Add Resource

Click Add Resource to open the resource editor.Add Resource
3

Set URI and Name

Enter a URI (e.g., docs://api-overview) and a human-readable name.
4

Choose Data Source Type

Select the data source type and fill in the corresponding config fields.
5

Set Template URI (optional)

If this is a parameterized resource, add a URI template pattern (e.g., docs://posts/{slug}).
6

Save

Click Save. The resource is now available via resources/list (or resources/templates/list if a template URI is set) and resources/read.
Resource Editor

MCP Protocol

Resources integrate with the standard MCP protocol methods:
  • resources/list — Returns all resources that have a fixed URI
  • resources/read — Returns the content of a specific resource by URI
  • resources/templates/list — Returns resources that have a template_uri set