Skip to content

Add add_resource_template() to MCPServer #3333

Description

@okapies

Description

MCPServer and ResourceManager have add_resource() method for static Resources, but there is no way to handle ResourceTemplate without using @resource decorator.

I am implementing the following workaround using the decorator for my usecase, but it is a bit odd.

server = MCPServer("...")

# Configure resources (implemented in other files)
server.resource("resource://users")(resources.list_users)
server.resource("resource://users/{id}")(resources.get_user)

References

It was implemented in #3208.

Activity

  1. added
    v2Affects the v2 line (2.x on main)
    on Aug 19, 2026
  2. xixi-box commented on Sep 16, 2026

    @xixi-box

    I'd like to work on this. The change looks narrowly scoped: add the missing programmatic registration path for pre-built ResourceTemplate instances, symmetric with add_resource(), and cover listing/reading with focused tests. I also found the earlier #3208 implementation and its review history, so I can preserve the intended API shape while strengthening the assertions. Per this repository's contribution workflow, could a maintainer assign #3333 to me (@xixi-box) if you'd like me to proceed with the PR?

  3. added
    v1Affects the v1.x maintenance line
    on Oct 1, 2026
  4. added
    enhancementRequest for a new feature that's not currently supported
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequest for a new feature that's not currently supportedv1Affects the v1.x maintenance linev2Affects the v2 line (2.x on main)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions