@superdoc/mcp 1.13.0-next.9 → 1.14.0-next.4
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.
- package/README.md +91 -102
- package/dist/index.js +5303 -3020
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,167 +1,156 @@
|
|
|
1
|
-
# @superdoc
|
|
1
|
+
# @superdoc/mcp
|
|
2
2
|
|
|
3
|
-
MCP server for SuperDoc. Lets
|
|
3
|
+
MCP server for SuperDoc. Lets a coding agent open, read, edit, and save DOCX
|
|
4
|
+
files through the [Model Context Protocol](https://modelcontextprotocol.io),
|
|
5
|
+
with tracked changes and comments. Works with Claude Code, Claude Desktop,
|
|
6
|
+
Cursor, Windsurf, and any MCP client. To build your own agent loop, use
|
|
7
|
+
[`@superdoc/sdk`](https://www.npmjs.com/package/@superdoc/sdk) instead.
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
[Documentation](https://docs.superdoc.dev/agents/mcp/connect) · [GitHub](https://github.com/superdoc/docx-editor)
|
|
6
10
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npx @superdoc-dev/mcp
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The server runs locally over stdio as a subprocess. You don't run it directly; your MCP client spawns it.
|
|
11
|
+
## Install
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
Your MCP client starts the server as a local subprocess over stdio, so you only
|
|
14
|
+
register it. It needs Node.js 20 or newer.
|
|
16
15
|
|
|
17
16
|
### Claude Code
|
|
18
17
|
|
|
19
18
|
```bash
|
|
20
|
-
claude mcp add superdoc -- npx @superdoc
|
|
19
|
+
claude mcp add superdoc -e MCP_PRESET=core -- npx @superdoc/mcp
|
|
21
20
|
```
|
|
22
21
|
|
|
23
|
-
### Claude Desktop
|
|
22
|
+
### Claude Desktop, Cursor, and Windsurf
|
|
24
23
|
|
|
25
|
-
Add to
|
|
24
|
+
Add this entry to the client's configuration file:
|
|
26
25
|
|
|
27
26
|
```json
|
|
28
27
|
{
|
|
29
28
|
"mcpServers": {
|
|
30
29
|
"superdoc": {
|
|
31
30
|
"command": "npx",
|
|
32
|
-
"args": ["@superdoc
|
|
31
|
+
"args": ["@superdoc/mcp"],
|
|
32
|
+
"env": { "MCP_PRESET": "core" }
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
| Client | Configuration file |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| Claude Desktop (macOS) | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
41
|
+
| Cursor | `~/.cursor/mcp.json` |
|
|
42
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
Restart the client. You should see `superdoc_open`, `superdoc_inspect`,
|
|
45
|
+
`superdoc_perform_action`, `superdoc_save`, and `superdoc_close`.
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
"mcpServers": {
|
|
45
|
-
"superdoc": {
|
|
46
|
-
"command": "npx",
|
|
47
|
-
"args": ["@superdoc-dev/mcp"]
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
47
|
+
## Quick start
|
|
52
48
|
|
|
53
|
-
|
|
49
|
+
Give the agent absolute paths and a new output file:
|
|
54
50
|
|
|
55
|
-
|
|
51
|
+
> Open `/Users/me/docs/contract.docx` with SuperDoc. Replace every occurrence of "termination" with "cancellation" as a tracked change. Save the result to `/Users/me/docs/contract.reviewed.docx` and close the session.
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"superdoc": {
|
|
61
|
-
"command": "npx",
|
|
62
|
-
"args": ["@superdoc-dev/mcp"]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
```
|
|
53
|
+
The agent opens the document, inspects it, makes the edit, saves the copy, and
|
|
54
|
+
closes the session. Open the copy in Word or the SuperDoc editor to review the
|
|
55
|
+
tracked changes.
|
|
67
56
|
|
|
68
57
|
## Tools
|
|
69
58
|
|
|
70
|
-
Three lifecycle tools are always
|
|
59
|
+
Three lifecycle tools are always available. The editing tools depend on
|
|
60
|
+
`MCP_PRESET`:
|
|
71
61
|
|
|
72
62
|
| `MCP_PRESET` | Tools |
|
|
73
63
|
| --- | --- |
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
|
|
77
|
-
All tools except `superdoc_open` take a `session_id` from `superdoc_open`.
|
|
78
|
-
|
|
79
|
-
Pass absolute paths. A relative path resolves against the server process's working directory, which your MCP client chooses. `superdoc_open` also opens a blank document when the path does not exist rather than reporting an error, so a wrong path presents as an empty file instead of a failure.
|
|
80
|
-
|
|
81
|
-
The server reads and writes any path it is given, with no restriction to a particular directory. Run it under a container, a dedicated user account, or an OS sandbox if you need to bound what it can reach.
|
|
82
|
-
|
|
83
|
-
`superdoc_save` has no overwrite guard: it resolves `out` and writes it, replacing any file already there, including the source. Point the agent at copies, and preflight the destination yourself when a workflow cannot tolerate that.
|
|
84
|
-
|
|
85
|
-
### Lifecycle
|
|
64
|
+
| `core` (recommended) | 5: lifecycle tools plus `superdoc_inspect` and `superdoc_perform_action` |
|
|
65
|
+
| `legacy` (default) | 13: lifecycle tools plus 10 grouped intent tools |
|
|
86
66
|
|
|
87
|
-
|
|
|
67
|
+
| Lifecycle tool | Does |
|
|
88
68
|
| --- | --- |
|
|
89
|
-
| `superdoc_open` |
|
|
90
|
-
| `superdoc_save` |
|
|
91
|
-
| `superdoc_close` |
|
|
69
|
+
| `superdoc_open` | Opens a DOCX by absolute path and returns a `session_id`. |
|
|
70
|
+
| `superdoc_save` | Writes the document to its original path or to `out`. |
|
|
71
|
+
| `superdoc_close` | Closes the session and releases memory. |
|
|
92
72
|
|
|
93
|
-
|
|
73
|
+
Every other tool takes the `session_id` from `superdoc_open`.
|
|
94
74
|
|
|
95
|
-
|
|
75
|
+
<details>
|
|
76
|
+
<summary>Intent tools in the <code>legacy</code> preset</summary>
|
|
77
|
+
|
|
78
|
+
Most take an `action` argument that selects the operation. `superdoc_search`
|
|
79
|
+
takes `select` instead.
|
|
96
80
|
|
|
97
81
|
| Tool | Covers |
|
|
98
82
|
| --- | --- |
|
|
99
|
-
| `superdoc_get_content` | Read the document as text,
|
|
100
|
-
| `superdoc_search` | Find content and return stable targets
|
|
101
|
-
| `superdoc_edit` | Insert, replace, and delete text
|
|
83
|
+
| `superdoc_get_content` | Read the document as text, Markdown, HTML, blocks, or metadata |
|
|
84
|
+
| `superdoc_search` | Find content and return stable targets |
|
|
85
|
+
| `superdoc_edit` | Insert, replace, and delete text or blocks, plus undo and redo |
|
|
102
86
|
| `superdoc_format` | Inline and paragraph formatting, styles, direction, and flow |
|
|
103
87
|
| `superdoc_create` | Create paragraphs, headings, and tables |
|
|
104
88
|
| `superdoc_list` | Create, convert, nest, split, merge, and renumber lists |
|
|
105
89
|
| `superdoc_table` | Table structure, content, and styling |
|
|
106
90
|
| `superdoc_comment` | Create, update, resolve, and read comment threads |
|
|
107
|
-
| `superdoc_track_changes` | List tracked changes and
|
|
91
|
+
| `superdoc_track_changes` | List tracked changes and accept or reject them |
|
|
108
92
|
| `superdoc_mutations` | Preview and apply multi-step edits as one atomic batch |
|
|
109
93
|
|
|
110
|
-
|
|
94
|
+
</details>
|
|
111
95
|
|
|
112
|
-
|
|
96
|
+
Each tool's JSON Schema is generated from the Document API contract and served
|
|
97
|
+
over MCP. Read the advertised schema rather than a copy of it.
|
|
98
|
+
`getToolCatalog('core')` or `getToolCatalog('legacy')` in `@superdoc/sdk` returns the same data for that preset.
|
|
113
99
|
|
|
114
|
-
|
|
100
|
+
## Tracked changes
|
|
115
101
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
102
|
+
Edits that support it take `changeMode: "tracked"`. To accept or reject
|
|
103
|
+
changes, use `superdoc_perform_action` with `accept_tracked_changes` or
|
|
104
|
+
`reject_tracked_changes` under `core`, or `superdoc_track_changes` under
|
|
105
|
+
`legacy`.
|
|
119
106
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
3. Intent tools use `session_id` plus `action` to modify content
|
|
123
|
-
4. `superdoc_save` writes changes to disk
|
|
124
|
-
5. `superdoc_close` releases the session
|
|
107
|
+
Not every action honors `changeMode`. Some edit directly, and `move_range`
|
|
108
|
+
accepts it and then fails without editing, so check each receipt.
|
|
125
109
|
|
|
126
|
-
|
|
110
|
+
Tracked changes are authored as `MCP Server` by default. Set
|
|
111
|
+
`SUPERDOC_MCP_AUTHOR_NAME` to name the agent or workflow:
|
|
127
112
|
|
|
128
|
-
|
|
113
|
+
```json
|
|
114
|
+
"env": { "MCP_PRESET": "core", "SUPERDOC_MCP_AUTHOR_NAME": "Contract Review Agent" }
|
|
115
|
+
```
|
|
129
116
|
|
|
130
|
-
|
|
117
|
+
## Configuration
|
|
131
118
|
|
|
132
|
-
|
|
119
|
+
| Variable | Default | Does |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| `MCP_PRESET` | `legacy` | Tool set: `core` or `legacy`. Other values fail at startup. |
|
|
122
|
+
| `SUPERDOC_MCP_AUTHOR_NAME` | `MCP Server` | Author name on tracked changes. |
|
|
133
123
|
|
|
134
|
-
|
|
124
|
+
## Common mistakes
|
|
135
125
|
|
|
136
|
-
|
|
126
|
+
| Wrong | Right |
|
|
127
|
+
| --- | --- |
|
|
128
|
+
| `npx @superdoc-dev/mcp` | `npx @superdoc/mcp`. The old name no longer gets releases |
|
|
129
|
+
| Relative paths | Absolute paths. Relative paths resolve against the directory your client chose |
|
|
130
|
+
| A path that does not exist | Check it first. A missing path opens a blank document instead of failing |
|
|
131
|
+
| Saving over the source or an earlier result | Save to a new path. `superdoc_save` overwrites without asking |
|
|
132
|
+
| Asking the model to stay in one folder | Run the server under a dedicated user, a container, or an OS sandbox |
|
|
133
|
+
| Assuming an edit was tracked | Check the receipt. Not every action honors `changeMode` |
|
|
137
134
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
"superdoc": {
|
|
142
|
-
"command": "npx",
|
|
143
|
-
"args": ["@superdoc-dev/mcp"],
|
|
144
|
-
"env": {
|
|
145
|
-
"SUPERDOC_MCP_AUTHOR_NAME": "Contract Review Agent"
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
```
|
|
135
|
+
The server reads and writes any path its account can reach. Your client can
|
|
136
|
+
send document content to its model provider through tool results. See
|
|
137
|
+
[agent safety](https://docs.superdoc.dev/agents/operate/safety).
|
|
151
138
|
|
|
152
|
-
##
|
|
139
|
+
## Related packages
|
|
153
140
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
141
|
+
- [`@superdoc/sdk`](https://www.npmjs.com/package/@superdoc/sdk): Node.js SDK and agent toolkit for building your own agent loop.
|
|
142
|
+
- [`@superdoc/cli`](https://www.npmjs.com/package/@superdoc/cli): the same operations from a terminal or script.
|
|
143
|
+
- [`superdoc`](https://www.npmjs.com/package/superdoc): browser editor for reviewing the agent's tracked changes.
|
|
157
144
|
|
|
158
|
-
|
|
159
|
-
bun test
|
|
145
|
+
## Documentation
|
|
160
146
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
147
|
+
- [Connect a coding agent](https://docs.superdoc.dev/agents/mcp/connect)
|
|
148
|
+
- [First document task](https://docs.superdoc.dev/agents/mcp/first-document-task)
|
|
149
|
+
- [Debug the MCP server](https://docs.superdoc.dev/agents/mcp/debugging)
|
|
150
|
+
- [Agent safety](https://docs.superdoc.dev/agents/operate/safety)
|
|
151
|
+
- [`llms.txt`](https://docs.superdoc.dev/llms.txt): machine-readable index of the documentation for coding agents.
|
|
164
152
|
|
|
165
153
|
## License
|
|
166
154
|
|
|
167
|
-
|
|
155
|
+
AGPL-3.0. [Commercial licenses](https://www.superdoc.dev/#pricing) are
|
|
156
|
+
available for proprietary deployments.
|