cloak-business-mcp-server 2.6.1

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 (99) hide show
  1. package/CLAUDE_DESKTOP.md +322 -0
  2. package/README.md +378 -0
  3. package/dist/api-client.d.ts +65 -0
  4. package/dist/api-client.d.ts.map +1 -0
  5. package/dist/api-client.js +291 -0
  6. package/dist/api-client.js.map +1 -0
  7. package/dist/auth.d.ts +38 -0
  8. package/dist/auth.d.ts.map +1 -0
  9. package/dist/auth.js +139 -0
  10. package/dist/auth.js.map +1 -0
  11. package/dist/constants.d.ts +47 -0
  12. package/dist/constants.d.ts.map +1 -0
  13. package/dist/constants.js +187 -0
  14. package/dist/constants.js.map +1 -0
  15. package/dist/e2e-utils.d.ts +109 -0
  16. package/dist/e2e-utils.d.ts.map +1 -0
  17. package/dist/e2e-utils.js +132 -0
  18. package/dist/e2e-utils.js.map +1 -0
  19. package/dist/errors.d.ts +52 -0
  20. package/dist/errors.d.ts.map +1 -0
  21. package/dist/errors.js +86 -0
  22. package/dist/errors.js.map +1 -0
  23. package/dist/index.d.ts +16 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +167 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/logger.d.ts +33 -0
  28. package/dist/logger.d.ts.map +1 -0
  29. package/dist/logger.js +59 -0
  30. package/dist/logger.js.map +1 -0
  31. package/dist/server.d.ts +19 -0
  32. package/dist/server.d.ts.map +1 -0
  33. package/dist/server.js +434 -0
  34. package/dist/server.js.map +1 -0
  35. package/dist/stdio.d.ts +25 -0
  36. package/dist/stdio.d.ts.map +1 -0
  37. package/dist/stdio.js +96 -0
  38. package/dist/stdio.js.map +1 -0
  39. package/dist/tests/constants.test.d.ts +2 -0
  40. package/dist/tests/constants.test.d.ts.map +1 -0
  41. package/dist/tests/constants.test.js +36 -0
  42. package/dist/tests/constants.test.js.map +1 -0
  43. package/dist/tests/integration.test.d.ts +28 -0
  44. package/dist/tests/integration.test.d.ts.map +1 -0
  45. package/dist/tests/integration.test.js +383 -0
  46. package/dist/tests/integration.test.js.map +1 -0
  47. package/dist/tests/recognition.test.d.ts +25 -0
  48. package/dist/tests/recognition.test.d.ts.map +1 -0
  49. package/dist/tests/recognition.test.js +566 -0
  50. package/dist/tests/recognition.test.js.map +1 -0
  51. package/dist/tests/test-fixtures.d.ts +41 -0
  52. package/dist/tests/test-fixtures.d.ts.map +1 -0
  53. package/dist/tests/test-fixtures.js +878 -0
  54. package/dist/tests/test-fixtures.js.map +1 -0
  55. package/dist/tools/analyze.d.ts +236 -0
  56. package/dist/tools/analyze.d.ts.map +1 -0
  57. package/dist/tools/analyze.js +144 -0
  58. package/dist/tools/analyze.js.map +1 -0
  59. package/dist/tools/anonymize.d.ts +260 -0
  60. package/dist/tools/anonymize.d.ts.map +1 -0
  61. package/dist/tools/anonymize.js +264 -0
  62. package/dist/tools/anonymize.js.map +1 -0
  63. package/dist/tools/balance.d.ts +59 -0
  64. package/dist/tools/balance.d.ts.map +1 -0
  65. package/dist/tools/balance.js +66 -0
  66. package/dist/tools/balance.js.map +1 -0
  67. package/dist/tools/batch.d.ts +254 -0
  68. package/dist/tools/batch.d.ts.map +1 -0
  69. package/dist/tools/batch.js +88 -0
  70. package/dist/tools/batch.js.map +1 -0
  71. package/dist/tools/detokenize.d.ts +59 -0
  72. package/dist/tools/detokenize.d.ts.map +1 -0
  73. package/dist/tools/detokenize.js +52 -0
  74. package/dist/tools/detokenize.js.map +1 -0
  75. package/dist/tools/estimate.d.ts +136 -0
  76. package/dist/tools/estimate.d.ts.map +1 -0
  77. package/dist/tools/estimate.js +141 -0
  78. package/dist/tools/estimate.js.map +1 -0
  79. package/dist/tools/image.d.ts +175 -0
  80. package/dist/tools/image.d.ts.map +1 -0
  81. package/dist/tools/image.js +129 -0
  82. package/dist/tools/image.js.map +1 -0
  83. package/dist/tools/index.d.ts +19 -0
  84. package/dist/tools/index.d.ts.map +1 -0
  85. package/dist/tools/index.js +29 -0
  86. package/dist/tools/index.js.map +1 -0
  87. package/dist/tools/sessions.d.ts +151 -0
  88. package/dist/tools/sessions.d.ts.map +1 -0
  89. package/dist/tools/sessions.js +108 -0
  90. package/dist/tools/sessions.js.map +1 -0
  91. package/dist/transport.d.ts +36 -0
  92. package/dist/transport.d.ts.map +1 -0
  93. package/dist/transport.js +348 -0
  94. package/dist/transport.js.map +1 -0
  95. package/dist/types.d.ts +277 -0
  96. package/dist/types.d.ts.map +1 -0
  97. package/dist/types.js +38 -0
  98. package/dist/types.js.map +1 -0
  99. package/package.json +58 -0
