Skip to content

Commit b82acfb

Browse files
Add local MCP tool metadata and docs
1 parent 33f3200 commit b82acfb

6 files changed

Lines changed: 374 additions & 40 deletions

File tree

README.md

Lines changed: 108 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,18 @@
1010

1111
**Give AI agents the power to process, sign, and transform documents.**
1212

13+
## Description
14+
1315
A Model Context Protocol (MCP) server that connects AI assistants to the [Nutrient Document Web Service (DWS) Processor API](https://www.nutrient.io/api) — enabling document creation, editing, conversion, digital signing, OCR, redaction, and more through natural language.
1416

17+
## Features
18+
19+
- Local stdio MCP server for Claude Desktop and other MCP-compatible clients
20+
- Browser-based OAuth on the first request that uses the Nutrient API, with optional API-key fallback for CI and headless environments
21+
- Document conversion, OCR, extraction, redaction, watermarking, annotation flattening, and digital signing
22+
- Sandbox-aware local file handling with explicit output paths
23+
- Read-only account lookup for DWS credits and usage
24+
1525
## What You Can Do
1626

1727
Once configured, you (or your AI agent) can process documents through natural language:
@@ -31,12 +41,16 @@ Once configured, you (or your AI agent) can process documents through natural la
3141
**You:** _"OCR this scanned document in German and extract the text"_
3242
**AI:** _"I've processed the scan with German OCR. Here's the extracted text..."_
3343

34-
## Quick Start
44+
## Installation
3545

36-
### 1. Get a Nutrient API Key
46+
Once this extension is listed, install it from Claude Desktop Settings -> Extensions. Until the directory listing is live, use the manual setup below.
47+
48+
### 1. Create a Nutrient Account
3749

3850
Sign up for free at [nutrient.io/api](https://dashboard.nutrient.io/sign_up/).
3951

52+
For local desktop use, the recommended path is to omit `NUTRIENT_DWS_API_KEY` and complete the browser sign-in flow on the first request that uses the Nutrient API. For CI, headless environments, or scripted setups, create an API key in the dashboard and set `NUTRIENT_DWS_API_KEY`.
53+
4054
### 2. Configure Your AI Client
4155

4256
Choose your platform and add the configuration:
@@ -56,12 +70,13 @@ Open Settings → Developer → Edit Config, then add:
5670
"command": "npx",
5771
"args": ["-y", "@nutrient-sdk/dws-mcp-server"],
5872
"env": {
59-
"NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE",
6073
"SANDBOX_PATH": "/your/sandbox/directory",
6174
// "C:\\your\\sandbox\\directory" for Windows
62-
},
63-
},
64-
},
75+
// Optional for CI or headless usage:
76+
// "NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE"
77+
}
78+
}
79+
}
6580
}
6681
```
6782

@@ -79,12 +94,13 @@ Create `.cursor/mcp.json` in your project root:
7994
"command": "npx",
8095
"args": ["-y", "@nutrient-sdk/dws-mcp-server"],
8196
"env": {
82-
"NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE",
8397
"SANDBOX_PATH": "/your/project/documents",
8498
// "C:\\your\\project\\documents" for Windows
85-
},
86-
},
87-
},
99+
// Optional for CI or headless usage:
100+
// "NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE"
101+
}
102+
}
103+
}
88104
}
89105
```
90106

