Draft
Conversation
Add server-initiated message support to the cloud relay: - sendNotification(): send JSON-RPC notifications to client - sendRequest(): send JSON-RPC requests and handle responses - handleServerResponse(): process responses from client This enables MCP features that require server→client communication: - Resource update notifications (notifications/resources/updated) - Logging notifications (notifications/message) - Sampling requests (sampling/createMessage) - Elicitation requests (elicitation/create) The relay now handles 'server_response' messages in the poll loop and routes them to pending request callbacks.
- Added message queue and bidirectional communication methods to mcp_server.lua - Added /poll endpoint for long-polling server-initiated messages - Added sendNotification() and sendRequest() methods to MCPServer - Added setTransport() to MCPProtocol for transport abstraction - Added resource change monitoring and notification in both local and relay modes - Wire up protocol to send notifications/resources/updated when resources change - Both local server and relay now support same bidirectional patterns Co-authored-by: laughedelic <[email protected]>
…dition - Remove class-level defaults for instance-specific tables in MCPServer - Add running state check at start of resource check task to avoid race conditions Co-authored-by: laughedelic <[email protected]>
- Document that getNextRequestId is thread-safe in Lua's single-threaded event loop - Explain rationale for 0.5s resource check interval (battery life balance) Co-authored-by: laughedelic <[email protected]>
Co-authored-by: laughedelic <[email protected]>
Copilot
AI
changed the title
[WIP] Add bidirectional communication to relay
Add bidirectional communication to local server
Feb 1, 2026
laughedelic
added a commit
that referenced
this pull request
Feb 1, 2026
- Update features list with subscriptions, client features (sampling, elicitation, logging) - Expand resources table with library resources and resource templates - Add tool annotations section explaining readOnlyHint, destructiveHint, etc. - Add server-initiated features section (notifications, logging, sampling/elicitation) - Note local mode limitations and link to PR #8 for bidirectional work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extended bidirectional communication (sendNotification, sendRequest) from relay-only to both relay and local server implementations.
Changes
Local Server (
mcp_server.lua)sendNotification()andsendRequest()methods with message queue and callback tracking/pollendpoint for long-polling (returns 204 when empty, 200 with message)/responseendpoint for client responses to server-initiated requestsProtocol Layer (
mcp_protocol.lua)setTransport()to support both MCPServer and MCPRelaynotifyResourcesUpdated()to send resource update notifications through transportcheckAndNotifyResourceChanges()for automatic change detection and notificationIntegration (
main.lua)scheduleResourceChangeCheck()with 0.5s polling intervalUsage
Both local and relay servers now support server→client communication:
Enables MCP features requiring server→client communication: resource update notifications, logging, sampling requests, and elicitation in both deployment modes.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.