-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Refactor: Restructure MCP Server Implementation for Better Modularity #2685
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
|
|
Hello @aheizi, Thank you for your work on restructuring the MCP server implementation. This pull request involves significant changes across multiple components, including connection management, configuration management, and handlers. While these changes aim to improve modularity, it might be beneficial to split the pull request into smaller, more focused ones to facilitate easier review and integration. Here are some suggestions on how the changes could be split:
Please consider these suggestions and let us know if you have any questions or need further assistance. Best regards, |
# Conflicts: # src/core/Cline.ts
# Conflicts: # locales/ca/README.md # locales/de/README.md # locales/es/README.md # locales/fr/README.md # locales/hi/README.md # locales/it/README.md # locales/ja/README.md # locales/ko/README.md # locales/pl/README.md # locales/pt-BR/README.md # locales/tr/README.md # locales/vi/README.md # locales/zh-CN/README.md # locales/zh-TW/README.md # src/core/Cline.ts # src/core/__tests__/Cline.test.ts
# Conflicts: # src/services/mcp/McpHub.ts # src/services/mcp/__tests__/McpHub.test.ts
…s/vars with underscore
# Conflicts: # src/exports/types.ts
|
I found there's a bit of a problem with the tool's parameters, let me fix it. |
# Conflicts: # src/services/mcp/connection/handlers/base/BaseHandler.ts
|
Hey @aheizi, Sorry again for taking so long to get back to you, I really like the idea to split the currently monolithic MCP Hub implementation. However since this refactor is so big it might be a good idea to add a feature flag to this to hopefully catch any bugs or breaking changes, something like: // In McpHub.ts
export class McpHub {
constructor(provider: ClineProvider, useNewArchitecture = false) {
if (useNewArchitecture) {
// Initialize with new modular approach
} else {
// Keep existing implementation
}
}
}I would like to know your opinion. Hopefully we can get your PR reviewed this way. |
This is very stupid idea bro , are you drunk |
|
Hey @JabolDev , I don't think there's a need to be rude. Feature flags are widely used to test new features and assist with the integration of large implementations/refactorings. Take a look: https://martinfowler.com/articles/feature-toggles.html I think this is a good way to integrate this PR but it's not the only solution, that's why I asked the author what they thought about it. Let me know if you have any questions. |
Hi, @daniel-lxs Thank you for taking the time to review this PR! I think this idea is good and can avoid some risks. I'm very willing to have a try like this. What kind of grayscale strategy should we adopt? I haven't figured this part out yet. |
|
Seeing that http streaming is already supported, I'm already tired and don't want to tinker anymore. |
Context
To support Streamable HTTP transport more easily later
Restructured the MCP (Model Context Protocol) server implementation to improve code organization and maintainability. The goal is to make the codebase more modular and easier to extend while preserving all existing functionality.
Previous challenges in the codebase:
Implementation
Reorganized the codebase into a clearer directory structure:
Key improvements:
The restructuring maintains all existing functionality while providing a more organized and extensible foundation.
Screenshots
config settings verification
config_compressed.mov
Core function verification
core-function_compressed.mov
How to Test
Manual testing following aspects:
alwaysAllowtools and verify changes take effecttimeoutsettings and verify connection behaviordisabledstatus and verify server statewatchPathsand verify file monitoringurland verify connectionheadersand verify request headerscommandand verify process launchargsand verify command argumentsenvvariables and verify environmentcwdand verify working directoryGet in Touch
aheizi
Important
Refactor MCP server implementation for improved modularity, introducing new connection and configuration management classes while maintaining existing functionality.
connection,config, andtypesmodules.ConnectionFactory,ConnectionManager,SseHandler, andStdioHandlerfor handling different connection types.FileWatcherfor monitoring file changes.ConfigManagerfor handling global and project-level configurations.ConfigChangeEventandConfigChangeListenerfor configuration change notifications.McpHuband connection handlers.McpHub.test.tsto reflect new structure and functionality.This description was created by
for 2a08412. It will automatically update as commits are pushed.