Skip to content

feat(mcp): a local MCP server for reading settings and sessions - #286

Merged
StuBehan merged 4 commits into
mainfrom
feat/mcp-read
Nov 25, 2026
Merged

StuBehan merged 4 commits into
mainfrom
feat/mcp-read

Conversation

@StuBehan

Copy link
Copy Markdown
Collaborator

First of four for a local MCP server in stack-nudge. The design is in docs/design/local-mcp.md and is worth reading before the code, the next three PRs follow its phases (write tools, MCP Events, extensions).

This one is read only:

  • stack-nudge --mcp is a stdio bridge to ~/.stack-nudge/mcp.sock (0600). Its own socket rather than panel.sock, since a bridge holds its connection open for as long as its client runs. The bridge's first line tells the app the Claude session id from its env and the pid that launched it, so who's calling never comes from what a model says
  • speaks 2026-07-28 (server/discover, per request _meta, subscriptions/listen) and the older initialize handshake, which Claude Code and Codex still send
  • SettingsRegistry, one entry per STACKNUDGE_ key with the values it takes, and why it can't be changed from here where it can't. No secrets in it
  • settings_list, settings_get, sessions_list, and the settings and sessions resources with update notifications. sessions_list is the same SessionSnapshot that event:session sends (feat(extensions): deliver event:session to trusted services #284), so the two agree on what waiting means and neither hands out paths
  • with the app not running the bridge answers with no tools and says why, rather than failing the client

To try it, claude mcp add stack-nudge -- ~/Applications/StackNudge.app/Contents/MacOS/stack-nudge --mcp. Settings gets a row to copy that in the next PR.

I've had the whole stack installed locally and driven it with a scripted client and real Claude Code runs, which is where the last commit came from: the server started before the config loaded, so every launch told clients each non-default setting had just changed.

Tests: new MCPServerTests (the session against a fake app, the bridge, the registry, one round trip over a real socket) pass.

Started before nav read the config, the watcher's first snapshot held the defaults, so every launch told clients that each non-default setting had just changed. A refusal for a per-request revision now names only the one that carries _meta.
The same shape event:session sends, so the two agree on what waiting means, and leave out paths and terminal names the same way. Ended sessions are left out, and the watcher compares snapshots rather than a JSON signature.
@StuBehan
StuBehan merged commit f6afd67 into main Nov 25, 2026
6 checks passed
@StuBehan
StuBehan deleted the feat/mcp-read branch November 25, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant