@bitsbound/mcp-server 1.0.0

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.
@@ -0,0 +1,1266 @@
1
+ ////////////////////////////////////////
2
+ // # GOLDEN RULE!!!! HONOR ABOVE ALL!!!!
3
+ ////////////////////////////////////////
4
+ // NO NEW FILES!!!!!!!!!
5
+ ////////////////////////////////////////
6
+ export const DEFAULT_API_URL = 'https://bitsbound-saas-backend-mxb1.onrender.com';
7
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
8
+ // MCP Tool Definitions 'R_DVT_G_D_ToolDefs' - Tool schemas for MCP protocol
9
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
10
+ export const TOOL_DEFINITIONS = {
11
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
12
+ // CHUNKED UPLOAD TOOLS - Required for claude.ai to avoid permission dialog timeout
13
+ // The base64 string is split into ~50KB chunks so each permission dialog can render quickly
14
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
15
+ // Step 1: Start a chunked upload session
16
+ start_upload: {
17
+ name: 'start_upload',
18
+ description: 'Start a chunked file upload session. Call this FIRST before uploading chunks. Returns an uploadId to use with upload_chunk. This approach avoids timeout issues with large files in claude.ai.',
19
+ inputSchema: {
20
+ type: 'object',
21
+ properties: {
22
+ fileName: {
23
+ type: 'string',
24
+ description: 'Original filename (e.g., "Master_Services_Agreement.docx")'
25
+ },
26
+ totalChunks: {
27
+ type: 'number',
28
+ description: 'Total number of chunks you will upload. Calculate: Math.ceil(base64String.length / 50000)'
29
+ },
30
+ fileSizeBytes: {
31
+ type: 'number',
32
+ description: 'Optional: Total file size in bytes for validation'
33
+ }
34
+ },
35
+ required: ['fileName', 'totalChunks']
36
+ },
37
+ annotations: {
38
+ readOnlyHint: false,
39
+ destructiveHint: false
40
+ }
41
+ },
42
+ // Step 2: Upload each chunk
43
+ upload_chunk: {
44
+ name: 'upload_chunk',
45
+ description: 'Upload a single chunk of the file. Call this repeatedly for each chunk (0 to totalChunks-1). Each chunk should be ~50KB of base64 data to avoid timeout.',
46
+ inputSchema: {
47
+ type: 'object',
48
+ properties: {
49
+ uploadId: {
50
+ type: 'string',
51
+ description: 'The uploadId returned from start_upload'
52
+ },
53
+ chunkIndex: {
54
+ type: 'number',
55
+ description: 'Zero-based index of this chunk (0, 1, 2, ...)'
56
+ },
57
+ chunkData: {
58
+ type: 'string',
59
+ description: 'Base64 data for this chunk. Max ~50KB per chunk to avoid timeout.'
60
+ }
61
+ },
62
+ required: ['uploadId', 'chunkIndex', 'chunkData']
63
+ },
64
+ annotations: {
65
+ readOnlyHint: false,
66
+ destructiveHint: false
67
+ }
68
+ },
69
+ // Step 3: Complete the upload
70
+ complete_upload: {
71
+ name: 'complete_upload',
72
+ description: 'Complete a chunked upload after all chunks are uploaded. Returns a fileId to use with process_contract.',
73
+ inputSchema: {
74
+ type: 'object',
75
+ properties: {
76
+ uploadId: {
77
+ type: 'string',
78
+ description: 'The uploadId from start_upload'
79
+ }
80
+ },
81
+ required: ['uploadId']
82
+ },
83
+ annotations: {
84
+ readOnlyHint: false,
85
+ destructiveHint: false
86
+ }
87
+ },
88
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
89
+ // LEGACY SINGLE UPLOAD - May timeout in claude.ai for large files (prefer chunked upload)
90
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
91
+ upload_contract: {
92
+ name: 'upload_contract',
93
+ description: '⚠️ LEGACY - May timeout in claude.ai for large files. Use start_upload + upload_chunk + complete_upload instead. Uploads entire file at once.',
94
+ inputSchema: {
95
+ type: 'object',
96
+ properties: {
97
+ docxBase64: {
98
+ type: 'string',
99
+ description: 'The contract document content as a base64-encoded string.'
100
+ },
101
+ fileName: {
102
+ type: 'string',
103
+ description: 'Original filename of the document (e.g., "Master_Services_Agreement.docx").'
104
+ }
105
+ },
106
+ required: ['docxBase64', 'fileName']
107
+ },
108
+ annotations: {
109
+ readOnlyHint: false,
110
+ destructiveHint: false
111
+ }
112
+ },
113
+ // Step 4: Process the uploaded contract
114
+ process_contract: {
115
+ name: 'process_contract',
116
+ description: 'Process a contract through the full 8-stage BitsBound pipeline. TWO MODES: (1) Claude Desktop: Pass filePath directly - server reads local file. (2) claude.ai: First upload via start_upload/upload_chunk/complete_upload, then pass fileId here.',
117
+ inputSchema: {
118
+ type: 'object',
119
+ properties: {
120
+ filePath: {
121
+ type: 'string',
122
+ description: 'LOCAL FILE PATH (Claude Desktop only). Server reads file directly from disk. Example: "/Users/rob/Documents/contract.docx"'
123
+ },
124
+ fileId: {
125
+ type: 'string',
126
+ description: 'FILE ID (claude.ai only). The fileId returned from complete_upload after chunked upload.'
127
+ },
128
+ analysisDepth: {
129
+ type: 'string',
130
+ enum: ['quick', 'standard', 'deep'],
131
+ description: 'Analysis depth: quick (~5 min), standard (~15 min), deep (~30 min). Default: standard'
132
+ },
133
+ perspective: {
134
+ type: 'string',
135
+ enum: ['customer', 'vendor', 'neutral'],
136
+ description: 'Analyze from customer (buyer), vendor (seller), or neutral perspective. Default: customer'
137
+ }
138
+ },
139
+ required: []
140
+ },
141
+ annotations: {
142
+ readOnlyHint: false,
143
+ destructiveHint: false
144
+ }
145
+ },
146
+ get_analysis_status: {
147
+ name: 'get_analysis_status',
148
+ description: 'Check the status of a running or completed contract analysis. Returns progress through the 8-stage pipeline (Context→Extraction→Parties→Research→Analysis→Swarm→Email→Synthesis), current phase name, and results when complete.',
149
+ inputSchema: {
150
+ type: 'object',
151
+ properties: {
152
+ analysisId: {
153
+ type: 'string',
154
+ description: 'The processing ID returned from process_contract'
155
+ }
156
+ },
157
+ required: ['analysisId']
158
+ },
159
+ annotations: {
160
+ readOnlyHint: true
161
+ }
162
+ },
163
+ ask_sac: {
164
+ name: 'ask_sac',
165
+ description: 'Ask the Supreme AI Co-Counsel (SAC) questions about an analyzed contract. SAC has full context of the contract and all analysis results. Great for clarifying risks, understanding clauses, or getting negotiation advice.',
166
+ inputSchema: {
167
+ type: 'object',
168
+ properties: {
169
+ analysisId: {
170
+ type: 'string',
171
+ description: 'The analysis ID of a completed analysis'
172
+ },
173
+ question: {
174
+ type: 'string',
175
+ description: 'Your question about the contract'
176
+ },
177
+ includeClauseCitations: {
178
+ type: 'boolean',
179
+ description: 'Include specific clause citations in the response. Default: true'
180
+ }
181
+ },
182
+ required: ['analysisId', 'question']
183
+ },
184
+ annotations: {
185
+ readOnlyHint: true
186
+ }
187
+ },
188
+ generate_redline: {
189
+ name: 'generate_redline',
190
+ description: 'Generate a redlined Word document with real OOXML Track Changes (w:ins, w:del) applied directly to the original document. Returns the redlined DOCX as base64.',
191
+ inputSchema: {
192
+ type: 'object',
193
+ properties: {
194
+ analysisId: {
195
+ type: 'string',
196
+ description: 'The analysis ID of a completed analysis'
197
+ },
198
+ aggressiveness: {
199
+ type: 'number',
200
+ enum: [1, 2, 3, 4, 5],
201
+ description: 'How aggressive the redlines should be (1=conservative, 5=aggressive). Default: 3'
202
+ },
203
+ includeComments: {
204
+ type: 'boolean',
205
+ description: 'Include rationale comments in Word margins. Default: true'
206
+ }
207
+ },
208
+ required: ['analysisId']
209
+ },
210
+ annotations: {
211
+ readOnlyHint: false,
212
+ destructiveHint: false
213
+ }
214
+ },
215
+ generate_negotiation_email: {
216
+ name: 'generate_negotiation_email',
217
+ description: 'Generate a professional negotiation email to send to the counterparty, explaining requested changes and their rationale.',
218
+ inputSchema: {
219
+ type: 'object',
220
+ properties: {
221
+ analysisId: {
222
+ type: 'string',
223
+ description: 'The analysis ID of a completed analysis'
224
+ },
225
+ tone: {
226
+ type: 'string',
227
+ enum: ['collaborative', 'firm', 'aggressive'],
228
+ description: 'Tone of the email. Default: collaborative'
229
+ },
230
+ recipientRole: {
231
+ type: 'string',
232
+ description: 'Role of the recipient (e.g., "General Counsel", "Sales Rep", "Procurement"). Helps tailor the message.'
233
+ }
234
+ },
235
+ required: ['analysisId']
236
+ },
237
+ annotations: {
238
+ readOnlyHint: false,
239
+ destructiveHint: false
240
+ }
241
+ },
242
+ extract_clause: {
243
+ name: 'extract_clause',
244
+ description: 'Extract and analyze a specific clause type from an analyzed contract. Returns the clause text, risk analysis, and suggested improvements.',
245
+ inputSchema: {
246
+ type: 'object',
247
+ properties: {
248
+ analysisId: {
249
+ type: 'string',
250
+ description: 'The analysis ID of a completed analysis'
251
+ },
252
+ clauseType: {
253
+ type: 'string',
254
+ enum: ['indemnification', 'liability', 'ip', 'termination', 'payment', 'confidentiality', 'data_privacy', 'sla', 'force_majeure', 'assignment'],
255
+ description: 'The type of clause to extract'
256
+ }
257
+ },
258
+ required: ['analysisId', 'clauseType']
259
+ },
260
+ annotations: {
261
+ readOnlyHint: true
262
+ }
263
+ },
264
+ compare_playbook: {
265
+ name: 'compare_playbook',
266
+ description: 'Compare an analyzed contract against a company playbook to identify deviations from pre-approved positions and required approvals.',
267
+ inputSchema: {
268
+ type: 'object',
269
+ properties: {
270
+ analysisId: {
271
+ type: 'string',
272
+ description: 'The analysis ID of a completed analysis'
273
+ },
274
+ playbookId: {
275
+ type: 'string',
276
+ description: 'The ID of the playbook to compare against'
277
+ }
278
+ },
279
+ required: ['analysisId', 'playbookId']
280
+ },
281
+ annotations: {
282
+ readOnlyHint: true
283
+ }
284
+ },
285
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
286
+ // INSTANT SWARM - Parallel N-Section Redlining (spawns N agents for N sections, max parallelization)
287
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
288
+ instant_swarm: {
289
+ name: 'instant_swarm',
290
+ description: 'PARALLEL REDLINING of entire contract. Spawns N independent SAC agents for N sections simultaneously - maximum parallelization with no lock contention. Each agent (IP, Liability, Indemnification, Payment, Term, etc.) independently analyzes and redlines its section, then all branches merge into a single DOCX with real Track Changes. Returns merged document + per-section results. Requires a completed analysis (use process_contract first). This is the flagship feature - full attorney-quality redlines across the entire contract in parallel.',
291
+ inputSchema: {
292
+ type: 'object',
293
+ properties: {
294
+ analysisId: {
295
+ type: 'string',
296
+ description: 'The analysis ID from a completed process_contract call. The analysis provides contract context for each section.'
297
+ },
298
+ aggressivenessLevel: {
299
+ type: 'number',
300
+ enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
301
+ description: 'How aggressive the redlines should be (1=conservative, 10=very aggressive). Recommended: 5-7 for balanced approach.'
302
+ },
303
+ partyPosition: {
304
+ type: 'string',
305
+ enum: ['customer', 'vendor'],
306
+ description: 'Which side are you on? "customer" = you are buying/receiving services. "vendor" = you are selling/providing services.'
307
+ },
308
+ ourPartyName: {
309
+ type: 'string',
310
+ description: 'Your company name as it should appear in redlines (e.g., "Acme Corp").'
311
+ },
312
+ counterpartyName: {
313
+ type: 'string',
314
+ description: 'The other party\'s name (e.g., "Vendor Inc").'
315
+ },
316
+ targetSections: {
317
+ type: 'array',
318
+ items: { type: 'string' },
319
+ description: 'Optional: specific BUBSA sections to analyze. If omitted, analyzes all 17 sections. Valid sections: parties, definitions, ip_license, payment, term_termination, confidentiality, data_privacy, reps_warranties, indemnification, liability, insurance, assignment, force_majeure, dispute_resolution, precedence, miscellaneous, sla'
320
+ }
321
+ },
322
+ required: ['analysisId', 'aggressivenessLevel', 'partyPosition']
323
+ },
324
+ annotations: {
325
+ readOnlyHint: false,
326
+ destructiveHint: false
327
+ }
328
+ },
329
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
330
+ // QUICK TOOLS - Immediate analysis without waiting for full pipeline
331
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
332
+ quick_scan: {
333
+ name: 'quick_scan',
334
+ description: 'INSTANT contract analysis (5-10 seconds). Get immediate risk assessment, contract classification, top concerns, and key terms WITHOUT waiting for the full 15-30 minute analysis. Perfect for initial triage or quick questions. Use this FIRST before deciding if a full analysis is needed.',
335
+ inputSchema: {
336
+ type: 'object',
337
+ properties: {
338
+ contractText: {
339
+ type: 'string',
340
+ description: 'The contract text (plain text or base64-encoded DOCX). For DOCX files, base64 encode the file contents.'
341
+ },
342
+ fileName: {
343
+ type: 'string',
344
+ description: 'Optional filename for context (e.g., "Acme_MSA_2024.docx")'
345
+ },
346
+ perspective: {
347
+ type: 'string',
348
+ enum: ['customer', 'vendor', 'neutral'],
349
+ description: 'Analyze from customer (buyer), vendor (seller), or neutral perspective. Default: customer'
350
+ }
351
+ },
352
+ required: ['contractText']
353
+ },
354
+ annotations: {
355
+ readOnlyHint: true
356
+ }
357
+ },
358
+ ask_clause: {
359
+ name: 'ask_clause',
360
+ description: 'INSTANT clause Q&A (2-5 seconds). Ask about specific clauses directly WITHOUT needing a prior analysis. Examples: "What does the indemnification clause say?", "Is there a limitation of liability?", "What are the termination terms?"',
361
+ inputSchema: {
362
+ type: 'object',
363
+ properties: {
364
+ contractText: {
365
+ type: 'string',
366
+ description: 'The contract text (plain text or base64-encoded DOCX)'
367
+ },
368
+ question: {
369
+ type: 'string',
370
+ description: 'Your question about the contract (e.g., "What is the liability cap?", "Is there an auto-renewal clause?")'
371
+ },
372
+ clauseType: {
373
+ type: 'string',
374
+ enum: ['indemnification', 'liability', 'ip', 'termination', 'payment', 'confidentiality', 'data_privacy', 'sla', 'force_majeure', 'assignment', 'any'],
375
+ description: 'Optional: Focus on a specific clause type, or "any" to search the whole contract. Default: any'
376
+ }
377
+ },
378
+ required: ['contractText', 'question']
379
+ },
380
+ annotations: {
381
+ readOnlyHint: true
382
+ }
383
+ },
384
+ check_dealbreakers: {
385
+ name: 'check_dealbreakers',
386
+ description: 'INSTANT dealbreaker check (3-5 seconds). Quick pass/fail screen against your playbook rules. Identifies blockers, missing required clauses, and who needs to approve. Use before spending time on full analysis.',
387
+ inputSchema: {
388
+ type: 'object',
389
+ properties: {
390
+ contractText: {
391
+ type: 'string',
392
+ description: 'The contract text (plain text or base64-encoded DOCX)'
393
+ },
394
+ playbookId: {
395
+ type: 'string',
396
+ description: 'Optional: Specific playbook to check against. If not provided, uses your default company playbook.'
397
+ }
398
+ },
399
+ required: ['contractText']
400
+ },
401
+ annotations: {
402
+ readOnlyHint: true
403
+ }
404
+ }
405
+ };
406
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
407
+ // MCP Resource Definitions 'R_DVT_G_D_ResourceDefs' - Resources AI can read
408
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
409
+ export const RESOURCE_DEFINITIONS = {
410
+ analysis: {
411
+ uriTemplate: 'bitsbound://analysis/{analysisId}',
412
+ name: 'Contract Analysis',
413
+ description: 'Full analysis results including all 17 analyzer outputs, risk scores, and recommendations',
414
+ mimeType: 'application/json'
415
+ },
416
+ playbook: {
417
+ uriTemplate: 'bitsbound://playbook/{playbookId}',
418
+ name: 'Company Playbook',
419
+ description: 'Pre-approved clause library and negotiation rules',
420
+ mimeType: 'application/json'
421
+ },
422
+ redline: {
423
+ uriTemplate: 'bitsbound://redline/{analysisId}',
424
+ name: 'Redlined Contract',
425
+ description: 'The redlined DOCX with Track Changes',
426
+ mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
427
+ }
428
+ };
429
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
430
+ // MCP Prompt Definitions 'R_DVT_G_D_PromptDefs' - User-facing workflow templates
431
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
432
+ /**
433
+ * PROMPT_DEFINITIONS - MCP Prompts for guiding users through BitsBound workflows
434
+ * D: These appear in claude.ai's "Add from BitsBound" menu as actionable items
435
+ *
436
+ * TIR{ADVT}O Context:
437
+ * - T: User selects a prompt from the menu
438
+ * - I: Prompt template with optional arguments
439
+ * - R: Claude receives structured instructions to guide the workflow
440
+ * - O: User experiences a smooth, guided contract analysis flow
441
+ */
442
+ export const PROMPT_DEFINITIONS = {
443
+ process_contract: {
444
+ name: 'process_contract',
445
+ description: '📄 Process Contract - Upload a DOCX and get partner-level redlines with Track Changes, risk analysis, and a negotiation email',
446
+ arguments: []
447
+ }
448
+ };
449
+ /**
450
+ * PROMPT_MESSAGES - The actual prompt content sent to Claude when user selects a prompt
451
+ * D: These guide Claude to ask for the right inputs and call the right tools
452
+ * Note: MCP SDK requires content to be TextContent object with type: 'text' and text: string
453
+ */
454
+ export const PROMPT_MESSAGES = {
455
+ process_contract: [
456
+ {
457
+ role: 'user',
458
+ content: {
459
+ type: 'text',
460
+ text: `I want to process a contract using BitsBound.
461
+
462
+ Please help me by:
463
+ 1. Ask me to upload the contract file (DOCX format)
464
+ 2. Once I upload it, use CHUNKED UPLOAD to avoid permission dialog timeout:
465
+
466
+ STEP 1 - Read and encode the file:
467
+ - Read the file content
468
+ - Base64 encode it to get a base64 string
469
+ - Calculate chunk count: Math.ceil(base64String.length / 50000)
470
+
471
+ STEP 2 - Start upload session:
472
+ - Call 'start_upload' with fileName and totalChunks
473
+ - Save the uploadId from the response
474
+
475
+ STEP 3 - Upload chunks (repeat for each chunk):
476
+ - Split the base64 string into 50,000 character chunks
477
+ - For each chunk, call 'upload_chunk' with uploadId, chunkIndex (0,1,2...), and chunkData
478
+ - Each chunk is small enough for the permission dialog to render quickly
479
+
480
+ STEP 4 - Complete upload:
481
+ - Call 'complete_upload' with uploadId
482
+ - Save the fileId from the response
483
+
484
+ STEP 5 - Process the contract:
485
+ - Call 'process_contract' with the fileId
486
+
487
+ IMPORTANT: Do NOT pass file paths - the MCP server cannot access your file system.
488
+ The chunked approach ensures each permission dialog only shows ~50KB of data.
489
+
490
+ 3. Processing takes about 15-30 minutes - check progress with 'get_analysis_status'
491
+ 4. When complete, show me:
492
+ - The favorability score (who the contract favors)
493
+ - Top 5 risks I should know about
494
+ - Recommended negotiation priorities
495
+
496
+ The redlined document and negotiation email are included automatically with Instant Swarm™.`
497
+ }
498
+ }
499
+ ]
500
+ };
501
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
502
+ // OpenAPI Specification 'R_DVT_G_D_OpenAPI' - For ChatGPT Actions
503
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
504
+ /**
505
+ * OpenAPI 3.1 specification for BitsBound Contract Analysis API.
506
+ * Used by ChatGPT Custom GPT Actions to call the BitsBound MCP API endpoints.
507
+ *
508
+ * TIR{ADVT}O Context:
509
+ * - Definition: Complete API schema enabling ChatGPT to understand and call BitsBound endpoints
510
+ * - Validation: JSON Schema validation for all request/response bodies
511
+ * - Output: JSON object conforming to OpenAPI 3.1 specification
512
+ */
513
+ export const OPENAPI_SPEC = {
514
+ openapi: '3.1.0',
515
+ info: {
516
+ title: 'BitsBound Contract Analysis API',
517
+ description: 'AI-powered contract analysis for legal professionals. Analyze contracts, generate redlines with real Track Changes, get clause-by-clause risk analysis, and draft negotiation emails.',
518
+ version: '1.0.0',
519
+ contact: {
520
+ name: 'BitsBound Support',
521
+ url: 'https://bitsbound.com',
522
+ email: 'support@bitsbound.com'
523
+ },
524
+ termsOfService: 'https://bitsbound.com/terms',
525
+ 'x-logo': {
526
+ url: 'https://bitsbound.com/favicon.svg'
527
+ }
528
+ },
529
+ servers: [
530
+ {
531
+ url: 'https://bitsbound-saas-backend-mxb1.onrender.com',
532
+ description: 'Production server'
533
+ }
534
+ ],
535
+ security: [
536
+ { ApiKeyAuth: [] }
537
+ ],
538
+ paths: {
539
+ '/api/v1/mcp/analyze': {
540
+ post: {
541
+ operationId: 'analyzeContract',
542
+ summary: 'Upload and analyze a contract',
543
+ description: 'Upload a contract (DOCX or PDF) for comprehensive AI analysis through an 8-stage pipeline: (1) Context Loading, (2) Data Extraction with 13 scripts, (3) Party Identification, (4) Research with 8 parallel analyzers, (5) AI Analysis with 18+ parallel analyzers, (6) Instant Swarm™ parallel redlining (optional), (7) Email Generation (optional), (8) Synthesis. Returns an analysis ID to track progress.',
544
+ tags: ['Contract Analysis'],
545
+ requestBody: {
546
+ required: true,
547
+ content: {
548
+ 'application/json': {
549
+ schema: {
550
+ type: 'object',
551
+ required: ['contract_content', 'filename'],
552
+ properties: {
553
+ contract_content: {
554
+ type: 'string',
555
+ description: 'Base64-encoded contract file (DOCX or PDF)'
556
+ },
557
+ filename: {
558
+ type: 'string',
559
+ description: 'Original filename with extension (e.g., "msa.docx")'
560
+ },
561
+ analysis_type: {
562
+ type: 'string',
563
+ enum: ['quick', 'standard', 'full'],
564
+ default: 'full',
565
+ description: 'Analysis depth: quick (~5 min), standard (~15 min), full (~30 min)'
566
+ }
567
+ }
568
+ }
569
+ }
570
+ }
571
+ },
572
+ responses: {
573
+ '200': {
574
+ description: 'Analysis started successfully',
575
+ content: {
576
+ 'application/json': {
577
+ schema: {
578
+ type: 'object',
579
+ properties: {
580
+ success: { type: 'boolean' },
581
+ analysisId: { type: 'string', description: 'Unique identifier for tracking this analysis' },
582
+ status: { type: 'string', enum: ['queued', 'processing'] },
583
+ estimatedTime: { type: 'string', description: 'Estimated completion time' },
584
+ message: { type: 'string' }
585
+ }
586
+ }
587
+ }
588
+ }
589
+ },
590
+ '400': { description: 'Invalid request - missing or malformed parameters' },
591
+ '401': { description: 'Invalid or missing API key' }
592
+ }
593
+ }
594
+ },
595
+ '/api/v1/mcp/analysis/{analysisId}/status': {
596
+ get: {
597
+ operationId: 'getAnalysisStatus',
598
+ summary: 'Check analysis progress',
599
+ description: 'Poll this endpoint to check the status of a running analysis through the 8-stage pipeline. Returns progress percentage, current phase (Loading Context → Extracting Data → Identifying Parties → Researching → AI Analysis → Instant Swarm™ → Generating Email → Synthesizing Results), and results when complete.',
600
+ tags: ['Contract Analysis'],
601
+ parameters: [
602
+ {
603
+ name: 'analysisId',
604
+ in: 'path',
605
+ required: true,
606
+ schema: { type: 'string' },
607
+ description: 'The analysis ID returned from analyzeContract'
608
+ }
609
+ ],
610
+ responses: {
611
+ '200': {
612
+ description: 'Analysis status retrieved',
613
+ content: {
614
+ 'application/json': {
615
+ schema: {
616
+ type: 'object',
617
+ properties: {
618
+ success: { type: 'boolean' },
619
+ analysisId: { type: 'string' },
620
+ status: { type: 'string', enum: ['queued', 'processing', 'completed', 'failed'] },
621
+ progress: { type: 'number', description: 'Progress percentage (0-100)' },
622
+ currentPhase: { type: 'string', description: 'Current analysis phase from the 8-stage pipeline' },
623
+ phases: { type: 'array', items: { type: 'string' }, description: 'Completed phases: phase1_context, phase2_extraction, phase3_parties, phase4_research, phase5_analysis, phase6_instantswarm, phase7_email, phase8_synthesis' },
624
+ createdAt: { type: 'string', format: 'date-time' },
625
+ completedAt: { type: 'string', format: 'date-time' }
626
+ }
627
+ }
628
+ }
629
+ }
630
+ },
631
+ '404': { description: 'Analysis not found' }
632
+ }
633
+ }
634
+ },
635
+ '/api/v1/mcp/analysis/{analysisId}/full': {
636
+ get: {
637
+ operationId: 'getFullAnalysis',
638
+ summary: 'Get complete analysis results',
639
+ description: 'Retrieve the full analysis results including all section analyses, risks, favorability scores, and recommendations. Only available after analysis completes.',
640
+ tags: ['Contract Analysis'],
641
+ parameters: [
642
+ {
643
+ name: 'analysisId',
644
+ in: 'path',
645
+ required: true,
646
+ schema: { type: 'string' }
647
+ }
648
+ ],
649
+ responses: {
650
+ '200': {
651
+ description: 'Full analysis results',
652
+ content: {
653
+ 'application/json': {
654
+ schema: {
655
+ type: 'object',
656
+ properties: {
657
+ success: { type: 'boolean' },
658
+ analysisId: { type: 'string' },
659
+ status: { type: 'string' },
660
+ analysis: { type: 'object', description: 'Section-by-section analysis' },
661
+ risks: { type: 'array', items: { type: 'object' }, description: 'Identified risks' },
662
+ favorability: { type: 'object', description: 'Favorability scores' },
663
+ recommendations: { type: 'array', items: { type: 'object' } }
664
+ }
665
+ }
666
+ }
667
+ }
668
+ },
669
+ '400': { description: 'Analysis not yet complete' },
670
+ '404': { description: 'Analysis not found' }
671
+ }
672
+ }
673
+ },
674
+ '/api/v1/mcp/sac/chat': {
675
+ post: {
676
+ operationId: 'askSac',
677
+ summary: 'Ask the Supreme AI Co-Counsel',
678
+ description: 'Ask questions about an analyzed contract. SAC (Supreme AI Co-Counsel) has full context of the contract and all analysis results. Great for clarifying risks, understanding clauses, or getting negotiation advice.',
679
+ tags: ['SAC Chat'],
680
+ requestBody: {
681
+ required: true,
682
+ content: {
683
+ 'application/json': {
684
+ schema: {
685
+ type: 'object',
686
+ required: ['analysis_id', 'question'],
687
+ properties: {
688
+ analysis_id: { type: 'string', description: 'Analysis ID from a completed analysis' },
689
+ question: { type: 'string', description: 'Your question about the contract' },
690
+ context: { type: 'string', description: 'Optional additional context for the question' }
691
+ }
692
+ }
693
+ }
694
+ }
695
+ },
696
+ responses: {
697
+ '200': {
698
+ description: 'SAC response',
699
+ content: {
700
+ 'application/json': {
701
+ schema: {
702
+ type: 'object',
703
+ properties: {
704
+ success: { type: 'boolean' },
705
+ answer: { type: 'string', description: 'SAC response to your question' },
706
+ citations: { type: 'array', items: { type: 'string' }, description: 'Relevant clause citations' },
707
+ confidence: { type: 'number', description: 'Confidence score (0-1)' },
708
+ analysisContext: { type: 'object', description: 'Summary of analysis context used' }
709
+ }
710
+ }
711
+ }
712
+ }
713
+ },
714
+ '404': { description: 'Analysis not found' }
715
+ }
716
+ }
717
+ },
718
+ '/api/v1/mcp/redline/generate': {
719
+ post: {
720
+ operationId: 'generateRedline',
721
+ summary: 'Generate redlined document',
722
+ description: 'Generate a redlined Word document with real OOXML Track Changes (w:ins, w:del) applied directly to the original document. Returns a download URL for the redlined DOCX.',
723
+ tags: ['Document Generation'],
724
+ requestBody: {
725
+ required: true,
726
+ content: {
727
+ 'application/json': {
728
+ schema: {
729
+ type: 'object',
730
+ required: ['analysis_id'],
731
+ properties: {
732
+ analysis_id: { type: 'string' },
733
+ include_comments: { type: 'boolean', default: true, description: 'Include rationale comments in margins' },
734
+ format: { type: 'string', enum: ['docx', 'pdf'], default: 'docx' }
735
+ }
736
+ }
737
+ }
738
+ }
739
+ },
740
+ responses: {
741
+ '200': {
742
+ description: 'Redline generated successfully',
743
+ content: {
744
+ 'application/json': {
745
+ schema: {
746
+ type: 'object',
747
+ properties: {
748
+ success: { type: 'boolean' },
749
+ analysisId: { type: 'string' },
750
+ downloadUrl: { type: 'string', format: 'uri', description: 'URL to download the redlined document' },
751
+ format: { type: 'string' },
752
+ expiresAt: { type: 'string', format: 'date-time', description: 'URL expiration time' }
753
+ }
754
+ }
755
+ }
756
+ }
757
+ },
758
+ '404': { description: 'Analysis not found' }
759
+ }
760
+ }
761
+ },
762
+ '/api/v1/mcp/email/generate': {
763
+ post: {
764
+ operationId: 'generateNegotiationEmail',
765
+ summary: 'Generate negotiation email',
766
+ description: 'Generate a professional negotiation email to send to the counterparty, explaining requested changes and their rationale.',
767
+ tags: ['Document Generation'],
768
+ requestBody: {
769
+ required: true,
770
+ content: {
771
+ 'application/json': {
772
+ schema: {
773
+ type: 'object',
774
+ required: ['analysis_id'],
775
+ properties: {
776
+ analysis_id: { type: 'string' },
777
+ tone: { type: 'string', enum: ['professional', 'collaborative', 'firm'], default: 'professional' },
778
+ recipient_name: { type: 'string', description: 'Name of the recipient' },
779
+ sender_name: { type: 'string', description: 'Name of the sender' }
780
+ }
781
+ }
782
+ }
783
+ }
784
+ },
785
+ responses: {
786
+ '200': {
787
+ description: 'Email draft generated',
788
+ content: {
789
+ 'application/json': {
790
+ schema: {
791
+ type: 'object',
792
+ properties: {
793
+ success: { type: 'boolean' },
794
+ analysisId: { type: 'string' },
795
+ email: {
796
+ type: 'object',
797
+ properties: {
798
+ subject: { type: 'string' },
799
+ body: { type: 'string' },
800
+ keyPoints: { type: 'array', items: { type: 'string' } }
801
+ }
802
+ },
803
+ tone: { type: 'string' }
804
+ }
805
+ }
806
+ }
807
+ }
808
+ },
809
+ '404': { description: 'Analysis not found' }
810
+ }
811
+ }
812
+ },
813
+ '/api/v1/mcp/analysis/{analysisId}/clause/{clauseType}': {
814
+ get: {
815
+ operationId: 'extractClause',
816
+ summary: 'Extract and analyze specific clause',
817
+ description: 'Extract a specific clause type from an analyzed contract. Returns the clause text, risk analysis, and suggested improvements.',
818
+ tags: ['Clause Extraction'],
819
+ parameters: [
820
+ {
821
+ name: 'analysisId',
822
+ in: 'path',
823
+ required: true,
824
+ schema: { type: 'string' }
825
+ },
826
+ {
827
+ name: 'clauseType',
828
+ in: 'path',
829
+ required: true,
830
+ schema: {
831
+ type: 'string',
832
+ enum: ['indemnification', 'liability', 'limitation_of_liability', 'confidentiality', 'ip', 'intellectual_property', 'termination', 'term', 'payment', 'data_protection', 'privacy', 'warranty', 'warranties', 'force_majeure', 'assignment', 'insurance', 'sla', 'dpa']
833
+ },
834
+ description: 'Type of clause to extract'
835
+ }
836
+ ],
837
+ responses: {
838
+ '200': {
839
+ description: 'Clause extracted successfully',
840
+ content: {
841
+ 'application/json': {
842
+ schema: {
843
+ type: 'object',
844
+ properties: {
845
+ success: { type: 'boolean' },
846
+ analysisId: { type: 'string' },
847
+ clauseType: { type: 'string' },
848
+ clause: {
849
+ type: 'object',
850
+ properties: {
851
+ text: { type: 'string' },
852
+ analysis: { type: 'object' },
853
+ favorability: { type: 'object' },
854
+ risks: { type: 'array', items: { type: 'object' } },
855
+ recommendations: { type: 'array', items: { type: 'string' } }
856
+ }
857
+ }
858
+ }
859
+ }
860
+ }
861
+ }
862
+ },
863
+ '404': { description: 'Analysis or clause not found' }
864
+ }
865
+ }
866
+ },
867
+ '/api/v1/mcp/playbook/compare': {
868
+ post: {
869
+ operationId: 'comparePlaybook',
870
+ summary: 'Compare against playbook',
871
+ description: 'Compare an analyzed contract against a company playbook to identify deviations from pre-approved positions.',
872
+ tags: ['Playbook'],
873
+ requestBody: {
874
+ required: true,
875
+ content: {
876
+ 'application/json': {
877
+ schema: {
878
+ type: 'object',
879
+ required: ['analysis_id', 'playbook_id'],
880
+ properties: {
881
+ analysis_id: { type: 'string' },
882
+ playbook_id: { type: 'string', description: 'ID of the playbook to compare against' }
883
+ }
884
+ }
885
+ }
886
+ }
887
+ },
888
+ responses: {
889
+ '200': {
890
+ description: 'Playbook comparison results',
891
+ content: {
892
+ 'application/json': {
893
+ schema: {
894
+ type: 'object',
895
+ properties: {
896
+ success: { type: 'boolean' },
897
+ analysisId: { type: 'string' },
898
+ playbookId: { type: 'string' },
899
+ playbookName: { type: 'string' },
900
+ comparison: {
901
+ type: 'object',
902
+ properties: {
903
+ complianceScore: { type: 'number' },
904
+ deviations: { type: 'array', items: { type: 'object' } },
905
+ totalRulesChecked: { type: 'integer' },
906
+ passedRules: { type: 'integer' },
907
+ failedRules: { type: 'integer' }
908
+ }
909
+ }
910
+ }
911
+ }
912
+ }
913
+ }
914
+ },
915
+ '404': { description: 'Analysis or playbook not found' }
916
+ }
917
+ }
918
+ },
919
+ '/api/v1/mcp/playbooks': {
920
+ get: {
921
+ operationId: 'listPlaybooks',
922
+ summary: 'List available playbooks',
923
+ description: 'Get a list of all playbooks available for the authenticated user.',
924
+ tags: ['Playbook'],
925
+ responses: {
926
+ '200': {
927
+ description: 'List of playbooks',
928
+ content: {
929
+ 'application/json': {
930
+ schema: {
931
+ type: 'object',
932
+ properties: {
933
+ success: { type: 'boolean' },
934
+ playbooks: {
935
+ type: 'array',
936
+ items: {
937
+ type: 'object',
938
+ properties: {
939
+ id: { type: 'string' },
940
+ name: { type: 'string' },
941
+ description: { type: 'string' },
942
+ createdAt: { type: 'string', format: 'date-time' }
943
+ }
944
+ }
945
+ },
946
+ count: { type: 'integer' }
947
+ }
948
+ }
949
+ }
950
+ }
951
+ }
952
+ }
953
+ }
954
+ },
955
+ '/api/v1/mcp/playbook/{playbookId}': {
956
+ get: {
957
+ operationId: 'getPlaybook',
958
+ summary: 'Get playbook details',
959
+ description: 'Retrieve full details of a specific playbook including all rules and sections.',
960
+ tags: ['Playbook'],
961
+ parameters: [
962
+ {
963
+ name: 'playbookId',
964
+ in: 'path',
965
+ required: true,
966
+ schema: { type: 'string' }
967
+ }
968
+ ],
969
+ responses: {
970
+ '200': {
971
+ description: 'Playbook details',
972
+ content: {
973
+ 'application/json': {
974
+ schema: {
975
+ type: 'object',
976
+ properties: {
977
+ success: { type: 'boolean' },
978
+ playbook: {
979
+ type: 'object',
980
+ properties: {
981
+ id: { type: 'string' },
982
+ name: { type: 'string' },
983
+ description: { type: 'string' },
984
+ rules: { type: 'array', items: { type: 'object' } },
985
+ sections: { type: 'array', items: { type: 'object' } },
986
+ createdAt: { type: 'string', format: 'date-time' },
987
+ updatedAt: { type: 'string', format: 'date-time' }
988
+ }
989
+ }
990
+ }
991
+ }
992
+ }
993
+ }
994
+ },
995
+ '404': { description: 'Playbook not found' }
996
+ }
997
+ }
998
+ }
999
+ },
1000
+ components: {
1001
+ securitySchemes: {
1002
+ ApiKeyAuth: {
1003
+ type: 'apiKey',
1004
+ in: 'header',
1005
+ name: 'x-api-key',
1006
+ description: 'BitsBound API key (format: sk_live_xxxxx). Get yours at https://account.bitsbound.com/api-keys'
1007
+ },
1008
+ BearerAuth: {
1009
+ type: 'http',
1010
+ scheme: 'bearer',
1011
+ description: 'Alternative: Authorization: Bearer sk_live_xxxxx'
1012
+ }
1013
+ }
1014
+ },
1015
+ tags: [
1016
+ { name: 'Contract Analysis', description: 'Upload contracts and retrieve analysis results' },
1017
+ { name: 'SAC Chat', description: 'Interactive Q&A with Supreme AI Co-Counsel' },
1018
+ { name: 'Document Generation', description: 'Generate redlined documents and negotiation emails' },
1019
+ { name: 'Clause Extraction', description: 'Extract and analyze specific contract clauses' },
1020
+ { name: 'Playbook', description: 'Company playbook management and comparison' }
1021
+ ]
1022
+ };
1023
+ /**
1024
+ * Returns the OpenAPI spec as a JSON string, formatted for readability.
1025
+ */
1026
+ export function getOpenApiSpecJson() {
1027
+ return JSON.stringify(OPENAPI_SPEC, null, 2);
1028
+ }
1029
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
1030
+ // README Documentation 'R_DVT_G_D_README' - Comprehensive MCP Server Documentation
1031
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
1032
+ /**
1033
+ * BitsBound MCP Server - Comprehensive Documentation
1034
+ *
1035
+ * This documentation is exported as a constant to comply with NNF (No New Files) policy.
1036
+ * Access programmatically: `import { README_DOCUMENTATION } from './types/...Types.js'`
1037
+ */
1038
+ export const README_DOCUMENTATION = `# BitsBound MCP Server
1039
+
1040
+ AI-powered contract analysis for Claude, ChatGPT, and other AI platforms via the Model Context Protocol (MCP).
1041
+
1042
+ ## Overview
1043
+
1044
+ BitsBound MCP Server enables AI assistants to analyze contracts, generate redlined documents with real Track Changes,
1045
+ and provide clause-by-clause risk analysis. It connects AI platforms to BitsBound's 8-Stage TCA Pipeline:
1046
+
1047
+ 1. **Loading Context** - Parsing deal context and contract structure
1048
+ 2. **Extracting Data** - Running 13 deterministic extraction scripts
1049
+ 3. **Identifying Parties** - AI identifying customer and vendor positions
1050
+ 4. **Researching** - Running 8 parallel research analyzers
1051
+ 5. **AI Analysis** - Running 18+ parallel AI analyzers (The Swarm)
1052
+ 6. **Instant Swarm™** - Parallel redlining across all sections (optional)
1053
+ 7. **Generating Email** - Drafting negotiation email with redline summary (optional)
1054
+ 8. **Synthesizing Results** - Generating final recommendations and scores
1055
+
1056
+ ## Quick Start
1057
+
1058
+ ### For Claude Desktop (MCP Protocol)
1059
+
1060
+ Add to your Claude Desktop configuration (\`~/Library/Application Support/Claude/claude_desktop_config.json\`):
1061
+
1062
+ \`\`\`json
1063
+ {
1064
+ "mcpServers": {
1065
+ "bitsbound": {
1066
+ "command": "npx",
1067
+ "args": ["-y", "@bitsbound/mcp-server"],
1068
+ "env": {
1069
+ "BITSBOUND_API_KEY": "sk_live_your_api_key_here"
1070
+ }
1071
+ }
1072
+ }
1073
+ }
1074
+ \`\`\`
1075
+
1076
+ ### For ChatGPT (Custom GPT Actions)
1077
+
1078
+ 1. Create a new Custom GPT at https://chat.openai.com/gpts/editor
1079
+ 2. Go to "Configure" → "Create new action"
1080
+ 3. Import OpenAPI schema from: \`https://bitsbound-saas-backend-mxb1.onrender.com/api/v1/mcp/openapi.json\`
1081
+ 4. Set Authentication: API Key, Header name: \`x-api-key\`
1082
+ 5. Enter your BitsBound API key
1083
+
1084
+ ### For Other AI Platforms (REST API)
1085
+
1086
+ Use the REST API directly with your API key:
1087
+
1088
+ \`\`\`bash
1089
+ curl -X POST https://bitsbound-saas-backend-mxb1.onrender.com/api/v1/mcp/analyze \\
1090
+ -H "Content-Type: application/json" \\
1091
+ -H "x-api-key: sk_live_your_api_key_here" \\
1092
+ -d '{
1093
+ "contract_content": "<base64-encoded-docx>",
1094
+ "filename": "master-service-agreement.docx",
1095
+ "analysis_type": "full"
1096
+ }'
1097
+ \`\`\`
1098
+
1099
+ ## Getting Your API Key
1100
+
1101
+ 1. Sign up at https://account.bitsbound.com
1102
+ 2. Subscribe to a plan (Starter: $25/mo, Professional: $125/mo, Team: $625/mo)
1103
+ 3. Navigate to API Keys section
1104
+ 4. Generate a new API key (format: \`sk_live_xxxxx\`)
1105
+
1106
+ ## Available Tools
1107
+
1108
+ ### process_contract
1109
+ Upload a contract (DOCX format, base64 encoded) for full 8-stage pipeline processing.
1110
+
1111
+ **Parameters:**
1112
+ - \`docxBase64\` (required): Base64-encoded DOCX file
1113
+ - \`fileName\` (required): Original filename
1114
+ - \`analysisDepth\`: 'quick' (~5 min), 'standard' (~15 min), 'deep' (~30 min)
1115
+ - \`perspective\`: 'customer', 'vendor', or 'neutral'
1116
+
1117
+ **Returns:** Analysis ID for tracking progress
1118
+
1119
+ ### get_analysis_status
1120
+ Check the status of a running or completed analysis.
1121
+
1122
+ **Parameters:**
1123
+ - \`analysisId\` (required): The analysis ID from process_contract
1124
+
1125
+ **Returns:** Progress percentage, current phase, results when complete
1126
+
1127
+ ### ask_sac
1128
+ Ask the Supreme AI Co-Counsel questions about an analyzed contract.
1129
+
1130
+ **Parameters:**
1131
+ - \`analysisId\` (required): Analysis ID of a completed analysis
1132
+ - \`question\` (required): Your question about the contract
1133
+ - \`includeClauseCitations\`: Include specific clause citations (default: true)
1134
+
1135
+ **Returns:** AI response with clause citations and follow-up suggestions
1136
+
1137
+ ### generate_redline
1138
+ Generate a redlined Word document with real OOXML Track Changes.
1139
+
1140
+ **Parameters:**
1141
+ - \`analysisId\` (required): Analysis ID of a completed analysis
1142
+ - \`aggressiveness\`: 1-5 (1=conservative, 5=aggressive)
1143
+ - \`includeComments\`: Include rationale comments (default: true)
1144
+
1145
+ **Returns:** Base64-encoded redlined DOCX with download URL
1146
+
1147
+ ### generate_negotiation_email
1148
+ Generate a professional negotiation email to send to counterparty.
1149
+
1150
+ **Parameters:**
1151
+ - \`analysisId\` (required): Analysis ID of a completed analysis
1152
+ - \`tone\`: 'collaborative', 'firm', or 'aggressive'
1153
+ - \`recipientRole\`: Role of the recipient (e.g., "General Counsel")
1154
+
1155
+ **Returns:** Subject line, email body, and key points
1156
+
1157
+ ### extract_clause
1158
+ Extract and analyze a specific clause type from an analyzed contract.
1159
+
1160
+ **Parameters:**
1161
+ - \`analysisId\` (required): Analysis ID of a completed analysis
1162
+ - \`clauseType\` (required): One of: 'indemnification', 'liability', 'ip', 'termination',
1163
+ 'payment', 'confidentiality', 'data_privacy', 'sla', 'force_majeure', 'assignment'
1164
+
1165
+ **Returns:** Clause text, risk level, analysis, suggested improvements
1166
+
1167
+ ### compare_playbook
1168
+ Compare an analyzed contract against a company playbook.
1169
+
1170
+ **Parameters:**
1171
+ - \`analysisId\` (required): Analysis ID of a completed analysis
1172
+ - \`playbookId\` (required): ID of the playbook to compare against
1173
+
1174
+ **Returns:** Deviations, compliance score, required approvals
1175
+
1176
+ ## Example Workflow
1177
+
1178
+ \`\`\`
1179
+ User: "Analyze this Master Service Agreement and tell me the key risks"
1180
+
1181
+ Claude/ChatGPT:
1182
+ 1. Calls process_contract with the uploaded DOCX (with Instant Swarm + Email enabled)
1183
+ 2. Polls get_analysis_status to watch progress through 8 stages:
1184
+ - Loading Context → Extracting Data → Identifying Parties → Researching
1185
+ - AI Analysis → Instant Swarm™ → Generating Email → Synthesizing Results
1186
+ 3. Reads results showing favorability score (e.g., 42% - Vendor Favorable)
1187
+ 4. Identifies top risks: unlimited liability, broad IP assignment, weak SLA
1188
+ 5. User can ask follow-up questions via ask_sac (SAC has full contract context)
1189
+ 6. Downloads the redlined DOCX with real Track Changes (from Instant Swarm™)
1190
+ 7. Reviews the auto-generated negotiation email (from Email Generator)
1191
+ \`\`\`
1192
+
1193
+ ## Environment Variables
1194
+
1195
+ | Variable | Required | Description |
1196
+ |----------|----------|-------------|
1197
+ | BITSBOUND_API_KEY | Yes | Your API key (sk_live_xxxxx) |
1198
+ | BITSBOUND_API_URL | No | API URL (default: production server) |
1199
+
1200
+ ## API Endpoints (REST)
1201
+
1202
+ All endpoints require \`x-api-key\` header or \`Authorization: Bearer <key>\` header.
1203
+
1204
+ | Method | Endpoint | Description |
1205
+ |--------|----------|-------------|
1206
+ | POST | /api/v1/mcp/analyze | Start contract analysis |
1207
+ | GET | /api/v1/mcp/analysis/:id/status | Get analysis status |
1208
+ | GET | /api/v1/mcp/analysis/:id/full | Get full analysis results |
1209
+ | POST | /api/v1/mcp/sac/chat | Ask SAC questions |
1210
+ | POST | /api/v1/mcp/redline/generate | Generate redlined DOCX |
1211
+ | POST | /api/v1/mcp/email/generate | Generate negotiation email |
1212
+ | GET | /api/v1/mcp/analysis/:id/clause/:type | Extract specific clause |
1213
+ | POST | /api/v1/mcp/playbook/compare | Compare against playbook |
1214
+ | GET | /api/v1/mcp/playbook/:id | Get playbook details |
1215
+ | GET | /api/v1/mcp/playbooks | List available playbooks |
1216
+ | GET | /api/v1/mcp/openapi.json | OpenAPI specification (public) |
1217
+
1218
+ ## Pricing
1219
+
1220
+ BitsBound uses token-based pricing. Analysis costs vary by depth:
1221
+ - Quick analysis: ~100K tokens (~$2.50)
1222
+ - Standard analysis: ~500K tokens (~$12.50)
1223
+ - Deep analysis: ~1M tokens (~$25.00)
1224
+
1225
+ Subscription tiers include monthly token allocations:
1226
+ - Starter ($25/mo): 1M tokens
1227
+ - Professional ($125/mo): 5M tokens
1228
+ - Team ($625/mo): 25M tokens
1229
+ - Enterprise ($3,750/mo): 150M tokens
1230
+
1231
+ ## Legal Disclaimer
1232
+
1233
+ BitsBound provides AI-assisted contract analysis tools for legal professionals. All outputs are
1234
+ preliminary drafts requiring attorney review and do not constitute legal advice. BitsBound is
1235
+ not a law firm and does not provide legal advice.
1236
+
1237
+ ## Support
1238
+
1239
+ - Website: https://bitsbound.com
1240
+ - Documentation: https://bitsbound.com/docs
1241
+ - API Keys: https://account.bitsbound.com/api-keys
1242
+ - Support: support@bitsbound.com
1243
+
1244
+ ## License
1245
+
1246
+ MIT License - see package.json for details.
1247
+
1248
+ ---
1249
+
1250
+ Built by Rob Taylor, Esq. - Corporate attorney and full-stack AI engineer.
1251
+ `;
1252
+ /**
1253
+ * Returns the README documentation for display or export.
1254
+ */
1255
+ export function getReadmeDocumentation() {
1256
+ return README_DOCUMENTATION;
1257
+ }
1258
+ /*
1259
+ ######################################################################################################################################################################################################
1260
+ */
1261
+ // #### LOCAL 'R_DVT_L', i.e. FUNCTION/PROVISION LEVEL DVTs
1262
+ /*
1263
+ ######################################################################################################################################################################################################
1264
+ */
1265
+ // No local types needed - all types are global for MCP protocol
1266
+ //# sourceMappingURL=Bitsbound_Kings_McpServer_Backend_Types.js.map