@@ -102,12 +118,13 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
102118
"command": "npx",
103119
"args": ["-y", "@nutrient-sdk/dws-mcp-server"],
104120
"env": {
105-
"NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE",
106121
"SANDBOX_PATH": "/your/sandbox/directory",
107122
// "C:\\your\\sandbox\\directory" for Windows
108-
},
109-
},
110-
},
123+
// Optional for CI or headless usage:
124+
// "NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE"
125+
}
126+
}
127+
}
111128
}
112129
```
113130

@@ -118,16 +135,17 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
118135

119136
Add to `.vscode/settings.json` in your project:
120137

121-
```json
138+
```jsonc
122139
{
123140
"mcp": {
124141
"servers": {
125142
"nutrient-dws": {
126143
"command": "npx",
127144
"args": ["-y", "@nutrient-sdk/dws-mcp-server"],
128145
"env": {
129-
"NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE",
130-
"SANDBOX_PATH": "${workspaceFolder}"
146+
"SANDBOX_PATH": "${workspaceFolder}",
147+
// Optional for CI or headless usage:
148+
// "NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE"
131149
}
132150
}
133151
}
@@ -143,6 +161,9 @@ Add to `.vscode/settings.json` in your project:
143161
Any MCP-compatible client can connect using stdio transport:
144162

145163
```bash
164+
SANDBOX_PATH=/your/path npx @nutrient-sdk/dws-mcp-server
165+
166+
# Optional for CI or headless usage:
146167
NUTRIENT_DWS_API_KEY=your_key SANDBOX_PATH=/your/path npx @nutrient-sdk/dws-mcp-server
147168
```
148169

@@ -154,16 +175,18 @@ Restart the application to pick up the new MCP server configuration.
154175

155176
### 4. Start Processing Documents
156177

157-
Drop documents into your sandbox directory and start giving instructions!
178+
Place documents in your sandbox directory and use explicit file names or paths in prompts. Explicit paths are safer and more reliable than vague file-browsing requests.
158179

159180
## Available Tools
160181

161-
| Tool | Description |
162-
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
163-
| **document_processor** | All-in-one document processing: merge PDFs, convert formats, apply OCR, watermark, rotate, redact, flatten annotations, extract text/tables/key-value pairs, and more |
164-
| **document_signer** | Digitally sign PDFs with PAdES-compliant CMS or CAdES signatures, with customizable visible/invisible signature appearances |
165-
| **sandbox_file_tree** | Browse files in the sandbox directory (when sandbox mode is enabled) |
166-
| **directory_tree** | Browse directory contents (when sandbox mode is disabled) |
182+
| Tool | Description |
183+
| ---- | ----------- |
184+
| `document_processor` | Document processing for conversions, OCR, extraction, watermarking, rotation, annotation flattening, and redaction workflows |
185+
| `document_signer` | PDF signing with CMS / PKCS#7 and CAdES signatures plus visible or invisible appearance options |
186+
| `ai_redactor` | AI redaction for detecting and permanently removing sensitive content such as names, addresses, SSNs, emails, and custom criteria |
187+
| `check_credits` | Read-only account lookup for current DWS credits and usage. No document content is uploaded |
188+
| `sandbox_file_tree` | Read-only view of files inside the configured sandbox directory |
189+
| `directory_tree` | Read-only view of local files when sandbox mode is disabled. Sandbox mode is strongly recommended |
167190

168191
### Document Processor Capabilities
169192

@@ -179,6 +202,28 @@ Drop documents into your sandbox directory and start giving instructions!
179202
| Annotations | Import XFDF annotations, flatten annotations |
180203
| Digital Signing | PAdES-compliant CMS and CAdES digital signatures (via document_signer tool) |
181204

205+
## Usage Examples
206+
207+
These examples assume your files live inside the configured sandbox and that you use explicit paths.
208+
209+
### Example 1: HTML -> PDF -> signing
210+
211+
**User prompt:** `Convert /path/to/sandbox/invoice.html to PDF and save it as /path/to/sandbox/invoice.pdf. Then digitally sign /path/to/sandbox/invoice.pdf with a visible signature and save it as /path/to/sandbox/invoice-signed.pdf.`
212+
213+
**What happens:** The server uploads the HTML file to Nutrient, saves the generated PDF in the sandbox, then signs that PDF and writes the signed result back to the requested output path.
214+
215+
### Example 2: OCR extraction
216+
217+
**User prompt:** `Run OCR on /path/to/sandbox/scanned-contract.pdf, return the extracted text, and save the OCR'd file as /path/to/sandbox/scanned-contract-ocr.pdf.`
218+
219+
**What happens:** The server sends the scanned PDF to Nutrient for OCR, returns the extracted text in Claude, and writes the OCR-processed file back to the sandbox for later use.
220+
221+
### Example 3: Check credits -> process -> inspect output
222+
223+
**User prompt:** `Check my Nutrient credits, convert /path/to/sandbox/report.docx to PDF, save it as /path/to/sandbox/report.pdf, and then tell me where the output file was written.`
224+
225+
**What happens:** The server first performs a read-only account lookup, then converts the DOCX file to PDF, saves the result in the sandbox, and tells the user exactly where the output file was written.
226+
182227
## Use with AI Agent Frameworks
183228

