Add support for Model Context Protocol#456
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds foundational support for Model Context Protocol (MCP) by introducing server initialization hooks and shared types. The changes enable GLSP servers to optionally start MCP servers during initialization and communicate their accessibility information back to clients.
Key changes:
- Introduced
GLSPServerInitContributioninterface for extending server initialization - Added MCP-specific types for configuration and results
- Exported new MCP module through protocol package index
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/protocol/src/index.ts | Exports the new MCP module to make it available to package consumers |
| packages/protocol/src/client-server-protocol/mcp.ts | Defines MCP server configuration types, initialization parameters/results, and utility functions |
| packages/protocol/src/client-server-protocol/glsp-server.ts | Adds GLSPServerInitContribution interface to enable server initialization customization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Extend the client-server protocol with server initialization hook - Provide some shared types and utility functions for MCP Part of eclipse-glsp/glsp#1546
fa24fee to
afdd67c
Compare
tortmayr
left a comment
There was a problem hiding this comment.
In general the changes look good to me.
I only have a fewer minor nitpicks.
| mcpServer: McpServerConfiguration; | ||
| } | ||
|
|
||
| export function isMcpInitializeParameters(params?: InitializeParameters): params is McpInitializeParameters { |
There was a problem hiding this comment.
We should probably align this with our typical pattern of interface+ namespace for utility functions
instead of standalone utility functions
| } | ||
|
|
||
| export function isMcpInitializeParameters(params?: InitializeParameters): params is McpInitializeParameters { | ||
| return !!params && (params as McpInitializeParameters).mcpServer !== undefined; |
There was a problem hiding this comment.
We should use probably use our own type utilities (AnyObject.is & hasObjectProp) here
| mcpServer: McpServerResult; | ||
| } | ||
|
|
||
| export function isMcpInitializeResult(result?: InitializeResult): result is McpInitializeResult { |
There was a problem hiding this comment.
Same as above this should probably be migrated to a namespace
What it does
Part of eclipse-glsp/glsp#1546
How to test
Follow-ups
Changelog