Skip to content

feat: Add URI template support for MCP resources #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tzolov
Copy link
Contributor

@tzolov tzolov commented Apr 26, 2025

Implement URI template functionality for MCP resources, allowing dynamic resource URIs with variables in the format {variableName}.

  • Enable resource URIs with variable placeholders (e.g., "/api/users/{userId}")

  • Automatic extraction of variable values from request URIs

  • Validation of template arguments in completions

  • Matching of request URIs against templates

  • Add new URI template management interfaces and implementations

  • Enhanced resource template listing to include templated resources

  • Updated resource request handling to support template matching

  • Test coverage for URI template functionality

tzolov added 3 commits April 26, 2025 10:33
Implement URI template functionality for MCP resources, allowing dynamic
resource URIs with variables in the format {variableName}.

- Enable resource URIs with variable placeholders (e.g., "/api/users/{userId}")
- Automatic extraction of variable values from request URIs
- Validation of template arguments in completions
- Matching of request URIs against templates

- Add new URI template management interfaces and implementations
- Enhanced resource template listing to include templated resources
- Updated resource request handling to support template matching
- Test coverage for URI template functionality

Signed-off-by: Christian Tzolov <[email protected]>
Add convenience methods to AsyncSpecification for registering multiple completions at once:

- completions(List) for bulk registration from collections
- completions(AsyncCompletionSpecification...) for inline varargs registration

Signed-off-by: Christian Tzolov <[email protected]>
Adds the ability to customize the URI template manager factory in both synchronous and asynchronous MCP servers.

- Adding a configurable uriTemplateManagerFactory field to both AsyncSpecification and SyncSpecification classes
- Adding builder methods to allow setting a custom URI template manager factory
- Modifying constructors to pass the URI template manager factory to the server implementation
- Updating the server implementation to use the provided factory

Signed-off-by: Christian Tzolov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant