Add missing add_resource_template() to MCPServer

Closed
OK
2mo ago
+36-3

Motivation and Context

Add the missing add_resource_template() method to MCPServer and ResourceManager to manage resource template implementations manually and independently without using the @mcp.resource decorator.

Note that this PR leaves add_template() in place to maintain backward compatibility.

Fixes #3333.

How Has This Been Tested?

n/a

Breaking Changes

Non-breaking changes.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context