Skip to content

Commit d314c2a

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

7 files changed

Lines changed: 399 additions & 49 deletions

File tree

README.md

Lines changed: 116 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,25 @@
33
![Document workflows using natural language](https://raw.githubusercontent.com/PSPDFKit/nutrient-dws-mcp-server/main/resources/readme-header.png)
44

55
<a href="https://glama.ai/mcp/servers/@PSPDFKit/nutrient-dws-mcp-server">
6-
<img width="380" height="200" src="https://glama.ai/mcp/servers/@PSPDFKit/nutrient-dws-mcp-server/badge" alt="Nutrient DWS Server MCP server" />
6+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@PSPDFKit/nutrient-dws-mcp-server/badge" alt="Nutrient DWS MCP Server" />
77
</a>
88

99
[![npm](https://img.shields.io/npm/v/%40nutrient-sdk/dws-mcp-server)](https://www.npmjs.com/package/@nutrient-sdk/dws-mcp-server)
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

@@ -116,19 +133,19 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
116133
<details>
117134
<summary><strong>VS Code (GitHub Copilot)</strong></summary>
118135

119-
Add to `.vscode/settings.json` in your project:
136+
Create `.vscode/mcp.json` in your project, or add the same server definition to your user `mcp.json` profile:
120137

121-
```json
138+
```jsonc
122139
{
123-
"mcp": {
124-
"servers": {
125-
"nutrient-dws": {
126-
"command": "npx",
127-
"args": ["-y", "@nutrient-sdk/dws-mcp-server"],
128-
"env": {
129-
"NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE",
130-
"SANDBOX_PATH": "${workspaceFolder}"
131-
}
140+
"servers": {
141+
"nutrient-dws": {
142+
"type": "stdio",
143+
"command": "npx",
144+
"args": ["-y", "@nutrient-sdk/dws-mcp-server"],
145+
"env": {
146+
"SANDBOX_PATH": "${workspaceFolder}",
147+
// Optional for CI or headless usage:
148+
// "NUTRIENT_DWS_API_KEY": "YOUR_API_KEY_HERE"
132149
}
133150
}
134151
}
@@ -143,6 +160,9 @@ Add to `.vscode/settings.json` in your project:
143160
Any MCP-compatible client can connect using stdio transport:
144161

145162
```bash
163+
SANDBOX_PATH=/your/path npx @nutrient-sdk/dws-mcp-server
164+
165+
# Optional for CI or headless usage:
146166
NUTRIENT_DWS_API_KEY=your_key SANDBOX_PATH=/your/path npx @nutrient-sdk/dws-mcp-server
147167
```
148168

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

155175
### 4. Start Processing Documents
156176

157-
Drop documents into your sandbox directory and start giving instructions!
177+
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.
158178

159179
## Available Tools
160180

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) |
181+
| Tool | Description |
182+
| ---- | ----------- |
183+
| `document_processor` | Document processing for conversions, OCR, extraction, watermarking, rotation, annotation flattening, and redaction workflows |
184+
| `document_signer` | PDF signing with CMS / PKCS#7 and CAdES signatures plus visible or invisible appearance options |
185+
| `ai_redactor` | AI redaction for detecting and permanently removing sensitive content such as names, addresses, SSNs, emails, and custom criteria |
186+
| `check_credits` | Read-only account lookup for current DWS credits and usage. No document content is uploaded |
187+
| `sandbox_file_tree` | Read-only view of files inside the configured sandbox directory |
188+
| `directory_tree` | Read-only view of local files when sandbox mode is disabled. Sandbox mode is strongly recommended |
167189

168190
### Document Processor Capabilities
169191

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

204+
## Usage Examples
205+
206+
These examples assume your files live inside the configured sandbox and that you use explicit paths.
207+
208+
### Example 1: HTML -> PDF -> signing
209+
210+
**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.`
211+
212+
**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.
213+
214+
### Example 2: OCR extraction
215+
216+
**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.`
217+
218+
**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.
219+
220+
### Example 3: Check credits -> process -> inspect output
221+
222+
**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.`
223+
224+
**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.
225+
182226
## Use with AI Agent Frameworks
183227

184228
This MCP server works with any platform that supports the Model Context Protocol:
@@ -215,6 +259,8 @@ export SANDBOX_PATH=/path/to/sandbox/directory
215259
npx @nutrient-sdk/dws-mcp-server
216260
```
217261

262+
Supported CLI flags are `--sandbox <dir>` and `-s <dir>`. Unrecognized flags cause a startup error.
263+
218264
When sandbox mode is enabled:
219265

220266
- Relative paths resolve relative to the sandbox directory
@@ -225,7 +271,7 @@ When sandbox mode is enabled:
225271
226272
### Output Location
227273

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.
274+
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.
229275

230276
### Authentication
231277

@@ -234,27 +280,54 @@ The server authenticates to the Nutrient DWS API (`https://api.nutrient.io`) usi
234280
| Method | When | Config |
235281
|--------|------|--------|
236282
| **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 |
283+
| **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 |
238284

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.
285+
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.
240286

241287
### Environment Variables
242288

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

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

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

256317
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.
257318

319+
## Privacy Policy
320+
321+
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.
322+
323+
Nutrient's privacy policy is available at [nutrient.io/legal/privacy](https://www.nutrient.io/legal/privacy/).
324+
325+
## Support
326+
327+
For product or account support, contact Nutrient at [nutrient.io/company/contact](https://www.nutrient.io/company/contact/).
328+
329+
For bugs or feature requests specific to this MCP package, use [GitHub issues](https://github.com/PSPDFKit/nutrient-dws-mcp-server/issues).
330+
258331
## Troubleshooting
259332

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

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

308381
## Contributing
309382

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)