@skillstate/mcp 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +116 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ <div align="center">
2
+
3
+ # @skillstate/mcp
4
+
5
+ **Zero-dependency Model Context Protocol server + adapter for the @skillstate/core runtime.**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@skillstate/mcp)](https://www.npmjs.com/package/@skillstate/mcp)
8
+ [![node](https://img.shields.io/node/v/@skillstate/mcp)](https://www.npmjs.com/package/@skillstate/mcp)
9
+ [![Tests](https://img.shields.io/badge/tests-755%20passing-brightgreen)](https://github.com/vitalykuzyaev/skillstate)
10
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/vitalykuzyaev/skillstate/blob/main/LICENSE)
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ `@skillstate/mcp` exposes the skillstate runtime ([`@skillstate/core`](../core))
17
+ as a **Model Context Protocol** server over stdio (JSON-RPC 2.0). It reuses the
18
+ paper-exact core directly — `mergeState`, `createInitialState`,
19
+ `validatePatchDeep`, `migrate`, `redactSecrets` — so any MCP client can read,
20
+ patch, merge, and reset the execution state as tools.
21
+
22
+ > **@non-paper** — the server is additive; no MCP exists in arXiv 2608.26263v3.
23
+ > Unlike the prompting adapters, MCP is runtime **access**, not prompting, so
24
+ > the O(1) question does not apply.
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ npm i @skillstate/core @skillstate/mcp
30
+ ```
31
+
32
+ Requires Node.js >= 20. TypeScript types are bundled. Ships a `skillstate-mcp`
33
+ bin that launches the server directly.
34
+
35
+ ## Quick start
36
+
37
+ ```ts
38
+ import { McpAdapter, McpServer, launch } from '@skillstate/mcp';
39
+ import { INTERCODE_CTF_SPEC } from '@skillstate/core/schemas';
40
+
41
+ const adapter = new McpAdapter();
42
+
43
+ // .mcp.json config registering the skillstate stdio server:
44
+ const config = adapter.generateMcpConfig('/path/to/.skillstate.json');
45
+ // -> { "mcpServers": { "skillstate": { "command", "args", "env" } } }
46
+
47
+ // Or run an in-process server and drive it line-by-line:
48
+ const server = new McpServer({
49
+ spec: INTERCODE_CTF_SPEC,
50
+ root: '.',
51
+ name: '.skillstate.json',
52
+ });
53
+ const response = server.handleLine(
54
+ JSON.stringify({
55
+ jsonrpc: '2.0', id: 1, method: 'tools/call',
56
+ params: { name: 'state.get', arguments: {} },
57
+ }),
58
+ );
59
+
60
+ // Or launch a stdio server from env / args (SKILLSTATE_SPEC_PATH, SKILLSTATE_STATE_PATH):
61
+ await launch({ statePath: './.skillstate.json', spec: INTERCODE_CTF_SPEC });
62
+ ```
63
+
64
+ Command-line:
65
+
66
+ ```bash
67
+ skillstate-mcp # reads SKILLSTATE_SPEC_PATH / SKILLSTATE_STATE_PATH
68
+ ```
69
+
70
+ ## API / Exports
71
+
72
+ Root path `@skillstate/mcp` exports `McpAdapter`, `McpServer`, and `launch`
73
+ (plus the types `McpServerOptions`, `LaunchArgs`, `FrameMode`, `JsonRpcRequest`,
74
+ `McpToolResult`, and `McpConfigOptions`).
75
+
76
+ - `new McpAdapter()` — `name = 'mcp'`.
77
+ - `generateMcpConfig(statePath, options?): string` — a deterministic,
78
+ secret-free `.mcp.json` document (`McpConfigOptions.specPath`, `.command`,
79
+ `.launcherPath`, `.env`).
80
+ - `saveMcpConfig(target, statePath, options?): Promise<string>` — atomic write.
81
+ - `new McpServer(options: McpServerOptions)` — `{ spec, root, name, tracker? }`.
82
+ - `handleLine(line): string | null` — process one already-framed JSON-RPC
83
+ message.
84
+ - `feed(chunk): string[]` — consume streamed stdin, handling both
85
+ newline-delimited JSON-RPC and `Content-Length`-framed messages.
86
+ - `start(input?, output?): Promise<McpServer>` / `stop()` / `get isRunning()`.
87
+ - `launch(args?): Promise<McpServer>` — resolves spec/state from args or
88
+ env and starts a stdio server.
89
+
90
+ **Tools:** `state.get`, `state.patch`, `state.merge` (schema-validated),
91
+ `state.reset`, `spec.get`, `state.metrics`. **Resource:** `skillstate://state`.
92
+ State is redacted on every read, and the server conserves its own buffering so
93
+ transports may split frames mid-message.
94
+
95
+ ## Notes
96
+
97
+ - **Zero dependencies.** `@skillstate/mcp` declares only
98
+ [`@skillstate/core`](../core); it uses Node's `fs`/`path`/`stream` for the
99
+ stdio transport and crash-safe state writes (temp sibling + fsync + rename).
100
+ - Both newline-delimited JSON-RPC and `Content-Length`-framed (LSP-style)
101
+ messages are accepted; responses echo the framing that triggered them.
102
+ - `state.merge` runs `validatePatchDeep` (defense-in-depth) before the ⊕ merge;
103
+ `state.patch` applies the raw ⊕ merge. `redactSecrets` fails closed so
104
+ secrets never leave the process through a tool result.
105
+
106
+ ## Related
107
+
108
+ - Paper: [arXiv:2608.26263](https://arxiv.org/abs/2608.26263).
109
+ - Core runtime: [`@skillstate/core`](../core).
110
+ - [`state.md`](../../state.md) — design notes.
111
+ - Prompting adapters: `@skillstate/claude`, `@skillstate/opencode`,
112
+ `@skillstate/codex`.
113
+
114
+ ## License
115
+
116
+ [MIT](LICENSE) © 2026 Vitaly Kuzyaev
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillstate/mcp",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Zero-dependency MCP server + adapter for the skillstate runtime.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",