Reading Time: 4 minutes

We previously discussed using the MCP Connector to create and consume MCP tools. But MCP also defines another useful concept: Resources. 

MCP resources

Resources are a standardized way for servers to expose resources to clients. Resources allow servers to share data that provides context to language models, such as files, database schemas, or application-specific information. Each resource is uniquely identified by a URI.

1. Expose a resource

First let’s start by exposing the resource. Similarly to tools, we’ll do that through a Flow with a special trigger, in this case the <mcp:resource-listener>

The listener configuration contains all of the resources metadata, including the fact that it’s a binary (Blob) type of resource (which is convenient as the connector will automatically handle the required base64 encoding without us worrying about it). The flow then returns a PDF that’s bundled in the application. This is how that <set-payload> element looks like:

2. Make it dynamic

But we don’t really want to bundle all of our resources in the application right? After all, Mule is an integration platform. Let’s see how we can get the content from Amazon S3 instead using the Anypoint Amazon S3 connector:

We can make it even better by leveraging the <ee:cache> component to avoid the roundtrip to Amazon each time a client consumes the resource

3. Consume the resource

Finally, what happens if Mule is acting as the MCP client instead of the server? The connector’s client configuration offers two simple operations for that:

  • List Resources: Pulls down an auto paginated list of all the target servers resources
  • Read Resources: Obtains the content, locating the resource by its URI

This and so much more

Although tools are by far the most widely adopted MCP feature, there’s a lot more the protocol offers. Stay tuned as we keep supporting new features in upcoming releases.