184229
This MCP server works with any platform that supports the Model Context Protocol:
@@ -215,6 +260,8 @@ export SANDBOX_PATH=/path/to/sandbox/directory
215260
npx @nutrient-sdk/dws-mcp-server
216261
```
217262

263+
Supported CLI flags are `--sandbox <dir>` and `-s <dir>`. Unknown CLI flags fail fast instead of silently disabling sandboxing.
264+
218265
When sandbox mode is enabled:
219266

220267
- Relative paths resolve relative to the sandbox directory
@@ -225,7 +272,7 @@ When sandbox mode is enabled:
225272
226273
### Output Location
227274

228-
Processed files are saved to a location determined by the AI. To guide output placement, use natural language (e.g., "save the result to `output/result.pdf`") or create an `output` directory in your sandbox.
275+
Processed files are saved to a location determined by the AI. To guide output placement, use explicit output paths such as `save the result to /path/to/sandbox/output/result.pdf` or create an `output` directory in your sandbox.
229276

230277
### Authentication
231278

@@ -234,27 +281,54 @@ The server authenticates to the Nutrient DWS API (`https://api.nutrient.io`) usi
234281
| Method | When | Config |
235282
|--------|------|--------|
236283
| **API key** | `NUTRIENT_DWS_API_KEY` is set | Static key passed as Bearer token to DWS API |
237-
| **OAuth browser flow** | No API key set | Opens browser for Nutrient OAuth consent, caches token locally |
284+
| **OAuth browser flow** | No API key set | Opens browser for Nutrient OAuth consent on the first request that uses the Nutrient API, caches token locally |
238285

239-
When no API key is configured, the server opens a browser-based OAuth flow on the first tool call (similar to `gh auth login`). Tokens are cached at `$XDG_CONFIG_HOME/nutrient/credentials.json` or `~/.config/nutrient/credentials.json` and refreshed automatically.
286+
When no API key is configured, the server stays connected and opens a browser-based OAuth flow on the first request that uses the Nutrient API (similar to `gh auth login`). Tokens are cached at `$XDG_CONFIG_HOME/nutrient/credentials.json` or `~/.config/nutrient/credentials.json` and refreshed automatically.
240287

241288
### Environment Variables
242289

