-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add MCP button to ChatTextArea with error indicator #7507
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
Conversation
- Added MCP Servers button to the left of the Codebase Indexing button - Button is hidden when no MCP servers are installed - Clicking the button navigates to the MCP screen - Red indicator appears when any MCP server is erroring (disconnected and not disabled) - Added translation key for the MCP button tooltip
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.
I reviewed my own code and found it surprisingly readable. Must be a bug.
| taskHistory, | ||
| clineMessages, | ||
| commands, | ||
| mcpServers, |
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.
The mcpServers property is destructured from useExtensionState() but doesn't appear to be typed in the hook's return type. Could this cause TypeScript errors if strict typing is enabled? Consider adding the proper type definition to ensure type safety.
| {mcpServers.some( | ||
| (server) => server.status === "disconnected" && !server.disabled, | ||
| ) && ( | ||
| <span |
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.
The error indicator (red dot) doesn't have any accessible text for screen reader users. Consider adding an aria-label to the button or the error indicator span to improve accessibility:
| <span | |
| {mcpServers.some( | |
| (server) => server.status === "disconnected" && !server.disabled, | |
| ) && ( | |
| <span | |
| aria-label="MCP server error" | |
| className={cn( | |
| "absolute top-1 right-1 w-1.5 h-1.5 rounded-full", | |
| "bg-red-500", | |
| )} | |
| /> | |
| )} |
| "cursor-pointer", | ||
| )}> | ||
| <Server className="w-4 h-4" /> | ||
| {mcpServers.some( |
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.
For better readability, consider extracting the error detection logic to a variable:
| {mcpServers.some( | |
| const hasErroringServers = mcpServers.some( | |
| (server) => server.status === "disconnected" && !server.disabled, | |
| ); | |
| {hasErroringServers && ( |
| }, | ||
| "enhancePromptDescription": "The 'Enhance Prompt' button helps improve your prompt by providing additional context, clarification, or rephrasing. Try typing a prompt in here and clicking the button again to see how it works.", | ||
| "addImages": "Add images to message", | ||
| "mcpServers": "MCP Servers", |
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.
The "mcpServers" translation key should be added to all other locale files to maintain i18n consistency. Currently it's only in the English locale. Could we ensure all locale files are updated?
Summary
This PR adds a new MCP (Model Context Protocol) button to the ChatTextArea component, positioned to the left of the Codebase Indexing button.
Changes
Implementation Details
Testing
Screenshots
The button appears between the Slash Commands button and the Codebase Indexing button when MCPs are installed.
Fixes: Slack request to add MCP button to chat interface
Important
Adds an MCP button to
ChatTextAreawith error indicator for disconnected servers, including a new translation key for the tooltip.ChatTextAreawith Server icon, conditionally rendered when MCP servers are present.ChatTextArea.mcpServerstranslation key inchat.jsonfor button tooltip.This description was created by
for 7ade8e4. You can customize this summary. It will automatically update as commits are pushed.