Skip to content

[DNM] Spike: add resources#713

Draft
Cali0707 wants to merge 2 commits intocontainers:mainfrom
Cali0707:add-crd-resource
Draft

[DNM] Spike: add resources#713
Cali0707 wants to merge 2 commits intocontainers:mainfrom
Cali0707:add-crd-resource

Conversation

@Cali0707
Copy link
Collaborator

This PR explores how to add resources to the MCP server

DO NOT MERGE

I want to explore how different clients use resources, with this branch as an experiment, to see how we should best implement these

@Cali0707
Copy link
Collaborator Author

It seems like, at a minimum, we probably want to only use static resources and not a template: anthropics/claude-code#4110

This is probably fine since I believe most clients do not load each resource into the agent's context

@manusa
Copy link
Member

manusa commented Jan 30, 2026

It seems like, at a minimum, we probably want to only use static resources and not a template: anthropics/claude-code#4110

This is probably fine since I believe most clients do not load each resource into the agent's context

In general, I never attempted to add resources to the server because this are mostly used at the expense of the user. At least, a couple of months ago, users of VSCode, claude, etc. had to specifically reference a Resource as part of their prompt.

I think it was part of the Stacklock Kubernetes MCP server that they were actually exposing all Kubernetes resources as discoverable MCP resources. Something pretty neat, but that it just doesn't work because the agents/MCPHosts aren't designed that way.

I'm fine with adding the API support for resources, but I wouldn't go much far that that for the moment. This might be a required feature for some toolset implementers and we should definitely add support for it. But other than that, I wouldn't work on our toolsets to add resource discovery until this proves to be something valuable in any of the mainstream coding agents.

// crdOpenAPISpecResourceTemplate returns a resource template that provides the OpenAPI spec for a CRD.
// The URI format is: k8s://crds/{name}/openapi
// Where {name} is the full CRD name (e.g., "virtualmachines.kubevirt.io")
func crdOpenAPISpecResourceTemplate() api.ServerResourceTemplate {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory I get this via resources_get somewhat, but here we have a little more convenient usage. Instead of going via CustomResourceDefinition tool for _get

@matzew
Copy link
Collaborator

matzew commented Jan 30, 2026

I'm fine with adding the API support for resources, but I wouldn't go much far that that for the moment. This might be a required feature for some toolset implementers and we should definitely add support for it.

I like adding the api enhancements that are done in the first commit - I also don't mind that crd template. Or would that be already too much, @manusa ?

@matzew
Copy link
Collaborator

matzew commented Jan 30, 2026

we probably want to only use static resources

@Cali0707 like included/embedded documentation?

@manusa
Copy link
Member

manusa commented Jan 30, 2026

I like adding the api enhancements that are done in the first commit - I also don't mind that crd template. Or would that be already too much, @manusa ?

My reply was mostly generic on the PR itself, didn't check the actual code.
However, it's my understanding that in this case the user will still need to know the name of the CRD, etc. to be able to make use of it in a prompting session. I'm not sure of the value that this will provide.

The same outcome can probably be achieved by #664

But haven't checked this out, so maybe I'm just wrong with my current assumptions.

@matzew
Copy link
Collaborator

matzew commented Jan 30, 2026

However, it's my understanding that in this case the user will still need to know the name of the CRD, etc. to be able to make use of it in a prompting session.

yeah, I had similar thought: #713 (comment)

Didn't know about #664 - but some tool like that might be handy, agreed

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.

3 participants