243290
| Variable | Required | Description |
244291
| ---------------------- | ----------- | -------------------------------------------------------------------------------------------- |
245-
| `NUTRIENT_DWS_API_KEY` | No* | Nutrient DWS API key ([get one free](https://dashboard.nutrient.io/sign_up/)) |
246-
| `SANDBOX_PATH` | Recommended | Directory to restrict file operations to |
247-
| `CLIENT_ID` | No | OAuth client ID. Skips DCR and enables token refresh when set |
248-
| `DWS_API_BASE_URL` | No | DWS API base URL (default: `https://api.nutrient.io`) |
249-
| `LOG_LEVEL` | No | Winston logger level (`info` default). Logs are written to `MCP_LOG_FILE` in stdio mode |
250-
| `MCP_LOG_FILE` | No | Override log file path (default: system temp directory) |
292+
| `NUTRIENT_DWS_API_KEY` | No* | Nutrient DWS API key ([get one free](https://dashboard.nutrient.io/sign_up/)) |
293+
| `SANDBOX_PATH` | Recommended | Directory to restrict file operations to |
294+
| `AUTH_SERVER_URL` | No | OAuth server base URL (default: `https://api.nutrient.io`) |
295+
| `CLIENT_ID` | No | OAuth client ID. Skips DCR and enables refresh token reuse when set |
296+
| `DWS_API_BASE_URL` | No | DWS API base URL (default: `https://api.nutrient.io`) |
297+
| `LOG_LEVEL` | No | Winston logger level (`info` default). Logs are written to `MCP_LOG_FILE` in stdio mode |
298+
| `MCP_LOG_FILE` | No | Override log file path (default: system temp directory) |
251299

252300
\* If omitted, the server uses an OAuth browser flow to authenticate with the Nutrient API.
253301

302+
## Data Handling
303+
304+
### What Stays Local
305+
306+
- The MCP server process, sandbox enforcement, and file path resolution run on the local machine.
307+
- `sandbox_file_tree` and `directory_tree` inspect local files only. They do not upload document contents to Nutrient.
308+
- API keys and OAuth credentials are stored locally on the machine running the MCP server.
309+
310+
### What Gets Sent to Nutrient
311+
312+
- `document_processor`, `document_signer`, and `ai_redactor` send the relevant request metadata and referenced document bytes to the Nutrient DWS API so the requested operation can run.
313+
- `check_credits` sends an authenticated account lookup but does not upload document files.
314+
- Processed results are written back to the local output path you request.
315+
254316
### Security Note: Token Storage
255317

256318
When using the OAuth browser flow, access tokens and refresh tokens are cached in plaintext at `$XDG_CONFIG_HOME/nutrient/credentials.json` or `~/.config/nutrient/credentials.json` (permissions `0600`). This file contains credentials equivalent to your API key. Do not commit it to version control or include it in shared backups.
257319

320+
## Privacy Policy
321+
322+
This extension reads files from the local sandbox, sends document contents and processing instructions to Nutrient when you invoke document tools, and stores API keys or OAuth credentials locally on the machine running the MCP server.
323+
324+
Nutrient's privacy policy is available at [nutrient.io/legal/privacy](https://www.nutrient.io/legal/privacy/).
325+
326+
## Support
327+
328+
For product or account support, contact Nutrient at [nutrient.io/company/contact](https://www.nutrient.io/company/contact/).
329+
330+
For bugs or feature requests specific to this MCP package, use [GitHub issues](https://github.com/PSPDFKit/nutrient-dws-mcp-server/issues).
331+
258332
## Troubleshooting
259333

260334
### Reset authentication to a clean state
@@ -303,7 +377,7 @@ The server will automatically register a new client and open the browser for con
303377

304378
- Check that `SANDBOX_PATH` points to an existing directory
305379
- Ensure your documents are inside the sandbox directory
306-
- Use the `sandbox_file_tree` tool to verify visible files
380+
- Ask the assistant to inspect the configured sandbox, or inspect the sandbox directory directly
307381

308382
## Contributing
309383

manifest.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"manifest_version": "0.3",
3+
"name": "nutrient-dws-mcp-server",
4+
"display_name": "Nutrient DWS",
5+
"version": "0.0.5",
6+
"description": "Process, sign, redact, and transform documents from Claude Desktop using Nutrient.",
7+
"long_description": "A local Claude Desktop extension for document processing with Nutrient. It runs as a stdio MCP server, reads files from a user-selected sandbox directory, opens a browser for OAuth on the first request that uses the Nutrient API, and writes processed results back to local output paths.",
8+
"author": {
9+
"name": "Nutrient",
10+
"url": "https://www.nutrient.io/"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/PSPDFKit/nutrient-dws-mcp-server.git"
15+
},
16+
"homepage": "https://www.nutrient.io/mcp-server-pdf-automation-llm/",
17+
"documentation": "https://www.nutrient.io/guides/dws-processor/getting-started/mcp-server/",
18+
"support": "https://github.com/PSPDFKit/nutrient-dws-mcp-server/issues",
19+
"keywords": [
20+
"mcp",
21+
"pdf",
22+
"document-processing",
23+
"ocr",
24+
"redaction",
25+
"digital-signature"
26+
],
27+
"license": "MIT",
28+
"privacy_policies": [
29+
"https://www.nutrient.io/legal/privacy/"
30+
],
31+
"server": {
32+
"type": "node",
33+
"entry_point": "dist/index.js",
34+
"mcp_config": {
35+
"command": "node",
36+
"args": [
37+
"${__dirname}/dist/index.js",
38+
"--sandbox",
39+
"${user_config.sandbox_path}"
40+
],
41+
"env": {}
42+
}
43+
},
44+
"tools": [
45+
{
46+
"name": "document_processor",
47+
"description": "Convert, OCR, extract, watermark, rotate, flatten annotations, and process documents."
48+
},
49+
{
50+
"name": "document_signer",
51+
"description": "Digitally sign PDF files with CMS or CAdES signatures."
52+
},
53+
{
54+
"name": "ai_redactor",
55+
"description": "Detect and permanently redact sensitive content such as names, addresses, SSNs, and emails."
56+
},
57+
{
58+
"name": "check_credits",
59+
"description": "Check the current Nutrient DWS credit balance and usage."
60+
},
61+
{
62+
"name": "sandbox_file_tree",
63+
"description": "Browse files available in the configured sandbox directory."
64+
}
65+
],
66+
"compatibility": {
67+
"claude_desktop": ">=0.10.0",
68+
"platforms": [
69+
"darwin",
70+
"win32"
71+
],
72+
"runtimes": {
73+
"node": ">=18.0.0"
74+
}
75+
},
76+
"user_config": {
77+
"sandbox_path": {
78+
"type": "directory",
79+
"title": "Sandbox Directory",
80+
"description": "Directory the extension can read from and write to for document processing.",
81+
"required": true
82+
}
83+
}
84+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
"build": "tsc && shx chmod +x dist/index.js",
4343
"format": "prettier --write .",
4444
"lint": "eslint .",
45+
"mcpb:validate": "npx -y @anthropic-ai/mcpb validate manifest.json",
46+
"mcpb:pack": "pnpm run build && node scripts/build-mcpb.mjs",
4547
"pretest": "tsc --project tsconfig.test.json --noEmit",
4648
"test": "vitest run",
4749
"test:ci": "vitest run --exclude tests/build-api-examples.test.ts --exclude tests/signing-api-examples.test.ts",

0 commit comments

Comments
 (0)