Skip to content

Implement Support for Resource Templates #502

@KuechA

Description

@KuechA

Target: server
Component: sdk-server
Scenarios: resources-templates-read
Specification: https://modelcontextprotocol.io/specification/2025-11-25/server/resources#resource-templates

Is your feature request related to a problem? Please describe.

The MCP specification discusses the possibility of using resource templates. In my understanding, these would be useful to access/traverse resources. In my case, I'd love to use this to make a graph representation of https://github.com/Fraunhofer-AISEC/cpg available to an agent. However, these are currently not supported by the kotlin-sdk, so I was wondering how to support them.

Describe the solution you'd like
I would like to have resource templates implemented in the kotlin-sdk for MCP.

Describe alternatives you've considered
Alternatives are:

  • Using tools instead of resources/resource templates
  • Using resources and them parsing arguments in the code itself (see the suggestion here)

Additional context
I tried to start with a prototypical implementation in #503 and would love to discuss alternative solutions, ideas on the design and implementation of this system and suggestions thereof.

Current state

The SDK's Server / FeatureRegistry does not implement addResourceTemplate() with URI pattern matching. Resources are looked up by exact URI, so a request for test://template/123/data does not match the registered template test://template/{id}/data.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions