feat: Adding MCP Client-Side Sampling to Roo Code #2459
neno-is-ooo
started this conversation in
Feature Requests
Replies: 3 comments
-
Good to know roo code is going to support MCP sampling feature. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sampling significantly improves MCP tools, would love to see this. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Any updates on this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
Implement support for MCP (Model Context Protocol) bidirectional "sampling" capability in Roo Code. This feature would allow MCP servers to request LLM completions from client-managed models while preserving privacy and client control.
Background
What is MCP Sampling?
The Model Context Protocol's sampling feature reverses the traditional client-server relationship for LLM interactions. Instead of clients making requests to servers, sampling allows MCP servers to request LLM completions from the client. This gives clients full control over model selection, hosting, privacy, and cost management.
From the [MCP documentation](https://modelcontextprotocol.io/docs/concepts/sampling):
Currently, Roo Code implements a traditional MCP client that only sends requests to servers. Adding sampling support would enable bidirectional communication that maintains user privacy while expanding capabilities.
Areas Requiring Investigation
Before proceeding with implementation, we need to investigate:
MCP Sampling Protocol Specification
Latest SDK Requirements
@modelcontextprotocol/sdk
version (1.7.0) supports samplingModel Completion Integration
UI/UX Patterns
Proposed Changes
Based on what we can determine from the codebase, these components would likely need modification:
1. McpHub Class (
src/services/mcp/McpHub.ts
)The central MCP client implementation would need to be extended to:
2. Types and Interfaces (
src/shared/mcp.ts
)New interfaces would be needed for:
3. Configuration Schema
The existing server configuration schema in
McpHub.ts
would need extension for sampling-specific settings, potentially including:4. UI Components (
webview-ui
)The UI would need additional components for:
Potential Implementation Approach
Without making assumptions about specific implementation details, the general approach would involve:
Capability Reporting
Request Handling
Approval Flow
Model Integration
Configuration
User Experience Considerations
From the user perspective, sampling would involve:
Configuration: Users configure sampling settings for each MCP server.
Approval Process: When an MCP server requests a completion:
Security Controls: Users can configure:
Implementation Plan
A phased approach is recommended, with specific timelines to be determined after further investigation:
Phase 1: Research and Protocol Implementation
Phase 2: Model Integration
Phase 3: UI and Configuration
Phase 4: Testing and Refinement
Open Questions
Next Steps
References
Beta Was this translation helpful? Give feedback.
All reactions