From 4e650dedf569d4fc248805eed7e95763f78e370c Mon Sep 17 00:00:00 2001
From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
Date: Fri, 25 Apr 2025 14:34:56 -0400
Subject: [PATCH] Update resources.mdx
---
docs/servers/resources.mdx | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/docs/servers/resources.mdx b/docs/servers/resources.mdx
index 4db09f209..573379593 100644
--- a/docs/servers/resources.mdx
+++ b/docs/servers/resources.mdx
@@ -251,13 +251,18 @@ With these two templates defined, clients can request a variety of resources:
+
+Please note: the Model Context Protocol URI standard follows RFC 6570, which does not include support for wildcard parameters. FastMCP extends the template syntax to support wildcards (`{param*}`), and because template matching happens entirely in the FastMCP server, it is not expected that these wildcards will cause compatibility issues with other MCP implementations. However, this can not be guaranteed.
+
+
Resource templates support wildcard parameters that can match multiple path segments. While standard parameters (`{param}`) only match a single path segment and don't cross "/" boundaries, wildcard parameters (`{param*}`) can capture multiple segments including slashes. Wildcards capture all subsequent path segments *up until* the defined part of the URI template (whether literal or another parameter). This allows you to have multiple wildcard parameters in a single URI template.
-```python
+```python {15, 23}
from fastmcp import FastMCP
mcp = FastMCP(name="DataServer")
+
# Standard parameter only matches one segment
@mcp.resource("files://{filename}")
def get_file(filename: str) -> str:
@@ -265,6 +270,7 @@ def get_file(filename: str) -> str:
# Will only match files://
return f"File content for: {filename}"
+
# Wildcard parameter can match multiple segments
@mcp.resource("path://{filepath*}")
def get_path_content(filepath: str) -> str:
@@ -272,6 +278,7 @@ def get_path_content(filepath: str) -> str:
# Can match path://docs/server/resources.mdx
return f"Content at path: {filepath}"
+
# Mixing standard and wildcard parameters
@mcp.resource("repo://{owner}/{path*}/template.py")
def get_template_file(owner: str, path: str) -> dict: