-
Notifications
You must be signed in to change notification settings - Fork 52
Feat/resources and prompts #5
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
Feat/resources and prompts #5
Conversation
Thanks for the PR! This repo hasn't been in a good state to accept changes like this, but it should be a lot better now/tomorrow. If you can rebase against I'll take a proper look at this as soon as I've gotten the new chat example out. |
- Add Resource and ResourceTemplate types from MCP SDK - Add resources and resourceTemplates arrays to UseMcpResult - Fetch resources automatically after tools during connection - Add listResources() method to manually refresh resources list - Add readResource(uri) method to read resource contents - Clear resources state on disconnect 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Prompt type from MCP SDK - Add prompts array to UseMcpResult - Fetch prompts automatically after resources during connection - Add listPrompts() method to manually refresh prompts list - Add getPrompt(name, args) method to get specific prompt messages - Clear prompts state on disconnect 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Import and export Resource, ResourceTemplate, and Prompt types - Add state management for resources and prompts in McpServers component - Add UI sections to display available resources and prompts - Implement readResource functionality with content display - Implement getPrompt functionality with argument inputs - Show resource templates with visual distinction - Add expand/collapse UI for resources and prompts - Display prompt messages with proper formatting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Wrap resources/list and prompts/list calls in try-catch blocks - Continue with connection even if server doesn't support these methods - Update logging to only show counts for features that are supported - Fix TypeScript types for optional responses This allows the hook to work with servers that only implement the core tools functionality without resources or prompts support. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
352407f
to
5fc712f
Compare
- Add resources, resourceTemplates, and prompts to all feature lists - Document new properties returned by useMcp hook - Document new methods: listResources, readResource, listPrompts, getPrompt - Add code examples showing how to use resources and prompts - Update quick start examples to demonstrate all features - Add note about graceful handling of servers with partial MCP support 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix formatting issues in cf-agents, hono-mcp, and test files - Update dependencies in example servers 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
f00b0ef
to
e33de7c
Compare
Transform the generic example server into a fun Vengabus-themed MCP server with: - Replace generic tools with party-themed tools (party capacity calculator, vengabus schedule) - Update resources to use party-themed URIs and content - Replace generic prompts with party invitations and announcements - Fix resource URI handling to strip trailing slashes - Fix TypeScript errors with proper resource template typing - Use docs:// protocol for party manual resource 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
e33de7c
to
6a42f9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing!
Running to lunch rn, will merge when I'm back. This is FANTASTIC though, thank you <3 I'll have a think about how to expose this in the new chat example I'm working on (WIP at https://chat.use-mcp.dev) too. |
That looks great! I think if we can change that bottom-right line to show:
And then hovering/clicking each of them gives you a tooltip/modal to configure? I don't think emoji is going to cut it, but with the right icons I think we can drop the words Gonna merge/release this now, we can hack on the rest of that later. |
@jem-computer I have released Instead of having to click around the UI to add stuff to the context, make the But the main thing is to play with how integrated prompts & resources can be with the actual flow of writing a message to an AI. Then extend that to a potential pattern for tweaking, say, which MCP servers are enabled for the current conversation, without taking your hands off the keyboard... Anyway, just an idea for now. Wdyt? |
adds support for Resources and Prompts in
useMCP
hookMotivation and Context
see #4
How Has This Been Tested?
Breaking Changes
N/A
Types of changes
Checklist
Additional context
usePrompts(…)