Expose live Moshcode sessions over remote MCP - #496
Merged
Conversation
| } | ||
| params.push(limit); | ||
| const rows = await all( | ||
| `SELECT * FROM cli_sessions WHERE ${where} ORDER BY last_seen_at DESC LIMIT ?`, |
ThreatCrush Security Scan1 finding(s) in the 7 file(s) this pull request changes. MEDIUM: 1
92 pre-existing finding(s) elsewhere in the repository — **HIGH/CRITICAL**: 8 | **MEDIUM**: 74 | **LOW**: 10Not introduced by this pull request. The full set is in the Security tab.
…and 72 more. Full results in the Security tab. Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
What
Implements OpenPRD 0014: a remote MCP + OAuth gateway over Moshcode's existing live CLI session mirror.
MCP
POST /mcpstateless remote MCP endpointserver/discoverpath plus 2025 handshake compatibilitymoshcode_sessions_listmoshcode_session_readwithafter_seqcursorsmoshcode_session_sendusing the existing command queuemoshcode_session_keyusing the existing negotiatedkeyscapabilityOAuth / security
sessions:readandsessions:controlscopes (controlimpliesread)scopeArchitecture
This deliberately reuses the existing
cli_sessions, sequencedsession_output, and exactly-oncesession_commandsqueue. It does not add another shell daemon, expose SSH credentials, or add a runtime MCP SDK dependency.Tests
Adds integration coverage for:
I also syntax-checked all new/modified
.mjsfiles withnode --checkbefore pushing.Known follow-up
The existing CLI long-poll wake signal is in-process. MCP commands inserted by a different app instance may wait for the normal poll timeout instead of waking the parked request immediately. The PRD tracks a shared/cross-instance wake mechanism as P1; correctness is preserved in v1, only worst-case command latency is affected.
See
prd/0014-remote-mcp-session-gateway.md.