How gradusnikov/eclipse-chatgpt-plugin works
Project Type and Purpose
• This is an Eclipse IDE plugin (OSGi-based) named AssistAI. Its purpose is to integrate a Large Language Model (LLM) assistant into Eclipse, providing code refactoring, documentation, test generation, chat, error fixing, vision, and tool-based extensions via the Model Context Protocol (MCP).
High-Level Architectural Components
a. Eclipse OSGi Container
• Hosts two main bundles:
• com.github.gradusnikov.eclipse.plugin.assistai.dependencies
• com.github.gradusnikov.eclipse.plugin.assistai.main
b. AssistAI Dependencies Bundle
• Provides third-party libraries: Jackson (JSON), Flexmark (Markdown), Selenium, PDFBox, Tika, Reactor, byte-buddy, MCP core, etc.
c. AssistAI Main Bundle
• UI Layer
• ChatView (Eclipse ViewPart)
• ChatViewPresenter
• Wizards & Dialogs (ApplyPatchWizardHelper)
• Context menus & handlers (AssistAI…Handler classes)
• CSS/JS for rendering
• Core Domain Layer
• Chat model (ChatMessage, Conversation, FunctionCall, Incoming)
• Prompt management (PromptLoader, ChatMessageFactory, Prompts)
• Repository (PromptRepository, ModelApiDescriptorRepository)
• Preferences (Model & MCP Server settings)
• Networking Layer
• LanguageModelClient (HTTP clients for OpenAI, Anthropic, Gemini, DeepSeek, etc.)
• Stream subscribers (AppendMessageToViewSubscriber, FunctionCallSubscriber, PrintMessageSubscriber)
• MCP Client Layer
• MCP client factory (McpClientServerFactory, InMemoryTransport)
• Built-in MCP servers (DuckDuckSearch, EclipseIntegrations, Time server, Memory server, WebPageReader)
• MCP services (CodeAnalysisService, EditorService, GitService, MavenService, etc.)
• Job Scheduling
• Eclipse Jobs API (SendConversationJob, ExecuteFunctionCallJob)
• Tools & Utilities
• File/tool helpers (AssistaiSharedFiles, ImageUtilities, ContentTypeDetector, UISynchronizeCallable)
External Dependencies & Services
• LLM Providers via HTTPS (OpenAI, Claude, Gemini, DeepSeek, etc.)
• MCP Servers (stdio-based processes you configure in preferences)
• Eclipse workspace and file system for reading/modifying resources
• Optional: Vision model interactions for images
Data Flow & Interactions
1. User invokes a command via context menu or toolbar → Handler
2. Handler builds a Conversation with PromptLoader & ChatMessageFactory
3. Handler schedules a SendConversationJob
4. Job calls LanguageModelClient through a provider (configured HTTP client)
5. Streamed LLM responses are published to subscribers
6. Subscribers update ChatView (UI) and/or trigger FunctionCall jobs
7. FunctionCallJob interacts with MCP client → external MCP server → returns data
8. UI presents enriched results; user may apply patch via ApplyPatchWizardHelper
Architectural Patterns and Principles
• OSGi modularity: clear separation of dependencies vs. main code
• MVC/MVP in UI: ChatView (view) + ChatViewPresenter (presenter) + model classes
• Reactor/Subscriber pattern for streaming LLM responses
• Job-based async execution via Eclipse Jobs API
• Dependency injection via OSGi service registry (Activator registers services)
• Repository pattern for prompts & model descriptors
• Adapter pattern in Network clients for different LLM protocols