@@ -0,0 +1,322 @@
1
+ # Claude Desktop Integration Guide
2
+
3
+ This guide explains how to set up the cloak.business MCP server with Claude Desktop for local PII anonymization capabilities.
4
+
5
+ **Version 2.6.1** - Supports 48 languages, image anonymization, batch processing, entity groups, presets, and custom recognizers.
6
+
7
+ ## Prerequisites
8
+
9
+ 1. **Claude Desktop** installed ([download](https://claude.ai/download))
10
+ 2. **Node.js 18+** installed ([download](https://nodejs.org/))
11
+ 3. **cloak.business API key** ([get your key](https://cloak.business/dashboard/api-keys))
12
+
13
+ ## Quick Setup
14
+
15
+ ### Step 1: Get Your API Key
16
+
17
+ 1. Go to [cloak.business/dashboard/api-keys](https://cloak.business/dashboard/api-keys)
18
+ 2. Create a new API key or copy an existing one
19
+ 3. Keep this key secure - you'll need it for the configuration
20
+
21
+ ### Step 2: Configure Claude Desktop
22
+
23
+ Open your Claude Desktop configuration file:
24
+
25
+ **Windows:**
26
+ ```
27
+ %APPDATA%\Claude\claude_desktop_config.json
28
+ ```
29
+
30
+ **macOS:**
31
+ ```
32
+ ~/Library/Application Support/Claude/claude_desktop_config.json
33
+ ```
34
+
35
+ **Linux:**
36
+ ```
37
+ ~/.config/Claude/claude_desktop_config.json
38
+ ```
39
+
40
+ Add the following configuration:
41
+
42
+ ```json
43
+ {
44
+ "mcpServers": {
45
+ "cloak-business": {
46
+ "command": "npx",
47
+ "args": ["-y", "cloak-business-mcp-server"],
48
+ "env": {
49
+ "cloak_business_API_KEY": "your-api-key-here"
50
+ }
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ Replace `your-api-key-here` with your actual API key.
57
+
58
+ ### Step 3: Restart Claude Desktop
59
+
60
+ Close and reopen Claude Desktop to load the new MCP server.
61
+
62
+ ## Available Tools
63
+
64
+ Once configured, Claude will have access to these PII anonymization tools:
65
+
66
+ | Tool | Description |
67
+ |------|-------------|
68
+ | `cloak_business_analyze_text` | Detect PII in text without modifying it |
69
+ | `cloak_business_anonymize_text` | Replace PII with redacted or tokenized values |
70
+ | `cloak_business_detokenize_text` | Restore original values from tokenized text |
71
+ | `cloak_business_batch_analyze` | Analyze multiple texts in one request (1-100 items) |
72
+ | `cloak_business_analyze_image` | Detect PII in images via OCR (returns bounding boxes) |
73
+ | `cloak_business_redact_image` | Redact PII from images via OCR (returns redacted image) |
74
+ | `cloak_business_get_balance` | Check your token balance (free) |
75
+ | `cloak_business_estimate_cost` | Estimate cost before processing (free) |
76
+ | `cloak_business_list_sessions` | List active tokenization sessions (free) |
77
+ | `cloak_business_delete_session` | Delete a tokenization session (free) |
78
+
79
+ ## Image Anonymization (v2.3.0)
80
+
81
+ Analyze and redact PII directly from images using OCR (Tesseract + NLP).
82
+
83
+ ### Supported Formats
84
+ - PNG, JPEG, BMP, TIFF (up to 10MB)
85
+
86
+ ### Analyze Image
87
+
88
+ Send an image and get back detected entities with bounding box positions:
89
+
90
+ **Ask Claude:**
91
+ > "Analyze this image for personal information" (attach or paste an image)
92
+
93
+ Claude will use `cloak_business_analyze_image` and return entities like:
94
+ ```
95
+ PERSON (score: 0.85) at position [24, 31, 159x35]
96
+ EMAIL_ADDRESS (score: 1.0) at position [25, 81, 284x35]
97
+ ```
98
+
99
+ ### Redact Image
100
+
101
+ Remove PII from images by filling detected regions with a solid color:
102
+
103
+ **Ask Claude:**
104
+ > "Redact all personal information from this image using red fill"
105
+
106
+ Claude will use `cloak_business_redact_image` and return a cleaned image with PII regions filled.
107
+
108
+ ### Fill Colors
109
+
110
+ Choose how redacted regions appear: `black` (default), `white`, `red`, `green`, `blue`, `gray`.
111
+
112
+ ## Batch Processing (v2.6.0)
113
+
114
+ Process multiple texts in a single request for bulk analysis workflows.
115
+
116
+ **Ask Claude:**
117
+ > "Analyze these customer messages for personal information" (paste multiple texts)
118
+
119
+ Claude will use `cloak_business_batch_analyze` to process 1-100 texts in parallel:
120
+ - Each text can have its own language setting
121
+ - Results include per-item entity counts and metadata
122
+ - Batch metadata shows totals across all items
123
+
124
+ **Example response:**
125
+ ```
126
+ Analyzed 3 texts:
127
+ - Text 1 (English): 2 entities (PERSON, EMAIL_ADDRESS)
128
+ - Text 2 (German): 2 entities (PERSON, IBAN_CODE)
129
+ - Text 3 (French): 2 entities (PERSON, LOCATION)
130
+
131
+ Total: 6 entities found, 6 tokens used
132
+ ```
133
+
134
+ ## Advanced Features (v2.2.0)
135
+
136
+ ### 48 Language Support
137
+
138
+ The MCP server now supports 48 languages:
139
+
140
+ **Common Languages:**
141
+ - English (`en`), German (`de`), French (`fr`), Spanish (`es`), Italian (`it`)
142
+ - Portuguese (`pt`), Dutch (`nl`), Polish (`pl`), Russian (`ru`)
143
+ - Japanese (`ja`), Chinese (`zh`), Korean (`ko`), Arabic (`ar`)
144
+
145
+ **Ask Claude:**
146
+ > "Analyze this German text for personal information: Hans Müller wohnt in der Hauptstraße 123, Berlin"
147
+
148
+ ### Entity Groups
149
+
150
+ Instead of listing individual entities, use groups:
151
+
152
+ | Group | Detects |
153
+ |-------|---------|
154
+ | `UNIVERSAL` | PERSON, EMAIL, PHONE, LOCATION, DATE_TIME, URL, IP_ADDRESS |
155
+ | `FINANCIAL` | CREDIT_CARD, IBAN_CODE, SWIFT_CODE, CRYPTO |
156
+ | `DACH` | German, Austrian, Swiss tax IDs and national numbers |
157
+ | `NORTH_AMERICA` | US_SSN, US_PASSPORT, CA_SIN, etc. |
158
+ | `ASIA_PACIFIC` | JP_MY_NUMBER, CN_RESIDENT_ID, AU_TFN, etc. |
159
+
160
+ **Ask Claude:**
161
+ > "Anonymize this text, focusing on financial entities: John paid with card 4111-1111-1111-1111"
162
+
163
+ ### Presets
164
+
165
+ Use preconfigured detection settings:
166
+
167
+ - `default` - Standard entity detection
168
+ - `personal` - Your custom saved preset
169
+ - `private` - Private/internal preset
170
+
171
+ **Ask Claude:**
172
+ > "Analyze this text using my personal preset: ..."
173
+
174
+ ### Score Threshold
175
+
176
+ Control detection sensitivity (0.0 to 1.0):
177
+
178
+ **Ask Claude:**
179
+ > "Anonymize this text with high confidence only (score threshold 0.8): ..."
180
+
181
+ ### Custom Operators
182
+
183
+ Control how each entity type is anonymized:
184
+
185
+ | Operator | Effect |
186
+ |----------|--------|
187
+ | `replace` | Replace with custom value |
188
+ | `redact` | Replace with `<ENTITY_TYPE>` |
189
+ | `hash` | One-way hash (SHA256/SHA512) |
190
+ | `mask` | Partial masking (e.g., `****1234`) |
191
+ | `encrypt` | Reversible encryption |
192
+ | `keep` | Don't anonymize this type |
193
+
194
+ **Ask Claude:**
195
+ > "Anonymize this text, but mask credit cards instead of redacting: John's card is 4111-1111-1111-1111"
196
+
197
+ ## Usage Examples
198
+
199
+ ### Basic Analysis
200
+
201
+ > "Analyze this text for personal information: John Smith lives at 123 Main St, New York. His email is john@example.com"
202
+
203
+ ### Anonymize with Tokenization (Reversible)
204
+
205
+ > "Anonymize this contract using tokenization so I can restore the original values later"
206
+
207
+ ### Regional Entity Detection
208
+
209
+ > "Anonymize this German document, looking for DACH region identifiers like tax IDs and social security numbers"
210
+
211
+ ### Multi-language Analysis
212
+
213
+ > "Analyze this French text for PII: Marie Dupont habite à Paris, son numéro NIR est 1 85 12 75 108 123 45"
214
+
215
+ ### Image Analysis
216
+
217
+ > "Check this scanned document for any personal information" (with an image)
218
+
219
+ ### Image Redaction
220
+
221
+ > "Remove all PII from this screenshot and give me a clean version" (with an image)
222
+
223
+ ### Check Balance
224
+
225
+ > "What's my cloak.business token balance?"
226
+
227
+ ## Alternative Setup: Local Development
228
+
229
+ If you're developing locally or want to use a local build:
230
+
231
+ ```json
232
+ {
233
+ "mcpServers": {
234
+ "cloak-business": {
235
+ "command": "node",
236
+ "args": ["C:/path/to/mcp-server/dist/stdio.js"],
237
+ "env": {
238
+ "cloak_business_API_KEY": "your-api-key-here"
239
+ }
240
+ }
241
+ }
242
+ }
243
+ ```
244
+
245
+ ## Troubleshooting
246
+
247
+ ### "API key required" Error
248
+
249
+ Make sure you've set the `cloak_business_API_KEY` environment variable in the config.
250
+
251
+ ### "API key validation failed" Error
252
+
253
+ 1. Check that your API key is correct
254
+ 2. Verify your key is active at [cloak.business/dashboard/api-keys](https://cloak.business/dashboard/api-keys)
255
+ 3. Ensure you have sufficient token balance
256
+
257
+ ### Server Not Appearing in Claude
258
+
259
+ 1. Make sure the config file is valid JSON (no trailing commas)
260
+ 2. Restart Claude Desktop completely
261
+ 3. Check Claude Desktop logs for errors
262
+
263
+ ### "npx not found" Error
264
+
265
+ Ensure Node.js is installed and `npx` is in your PATH:
266
+ ```bash
267
+ npx --version
268
+ ```
269
+
270
+ ### Language Not Supported Error
271
+
272
+ Check the list of 48 supported languages in the [README.md](./README.md). Common codes:
273
+ - `en` (English), `de` (German), `fr` (French), `es` (Spanish)
274
+ - `ar` (Arabic), `zh` (Chinese), `ja` (Japanese), `ko` (Korean)
275
+
276
+ ## Architecture
277
+
278
+ ```
279
+ ┌─────────────────────┐ stdio ┌──────────────────────┐
280
+ │ Claude Desktop │◄──────────────►│ MCP Server (local) │
281
+ │ │ JSON-RPC │ cloak-business-mcp │
282
+ └─────────────────────┘ └──────────┬───────────┘
283
+ │ HTTPS
284
+
285
+ ┌──────────────────────┐
286
+ │ cloak.business API │
287
+ │ (cloud backend) │
288
+ │ 48 languages │
289
+ │ 80+ entity types │
290
+ │ Image OCR + redact │
291
+ └──────────────────────┘
292
+ ```
293
+
294
+ - **Claude Desktop** spawns the MCP server as a subprocess
295
+ - **MCP Server** runs locally on your machine
296
+ - **API calls** go securely to cloak.business cloud for PII processing
297
+ - **Your text** is processed and returned - no data is stored
298
+
299
+ ## Security Notes
300
+
301
+ - Your API key is stored locally in your Claude Desktop config
302
+ - All communication with cloak.business uses HTTPS
303
+ - The MCP server runs as a local process (no network ports opened)
304
+ - Text is processed in memory and not persisted locally
305
+
306
+ ## Support
307
+
308
+ - **Documentation:** [cloak.business/docs/mcp](https://cloak.business/docs/mcp)
309
+ - **API Keys:** [cloak.business/dashboard/api-keys](https://cloak.business/dashboard/api-keys)
310
+ - **Full README:** [README.md](./README.md)
311
+ - **Support:** support@cloak.business
312
+
313
+ ## Version History
314
+
315
+ - **v2.6.1** - Security hardening: error sanitization, request ID propagation
316
+ - **v2.6.0** - Batch analyze: process 1-100 texts in a single request
317
+ - **v2.5.0** - Retry logic with exponential backoff for transient failures
318
+ - **v2.4.0** - Structured logging, enhanced health checks, error codes
319
+ - **v2.3.0** - Image anonymization: analyze and redact PII in images via OCR
320
+ - **v2.2.0** - 48 languages, presets, entity groups, custom operators
321
+ - **v2.1.0** - Added stdio transport for Claude Desktop integration
322
+ - **v2.0.x** - HTTP/Streamable HTTP transport for Cursor IDE
package/README.md ADDED
@@ -0,0 +1,378 @@
1
+ # cloak.business MCP Server
2
+
3
+ **Zero-setup** MCP integration for AI tools. Connect to cloak.business's PII anonymization directly from Cursor, Claude Desktop, or any MCP-compatible client.
4
+
5
+ **Supports 48 languages**, regional entity groups, presets, and custom recognizers.
6
+
7
+ ## Quick Start
8
+
9
+ ### Option 1: Streamable HTTP (Cursor, Web Clients)
10
+
11
+ **No Node.js required** - just add the URL to your configuration.
12
+
13
+ ```json
14
+ {
15
+ "mcpServers": {
16
+ "cloak-business": {
17
+ "url": "https://cloak.business/mcp",
18
+ "headers": {
19
+ "Authorization": "Bearer YOUR_API_KEY"
20
+ }
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ ### Option 2: stdio Transport (Claude Desktop)
27
+
28
+ See [CLAUDE_DESKTOP.md](./CLAUDE_DESKTOP.md) for full setup guide.
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "cloak-business": {
34
+ "command": "npx",
35
+ "args": ["-y", "cloak-business-mcp-server"],
36
+ "env": {
37
+ "cloak_business_API_KEY": "your-api-key-here"
38
+ }
39
+ }
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Getting Your API Key
45
+
46
+ 1. Sign up at [cloak.business](https://cloak.business)
47
+ 2. Go to **Dashboard** > **API Keys**
48
+ 3. Create a new API key
49
+ 4. Copy and use in your MCP configuration
50
+
51
+ ## Available Tools
52
+
53
+ All tool names are prefixed with `cloak_business_` for namespace clarity.
54
+
55
+ ### `cloak_business_analyze_text`
56
+
57
+ Analyze text for PII without modifying it.
58
+
59
+ **Parameters:**
60
+ | Parameter | Type | Description |
61
+ |-----------|------|-------------|
62
+ | `text` | string | **Required.** The text to analyze |
63
+ | `output` | string | `"full"` \| `"summary"` \| `"counts"` (default: `"full"`) |
64
+ | `language` | string | Language code - 48 supported (default: `"en"`) |
65
+ | `entities` | string[] | Specific entity types to detect |
66
+ | `entity_groups` | string[] | Entity groups: UNIVERSAL, FINANCIAL, DACH, etc. |
67
+ | `score_threshold` | number | Confidence threshold 0.0-1.0 (default: 0.5) |
68
+ | `preset` | string | `"default"` \| `"personal"` \| `"private"` |
69
+ | `ad_hoc_recognizers` | object[] | Custom regex-based recognizers |
70
+
71
+ **Example:**
72
+ ```json
73
+ {
74
+ "text": "Contact John Doe at john@example.com, SSN 123-45-6789",
75
+ "language": "en",
76
+ "entity_groups": ["UNIVERSAL", "NORTH_AMERICA"],
77
+ "score_threshold": 0.7,
78
+ "output": "counts"
79
+ }
80
+ ```
81
+
82
+ **Response:**
83
+ ```json
84
+ {
85
+ "entity_counts": { "PERSON": 1, "EMAIL_ADDRESS": 1, "US_SSN": 1 },
86
+ "entities_found": 3,
87
+ "tokens_charged": 8,
88
+ "score_threshold": 0.7
89
+ }
90
+ ```
91
+
92
+ ### `cloak_business_anonymize_text`
93
+
94
+ Cloakize text by replacing PII with placeholders or reversible tokens.
95
+
96
+ **Parameters:**
97
+ | Parameter | Type | Description |
98
+ |-----------|------|-------------|
99
+ | `text` | string | **Required.** The text to anonymize |
100
+ | `mode` | string | `"redact"` (permanent) \| `"tokenize"` (reversible) |
101
+ | `output` | string | `"full"` \| `"metadata"` \| `"minimal"` |
102
+ | `language` | string | Language code - 48 supported (default: `"en"`) |
103
+ | `entities` | string[] | Specific entity types to detect |
104
+ | `entity_groups` | string[] | Entity groups to detect |
105
+ | `score_threshold` | number | Confidence threshold 0.0-1.0 |
106
+ | `preset` | string | `"default"` \| `"personal"` \| `"private"` |
107
+ | `persistence` | string | `"session"` (24h) \| `"persistent"` (30d) |
108
+ | `sessionName` | string | Optional name for the session |
109
+ | `operators` | object | Custom operators per entity type |
110
+
111
+ **Operators Example:**
112
+ ```json
113
+ {
114
+ "text": "John Doe, email: john@example.com, card: 4111-1111-1111-1111",
115
+ "mode": "redact",
116
+ "operators": {
117
+ "PERSON": { "type": "replace", "new_value": "[REDACTED NAME]" },
118
+ "EMAIL_ADDRESS": { "type": "hash", "hash_type": "SHA256" },
119
+ "CREDIT_CARD": { "type": "mask", "chars_to_mask": 12, "from_end": false }
120
+ }
121
+ }
122
+ ```
123
+
124
+ **Response:**
125
+ ```json
126
+ {
127
+ "anonymized_text": "[REDACTED NAME], email: a1b2c3d4e5f6..., card: ************1111",
128
+ "entities_found": 3,
129
+ "tokens_charged": 12
130
+ }
131
+ ```
132
+
133
+ ### `cloak_business_detokenize_text`
134
+
135
+ Restore original PII values from tokenized text.
136
+
137
+ **Parameters:**
138
+ - `text` (required): The tokenized text
139
+ - `sessionId` (required): Session ID from anonymization
140
+ - `partial`: Allow partial restoration (default: `false`)
141
+
142
+ ### `cloak_business_analyze_image`
143
+
144
+ Analyze an image for PII using OCR. Returns detected entities with bounding box positions.
145
+
146
+ **Parameters:**
147
+ | Parameter | Type | Description |
148
+ |-----------|------|-------------|
149
+ | `image` | string | **Required.** Base64-encoded image data |
150
+ | `image_format` | string | **Required.** `"png"` \| `"jpeg"` \| `"bmp"` \| `"tiff"` |
151
+ | `language` | string | OCR language hint, 2-letter ISO code (default: `"en"`) |
152
+ | `entities` | string[] | Specific entity types to detect |
153
+ | `score_threshold` | number | Confidence threshold 0.0-1.0 (default: 0.5) |
154
+
155
+ **Example:**
156
+ ```json
157
+ {
158
+ "image": "<base64-encoded-png>",
159
+ "image_format": "png",
160
+ "language": "en"
161
+ }
162
+ ```
163
+
164
+ **Response:**
165
+ ```json
166
+ {
167
+ "entities": [
168
+ { "entity_type": "PERSON", "score": 0.85, "left": 24, "top": 31, "width": 159, "height": 35 },
169
+ { "entity_type": "EMAIL_ADDRESS", "score": 1.0, "left": 25, "top": 81, "width": 284, "height": 35 }
170
+ ],
171
+ "entities_found": 2,
172
+ "tokens_charged": 3,
173
+ "processing_time_ms": 260
174
+ }
175
+ ```
176
+
177
+ ### `cloak_business_redact_image`
178
+
179
+ Redact PII from an image using OCR. Returns a base64-encoded redacted image.
180
+
181
+ **Parameters:**
182
+ | Parameter | Type | Description |
183
+ |-----------|------|-------------|
184
+ | `image` | string | **Required.** Base64-encoded image data |
185
+ | `image_format` | string | **Required.** `"png"` \| `"jpeg"` \| `"bmp"` \| `"tiff"` |
186
+ | `language` | string | OCR language hint, 2-letter ISO code (default: `"en"`) |
187
+ | `entities` | string[] | Specific entity types to redact |
188
+ | `score_threshold` | number | Confidence threshold 0.0-1.0 (default: 0.5) |
189
+ | `fill_color` | string | `"black"` \| `"white"` \| `"red"` \| `"green"` \| `"blue"` \| `"gray"` (default: `"black"`) |
190
+
191
+ **Response:**
192
+ ```json
193
+ {
194
+ "redacted_image": "<base64-encoded-png>",
195
+ "redacted_image_format": "png",
196
+ "image_size_bytes": 4313,
197
+ "tokens_charged": 3,
198
+ "processing_time_ms": 279
199
+ }
200
+ ```
201
+
202
+ ### `cloak_business_batch_analyze`
203
+
204
+ Analyze multiple texts for PII in a single request. Supports 1-100 texts with parallel processing.
205
+
206
+ **Parameters:**
207
+ | Parameter | Type | Description |
208
+ |-----------|------|-------------|
209
+ | `items` | array | **Required.** Array of texts to analyze (1-100 items) |
210
+ | `items[].text` | string | **Required.** The text to analyze |
211
+ | `items[].id` | string | Optional identifier for this item |
212
+ | `items[].language` | string | Language code for this item (default: `"en"`) |
213
+ | `items[].entities` | string[] | Specific entity types to detect |
214
+ | `output` | string | `"full"` \| `"summary"` \| `"counts"` (default: `"full"`) |
215
+
216
+ **Example:**
217
+ ```json
218
+ {
219
+ "items": [
220
+ { "id": "msg-1", "text": "John Smith at john@example.com", "language": "en" },
221
+ { "id": "msg-2", "text": "Hans Müller, IBAN DE89370400440532013000", "language": "de" }
222
+ ],
223
+ "output": "counts"
224
+ }
225
+ ```
226
+
227
+ **Response:**
228
+ ```json
229
+ {
230
+ "results": [
231
+ { "id": "msg-1", "success": true, "entity_counts": { "PERSON": 1, "EMAIL_ADDRESS": 1 }, "metadata": { "language": "en", "entities_found": 2, "tokens_used": 2 } },
232
+ { "id": "msg-2", "success": true, "entity_counts": { "PERSON": 1, "IBAN_CODE": 1 }, "metadata": { "language": "de", "entities_found": 2, "tokens_used": 2 } }
233
+ ],
234
+ "batch_metadata": {
235
+ "total_items": 2,
236
+ "successful": 2,
237
+ "failed": 0,
238
+ "total_entities_found": 4,
239
+ "total_tokens_used": 4,
240
+ "processing_time_ms": 320
241
+ }
242
+ }
243
+ ```
244
+
245
+ ### `cloak_business_get_balance`
246
+
247
+ Check your current token balance. **Free operation.**
248
+
249
+ ### `cloak_business_list_sessions`
250
+
251
+ List your active tokenization sessions. **Free operation.**
252
+
253
+ ### `cloak_business_delete_session`
254
+
255
+ Delete a tokenization session. **Free operation.**
256
+
257
+ ## Supported Languages (48)
258
+
259
+ ### spaCy Languages (25)
260
+ | Code | Language | Code | Language | Code | Language |
261
+ |------|----------|------|----------|------|----------|
262
+ | `en` | English | `de` | German | `es` | Spanish |
263
+ | `fr` | French | `it` | Italian | `pt` | Portuguese |
264
+ | `nl` | Dutch | `pl` | Polish | `ru` | Russian |
265
+ | `ja` | Japanese | `zh` | Chinese | `ko` | Korean |
266
+ | `ro` | Romanian | `el` | Greek | `hr` | Croatian |
267
+ | `sl` | Slovenian | `mk` | Macedonian | `sv` | Swedish |
268
+ | `da` | Danish | `nb` | Norwegian | `fi` | Finnish |
269
+ | `uk` | Ukrainian | `lt` | Lithuanian | `ca` | Catalan |
270
+ | `tr` | Turkish | | | | |
271
+
272
+ ### Stanza NER Languages (7)
273
+ | Code | Language | Code | Language |
274
+ |------|----------|------|----------|
275
+ | `bg` | Bulgarian | `hu` | Hungarian |
276
+ | `he` | Hebrew | `vi` | Vietnamese |
277
+ | `af` | Afrikaans | `hy` | Armenian |
278
+ | `eu` | Basque | | |
279
+
280
+ ### Transformer Languages (16)
281
+ | Code | Language | Code | Language | Code | Language |
282
+ |------|----------|------|----------|------|----------|
283
+ | `ar` | Arabic | `hi` | Hindi | `cs` | Czech |
284
+ | `sk` | Slovak | `id` | Indonesian | `th` | Thai |
285
+ | `fa` | Persian | `sr` | Serbian | `lv` | Latvian |
286
+ | `et` | Estonian | `ms` | Malay | `bn` | Bengali |
287
+ | `ur` | Urdu | `sw` | Swahili | `tl` | Tagalog |
288
+ | `is` | Icelandic | | | | |
289
+
290
+ ## Entity Groups
291
+
292
+ Use `entity_groups` parameter to detect regional entities easily:
293
+
294
+ | Group | Entities Included |
295
+ |-------|-------------------|
296
+ | `UNIVERSAL` | PERSON, EMAIL_ADDRESS, PHONE_NUMBER, LOCATION, DATE_TIME, URL, IP_ADDRESS, etc. |
297
+ | `FINANCIAL` | CREDIT_CARD, IBAN_CODE, SWIFT_CODE, CRYPTO |
298
+ | `DACH` | DE_TAX_ID, AT_SSN, CH_AHV, and more for Germany, Austria, Switzerland |
299
+ | `FRANCE` | FR_NIR, FR_CNI, BE_NATIONAL_NUMBER, LU_NATIONAL_ID |
300
+ | `SPAIN_LATAM` | ES_NIF, ES_NIE, MX_CURP, AR_DNI, CL_RUT, etc. |
301
+ | `ITALY` | IT_FISCAL_CODE, IT_VAT, IT_DRIVER_LICENSE, IT_HEALTH_CARD |
302
+ | `PORTUGAL_BRAZIL` | PT_NIF, PT_CC, BR_CPF, BR_CNPJ, BR_RG |
303
+ | `NORDIC` | DK_CPR, FI_HETU, SE_PERSONNUMMER, NO_FODSELSNUMMER, IS_KENNITALA |
304
+ | `POLAND` | PL_PESEL, PL_NIP, PL_REGON, PL_PASSPORT |
305
+ | `UK_IRELAND` | UK_NHS, UK_NINO, IE_PPS, UK_PASSPORT |
306
+ | `NORTH_AMERICA` | US_SSN, US_PASSPORT, CA_SIN, CA_HEALTH_NUMBER |
307
+ | `ASIA_PACIFIC` | JP_MY_NUMBER, CN_RESIDENT_ID, SG_NRIC, AU_TFN, IN_AADHAAR |
308
+ | `MIDDLE_EAST` | AE_EMIRATES_ID, SA_NATIONAL_ID, IL_ID_NUMBER |
309
+ | `HEALTHCARE` | MEDICAL_LICENSE, NRP, HEALTH_INSURANCE_ID |
310
+
311
+ ## Custom Recognizers (Ad-hoc)
312
+
313
+ Define custom patterns for domain-specific entities:
314
+
315
+ ```json
316
+ {
317
+ "text": "Employee ID: EMP-12345, Badge: B-9876",
318
+ "ad_hoc_recognizers": [
319
+ {
320
+ "entity_type": "EMPLOYEE_ID",
321
+ "patterns": [{ "regex": "EMP-\\d{5}", "score": 0.9 }],
322
+ "context": ["employee", "staff", "worker"]
323
+ },
324
+ {
325
+ "entity_type": "BADGE_NUMBER",
326
+ "patterns": [{ "regex": "B-\\d{4}", "score": 0.85 }]
327
+ }
328
+ ]
329
+ }
330
+ ```
331
+
332
+ ## Operator Types
333
+
334
+ | Operator | Description | Parameters |
335
+ |----------|-------------|------------|
336
+ | `replace` | Replace with custom value | `new_value` |
337
+ | `redact` | Replace with `<ENTITY_TYPE>` | - |
338
+ | `hash` | One-way hash | `hash_type`: SHA256, SHA512 |
339
+ | `encrypt` | Reversible encryption | `key`: 16/24/32 char key |
340
+ | `mask` | Partial masking | `chars_to_mask`, `masking_char`, `from_end` |
341
+ | `keep` | Keep original value | - |
342
+
343
+ ## Architecture
344
+
345
+ This MCP server supports two transports:
346
+
347
+ - **Streamable HTTP**: For web clients, Cursor IDE - processing on cloak.business servers
348
+ - **stdio**: For Claude Desktop - local process, API calls to cloak.business
349
+
350
+ Your data is:
351
+ - Encrypted in transit (TLS 1.3)
352
+ - Processed in memory only (not stored)
353
+ - Tokenization mappings encrypted at rest (AES-256-GCM)
354
+ - GDPR compliant (EU data residency)
355
+
356
+ ## Version History
357
+
358
+ - **v2.6.1** - Security hardening: error sanitization, request ID propagation
359
+ - **v2.6.0** - Batch analyze: process 1-100 texts in a single request
360
+ - **v2.5.0** - Retry logic with exponential backoff for transient failures
361
+ - **v2.4.0** - Structured logging, enhanced health checks, error codes
362
+ - **v2.3.0** - Image anonymization: analyze and redact PII in images via OCR
363
+ - **v2.2.1** - Timing-safe API key comparison to prevent timing attacks
364
+ - **v2.2.0** - 48 languages, presets, entity groups, advanced features
365
+ - **v2.1.0** - stdio transport for Claude Desktop
366
+ - **v2.0.x** - Streamable HTTP transport, enhanced tools
367
+ - **v1.0.0** - Initial release with stdio transport
368
+
369
+ ## Support
370
+
371
+ - **Website**: [cloak.business](https://cloak.business)
372
+ - **Documentation**: [cloak.business/docs](https://cloak.business/docs)
373
+ - **Claude Desktop Setup**: [CLAUDE_DESKTOP.md](./CLAUDE_DESKTOP.md)
374
+ - **Support**: support@cloak.business
375
+
376
+ ## License
377
+
378
+ MIT License