opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: mcp resources

Open paoloricciuti opened this issue 2 weeks ago • 5 comments

Closes #806

This adds the ability to add MCP resources in the opencode prompt. It works just like files, when you do @ it shows you the list of resources and you can select them...the resource is only fetched once the prompt is actually sent.

Here's an example of the behaviour.

https://github.com/user-attachments/assets/1fc9008e-bed1-4256-9bf9-3b17db597db7

I had to create a new endpoint on the server (as we couldn't re-use one like with Command in prompts).

paoloricciuti avatar Dec 31 '25 18:12 paoloricciuti

@paoloricciuti @rekram1-node , tested this works great so far. this and prompts completes the loop on mcp servers.

kziemski avatar Jan 01 '26 20:01 kziemski

Uhm, just realized there might be a problem in case an MCP server exposes a resource as file: or data:...unusual but better be safe than sorry...let me change that

paoloricciuti avatar Jan 02 '26 08:01 paoloricciuti

Done! 😄

paoloricciuti avatar Jan 02 '26 08:01 paoloricciuti

im gonna make a generic experimental endpoint so plugins can do this kinda thing too, and then merge those changes into here and integrate it

rekram1-node avatar Jan 03 '26 18:01 rekram1-node

im gonna make a generic experimental endpoint so plugins can do this kinda thing too, and then merge those changes into here and integrate it

Uh that's interesting and very cool! Let me know if I can do something.

paoloricciuti avatar Jan 03 '26 19:01 paoloricciuti

/review

rekram1-node avatar Jan 04 '26 14:01 rekram1-node

lgtm

github-actions[bot] avatar Jan 04 '26 14:01 github-actions[bot]