Open
Description
Describe the bug
When registered a resource_template with the python sdk (mcp==1.1.0), the server runs but no resources can be selected in the UI.
To Reproduce
Steps to reproduce the behavior:
- Add code (see below)
- Run server
- Open Claude
- Try to attach a resource
Expected behavior
I would expect to be able to select a resource template.
Screenshots
*** Server installed (resource_testing
)
Desktop (please complete the following information):
- MacOSX
- Python 3.13
- mcp 1.1.0
Additional context
This is the code to register the resource templates:
@app.list_resource_templates()
async def list_resource_templates() -> list[ResourceTemplate]:
return [
ResourceTemplate(
uriTemplate=AnyUrl("file://moonshot/posts/{posts}"),
description="Posts of your moonshot account",
name="Get posts",
mimeType="application/json"
)
]
@app.read_resource()
async def read_resource(uri: AnyUrl) -> str:
logger.error(f"read resource call: {uri}")
if str(uri).startswith("file://moonshot/posts/"):
return json.dumps(["post1", "post2", "post3"], indent=2)
raise ValueError("Resource not found")