@bitsbound/mcp-server 1.0.14 → 1.2.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.
@@ -3,130 +3,97 @@
3
3
  ////////////////////////////////////////
4
4
  // NO NEW FILES!!!!!!!!!
5
5
  ////////////////////////////////////////
6
- export const DEFAULT_API_URL = 'https://bitsbound-saas-backend-mxb1.onrender.com';
6
+ export const DEFAULT_API_URL = 'https://bitsbound-contract-backend.onrender.com';
7
7
  // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
8
8
  // MCP Tool Definitions 'R_DVT_G_D_ToolDefs' - Tool schemas for MCP protocol
9
9
  // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
10
10
  export const TOOL_DEFINITIONS = {
11
- process_contract: {
12
- name: 'process_contract',
13
- description: `Process a contract through the full 8-stage BitsBound pipeline.
14
-
15
- ⚠️ BEFORE CALLING THIS TOOL: You MUST gather the following information from the user:
11
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
12
+ // CORE TOOLS - 4-tool interface for Claude Code Plugin Marketplace
13
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
14
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
15
+ // REDLINE MODE: Attack existing counterparty contract with parallel SAC agents
16
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
17
+ redline_swarm: {
18
+ name: 'redline_swarm',
19
+ description: `**REDLINE MODE** - Attack counterparty's contract with parallel AI agents.
16
20
 
17
- **REQUIRED - Ask the user:**
18
- 1. representingParty: "Are you representing the Customer (buyer) or Vendor (seller)?"
19
- 2. aggressivenessLevel: "On a scale of 1-10, how aggressive should the redlines be? (1=very conciliatory, 5=balanced, 10=very aggressive)"
21
+ Upload a DOCX contract and BitsBound's Instant Swarm™ deploys parallel SAC (Supreme AI Co-Counsel) agents to analyze and redline every section simultaneously. Returns partner-level redlined DOCX with real OOXML Track Changes (w:ins/w:del), negotiation email, and risk analysis.
20
22
 
21
- **RECOMMENDED - Ask if not obvious:**
22
- 3. paperOwnership: "Did the counterparty draft this contract (their paper) or did you draft it (our paper)?"
23
- 4. dealValue + dealValueCurrency: "What's the estimated deal value?"
24
- 5. industry: "What industry is this contract for?"
25
- 6. additionalContext: "Any special context about this deal or relationship I should know?"
23
+ **REQUIRED INPUTS (ask the user):**
24
+ 1. File path to the counterparty's DOCX contract
25
+ 2. Contract type: saas, ma, vc, employment, nda, equipment, commercial-lease, professional-services, or miscellaneous
26
+ 3. Who you represent: customer/vendor (saas), buyer/seller (ma), investor/founder (vc), etc.
27
+ 4. Aggressiveness level: 1-10 (1=conciliatory, 5=balanced, 10=aggressive)
26
28
 
27
- **FOR EMAIL GENERATION - Ask:**
28
- 7. emailRecipient: "Should I generate a negotiation email to send to the counterparty?"
29
- 8. If yes: recipientName, senderName (your name), any additionalContext for the email tone
29
+ **OPTIONAL:** dealValue, additionalContext, emailRecipient info
30
30
 
31
- After gathering this context, call the tool. The response includes "importantNote" with when to check back (~45 min).
31
+ **DELIVERABLES:**
32
+ • Redlined DOCX with real Track Changes (not markup - actual w:ins/w:del)
33
+ • Negotiation email explaining each requested change
34
+ • Favorability score and risk analysis
32
35
 
33
- Pipeline: (1) Context Loading, (2) Data Extraction, (3) Party Identification, (4) Research, (5) AI Analysis with 18+ analyzers, (6) Instant Swarm™ redlining, (7) Email Generation, (8) Synthesis.`,
36
+ Analysis takes ~25-35 minutes. Response includes 'checkBackTime' for when to check status.`,
34
37
  inputSchema: {
35
38
  type: 'object',
36
39
  properties: {
37
- // ══════════════════════════════════════════════════════════════════════
38
- // FILE INPUT (one required)
39
- // ══════════════════════════════════════════════════════════════════════
40
40
  filePath: {
41
41
  type: 'string',
42
- description: 'RECOMMENDED: Absolute path to the DOCX file on disk (e.g., "/Users/john/Documents/contract.docx"). The server will read and encode the file automatically.'
42
+ description: 'RECOMMENDED: Absolute path to DOCX file (e.g., "/Users/john/Documents/contract.docx"). Server reads file directly.'
43
43
  },
44
44
  docxBase64: {
45
45
  type: 'string',
46
- description: 'Alternative: The contract document already encoded as base64 string (DOCX format). Use filePath instead if possible.'
46
+ description: 'Alternative: Base64-encoded DOCX content. Use filePath instead when possible.'
47
47
  },
48
48
  fileName: {
49
49
  type: 'string',
50
- description: 'Original filename of the document. If using filePath, this is extracted automatically.'
50
+ description: 'Original filename. Auto-extracted if using filePath.'
51
+ },
52
+ contractVertical: {
53
+ type: 'string',
54
+ enum: ['saas', 'ma', 'vc', 'employment', 'nda', 'equipment-lease', 'equipment-financing', 'security-agreement', 'loan', 'commercial-lease', 'professional-services', 'miscellaneous'],
55
+ description: 'Contract type. Determines analyzers and party options.'
51
56
  },
52
- // ══════════════════════════════════════════════════════════════════════
53
- // DEAL CONTEXT (ask user for these!)
54
- // ══════════════════════════════════════════════════════════════════════
55
57
  representingParty: {
56
58
  type: 'string',
57
- enum: ['customer', 'vendor', 'neutral'],
58
- description: 'REQUIRED: Who are you representing? customer=buyer, vendor=seller, neutral=balanced review'
59
+ description: 'Who you represent: saas(customer/vendor), ma(buyer/seller), vc(investor/founder), employment(employer/employee), nda(disclosing-party/receiving-party), equipment-lease(lessee/lessor), equipment-financing(debtor/secured-party), security-agreement(debtor/secured-party), commercial-lease(tenant/landlord), professional-services(client/service-provider), loan(borrower/lender)'
60
+ },
61
+ aggressivenessLevel: {
62
+ type: 'number',
63
+ minimum: 1,
64
+ maximum: 10,
65
+ description: 'Redline aggressiveness 1-10. Default: 5'
59
66
  },
60
67
  dealValue: {
61
68
  type: 'number',
62
- description: 'Estimated deal value / annual contract value (ACV). Helps calibrate risk thresholds.'
69
+ description: 'Optional: Deal value for risk calibration'
63
70
  },
64
71
  dealValueCurrency: {
65
72
  type: 'string',
66
73
  enum: ['USD', 'EUR', 'GBP', 'CAD', 'AUD'],
67
- description: 'Currency for deal value. Default: USD'
68
- },
69
- industry: {
70
- type: 'string',
71
- enum: ['technology', 'healthcare', 'financial', 'retail', 'manufacturing', 'professional', 'media', 'education', 'government', 'other'],
72
- description: 'Industry context for analysis. Affects regulatory considerations and benchmarks.'
74
+ description: 'Currency. Default: USD'
73
75
  },
74
76
  additionalContext: {
75
77
  type: 'string',
76
- description: 'Free-form context about the deal: relationship history, priorities, concerns, red lines, etc.'
78
+ description: 'Optional: Deal context, priorities, relationship notes'
77
79
  },
78
80
  paperOwnership: {
79
81
  type: 'string',
80
82
  enum: ['their-paper', 'our-paper'],
81
- description: 'Who drafted the contract? their-paper=counterparty drafted (default, full analysis), our-paper=we drafted (review their markup only)'
83
+ description: 'Who drafted? their-paper=counterparty (default), our-paper=we drafted'
82
84
  },
83
- // ══════════════════════════════════════════════════════════════════════
84
- // SAC/REDLINE SETTINGS
85
- // ══════════════════════════════════════════════════════════════════════
86
- aggressivenessLevel: {
87
- type: 'number',
88
- minimum: 1,
89
- maximum: 10,
90
- description: 'IMPORTANT: Redline aggressiveness 1-10. 1=very conciliatory (accept most terms), 5=balanced (default), 10=very aggressive (push hard on everything)'
91
- },
92
- enableAutoSwarm: {
93
- type: 'boolean',
94
- description: 'Enable parallel 17-section SAC analysis for comprehensive redlines. Default: true'
95
- },
96
- analysisDepth: {
97
- type: 'string',
98
- enum: ['quick', 'standard', 'deep'],
99
- description: 'Analysis depth: quick (~10 min), standard (~30 min), deep (~45 min). Default: standard'
100
- },
101
- // ══════════════════════════════════════════════════════════════════════
102
- // EMAIL GENERATION
103
- // ══════════════════════════════════════════════════════════════════════
104
85
  enableEmailGenerator: {
105
86
  type: 'boolean',
106
- description: 'Generate a negotiation email summarizing redlines? Default: true'
107
- },
108
- emailRecipient: {
109
- type: 'string',
110
- enum: ['client', 'counterparty', 'none'],
111
- description: 'Who should the email be addressed to? counterparty=send to other side, client=internal summary, none=skip email'
87
+ description: 'Generate negotiation email? Default: true'
112
88
  },
113
89
  emailContext: {
114
90
  type: 'object',
115
- description: 'Additional context for email generation',
91
+ description: 'Email context',
116
92
  properties: {
117
- recipientName: { type: 'string', description: 'Name of email recipient (e.g., "John Smith")' },
118
- recipientEmail: { type: 'string', description: 'Email address of recipient' },
119
- senderName: { type: 'string', description: 'Your name (the sender)' },
120
- additionalContext: { type: 'string', description: 'Tone/relationship notes for the email (e.g., "We have a good relationship with this vendor")' }
93
+ recipientName: { type: 'string' },
94
+ senderName: { type: 'string' },
95
+ additionalContext: { type: 'string' }
121
96
  }
122
- },
123
- // ══════════════════════════════════════════════════════════════════════
124
- // DEPRECATED (use representingParty instead)
125
- // ══════════════════════════════════════════════════════════════════════
126
- perspective: {
127
- type: 'string',
128
- enum: ['customer', 'vendor', 'neutral'],
129
- description: 'DEPRECATED: Use representingParty instead'
130
97
  }
131
98
  },
132
99
  required: []
@@ -136,260 +103,115 @@ Pipeline: (1) Context Loading, (2) Data Extraction, (3) Party Identification, (4
136
103
  destructiveHint: false
137
104
  }
138
105
  },
139
- get_analysis_status: {
140
- name: 'get_analysis_status',
141
- 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). When complete, returns deliverables with CLICKABLE BROWSER LINKS: (1) redlinedDocxUrl - presigned URL to download the redlined DOCX (works directly in browser, valid 1 hour), (2) negotiationEmailUrl - URL to view the negotiation email in browser. ALWAYS display both URLs to the user as clickable links.',
106
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
107
+ // DRAFT MODE: Generate contract from scratch with multi-pass AI refinement
108
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
109
+ power_draft: {
110
+ name: 'power_draft',
111
+ description: `**DRAFT MODE** - Generate a complete contract from scratch.
112
+
113
+ NO FILE UPLOAD NEEDED. Provide deal context and BitsBound generates a partner-level contract using a multi-pass architecture:
114
+ 1. Opus 4.5 generates initial draft based on your requirements
115
+ 2. 16+ parallel analyzers critique the draft
116
+ 3. Sonnet 4.5 synthesizes analyzer feedback
117
+ 4. Opus 4.5 generates refined second draft
118
+ 5. Final QB Enhancer pass for consistency
119
+
120
+ **REQUIRED INPUTS (ask the user):**
121
+ 1. Contract type: saas, ma, vc, employment, nda, equipment-lease, commercial-lease, professional-services
122
+ 2. Who you represent: customer/vendor (saas), buyer/seller (ma), investor/founder (vc), etc.
123
+ 3. Terms Favorability: 1-10 (1=minimal protections/fast close, 5=balanced, 10=maximum protections/bulletproof)
124
+
125
+ **RECOMMENDED:** Additional context describing the deal (value, term, key requirements, counterparty info)
126
+
127
+ **DELIVERABLES:**
128
+ • Clean DOCX ready for negotiation (no Track Changes needed - it's your paper)
129
+ • Cover email introducing the draft (optional)
130
+ • Risk analysis of your own positions
131
+
132
+ Draft generation takes ~30-40 minutes. Response includes 'checkBackTime' for when to check status.`,
142
133
  inputSchema: {
143
134
  type: 'object',
144
135
  properties: {
145
- analysisId: {
136
+ // ════════════════════════════════════════════════════════════════════════════
137
+ // REQUIRED - Core Draft Parameters (matches UI)
138
+ // ════════════════════════════════════════════════════════════════════════════
139
+ contractVertical: {
146
140
  type: 'string',
147
- description: 'The processing ID returned from process_contract'
148
- }
149
- },
150
- required: ['analysisId']
151
- },
152
- annotations: {
153
- readOnlyHint: true
154
- }
155
- },
156
- ask_sac: {
157
- name: 'ask_sac',
158
- 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.',
159
- inputSchema: {
160
- type: 'object',
161
- properties: {
162
- analysisId: {
163
- type: 'string',
164
- description: 'The analysis ID of a completed analysis'
165
- },
166
- question: {
167
- type: 'string',
168
- description: 'Your question about the contract'
141
+ enum: ['saas', 'ma', 'vc', 'employment', 'nda', 'equipment-lease', 'equipment-financing', 'security-agreement', 'loan', 'commercial-lease', 'professional-services'],
142
+ description: 'Contract type to generate. REQUIRED.'
169
143
  },
170
- includeClauseCitations: {
171
- type: 'boolean',
172
- description: 'Include specific clause citations in the response. Default: true'
173
- }
174
- },
175
- required: ['analysisId', 'question']
176
- },
177
- annotations: {
178
- readOnlyHint: true
179
- }
180
- },
181
- generate_redline: {
182
- name: 'generate_redline',
183
- 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.',
184
- inputSchema: {
185
- type: 'object',
186
- properties: {
187
- analysisId: {
144
+ representingParty: {
188
145
  type: 'string',
189
- description: 'The analysis ID of a completed analysis'
146
+ description: 'Who you represent (sets protective posture). REQUIRED. Options by vertical: saas(customer/vendor), ma(buyer/seller), vc(investor/founder), employment(employer/employee), nda(disclosing-party/receiving-party), equipment-lease(lessee/lessor), commercial-lease(tenant/landlord), professional-services(client/service-provider)'
190
147
  },
191
- aggressiveness: {
148
+ aggressivenessLevel: {
192
149
  type: 'number',
193
- enum: [1, 2, 3, 4, 5],
194
- description: 'How aggressive the redlines should be (1=conservative, 5=aggressive). Default: 3'
195
- },
196
- includeComments: {
197
- type: 'boolean',
198
- description: 'Include rationale comments in Word margins. Default: true'
199
- }
200
- },
201
- required: ['analysisId']
202
- },
203
- annotations: {
204
- readOnlyHint: false,
205
- destructiveHint: false
206
- }
207
- },
208
- generate_negotiation_email: {
209
- name: 'generate_negotiation_email',
210
- description: 'Generate a professional negotiation email to send to the counterparty, explaining requested changes and their rationale.',
211
- inputSchema: {
212
- type: 'object',
213
- properties: {
214
- analysisId: {
215
- type: 'string',
216
- description: 'The analysis ID of a completed analysis'
150
+ minimum: 1,
151
+ maximum: 10,
152
+ description: 'Terms Favorability 1-10: How protective for YOUR party. 1=minimal protections (fast close), 5=balanced (default), 10=maximum protections (bulletproof). REQUIRED.'
217
153
  },
218
- tone: {
219
- type: 'string',
220
- enum: ['collaborative', 'firm', 'aggressive'],
221
- description: 'Tone of the email. Default: collaborative'
154
+ // ════════════════════════════════════════════════════════════════════════════
155
+ // OPTIONAL - Deal Context (highly recommended for better output)
156
+ // ════════════════════════════════════════════════════════════════════════════
157
+ dealValue: {
158
+ type: 'number',
159
+ description: 'Annual Contract Value for risk calibration. Optional but recommended.'
222
160
  },
223
- recipientRole: {
224
- type: 'string',
225
- description: 'Role of the recipient (e.g., "General Counsel", "Sales Rep", "Procurement"). Helps tailor the message.'
226
- }
227
- },
228
- required: ['analysisId']
229
- },
230
- annotations: {
231
- readOnlyHint: false,
232
- destructiveHint: false
233
- }
234
- },
235
- extract_clause: {
236
- name: 'extract_clause',
237
- description: 'Extract and analyze a specific clause type from an analyzed contract. Returns the clause text, risk analysis, and suggested improvements.',
238
- inputSchema: {
239
- type: 'object',
240
- properties: {
241
- analysisId: {
161
+ dealValueCurrency: {
242
162
  type: 'string',
243
- description: 'The analysis ID of a completed analysis'
163
+ enum: ['USD', 'EUR', 'GBP', 'CAD', 'AUD'],
164
+ description: 'Currency for deal value. Default: USD'
244
165
  },
245
- clauseType: {
246
- type: 'string',
247
- enum: ['indemnification', 'liability', 'ip', 'termination', 'payment', 'confidentiality', 'data_privacy', 'sla', 'force_majeure', 'assignment'],
248
- description: 'The type of clause to extract'
249
- }
250
- },
251
- required: ['analysisId', 'clauseType']
252
- },
253
- annotations: {
254
- readOnlyHint: true
255
- }
256
- },
257
- compare_playbook: {
258
- name: 'compare_playbook',
259
- description: 'Compare an analyzed contract against a company playbook to identify deviations from pre-approved positions and required approvals.',
260
- inputSchema: {
261
- type: 'object',
262
- properties: {
263
- analysisId: {
166
+ additionalContext: {
264
167
  type: 'string',
265
- description: 'The analysis ID of a completed analysis'
168
+ description: 'HIGHLY RECOMMENDED: Deal context for better AI drafting. Include: party names, deal value, term length, key requirements, counterparty info, risk factors, special provisions needed. Example: "Deal value: $500K/year, 3-year term. We need strong IP protections. Counterparty is a startup, so we want robust termination rights. Key contact: John Smith, CEO..."'
266
169
  },
170
+ // ════════════════════════════════════════════════════════════════════════════
171
+ // OPTIONAL - Playbook & Email Settings
172
+ // ════════════════════════════════════════════════════════════════════════════
267
173
  playbookId: {
268
174
  type: 'string',
269
- description: 'The ID of the playbook to compare against'
270
- }
271
- },
272
- required: ['analysisId', 'playbookId']
273
- },
274
- annotations: {
275
- readOnlyHint: true
276
- }
277
- },
278
- // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
279
- // INSTANT SWARM - Parallel N-Section Redlining (spawns N agents for N sections, max parallelization)
280
- // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
281
- instant_swarm: {
282
- name: 'instant_swarm',
283
- 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.',
284
- inputSchema: {
285
- type: 'object',
286
- properties: {
287
- analysisId: {
288
- type: 'string',
289
- description: 'The analysis ID from a completed process_contract call. The analysis provides contract context for each section.'
290
- },
291
- aggressivenessLevel: {
292
- type: 'number',
293
- enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
294
- description: 'How aggressive the redlines should be (1=conservative, 10=very aggressive). Recommended: 5-7 for balanced approach.'
175
+ description: 'Playbook ID for firm-specific rules. Optional - uses BitsBound Foundational (117 rules) by default.'
295
176
  },
296
- partyPosition: {
297
- type: 'string',
298
- enum: ['customer', 'vendor'],
299
- description: 'Which side are you on? "customer" = you are buying/receiving services. "vendor" = you are selling/providing services.'
300
- },
301
- ourPartyName: {
302
- type: 'string',
303
- description: 'Your company name as it should appear in redlines (e.g., "Acme Corp").'
304
- },
305
- counterpartyName: {
306
- type: 'string',
307
- description: 'The other party\'s name (e.g., "Vendor Inc").'
177
+ enableEmailGenerator: {
178
+ type: 'boolean',
179
+ description: 'Generate cover email introducing the draft? Default: true'
308
180
  },
309
- targetSections: {
310
- type: 'array',
311
- items: { type: 'string' },
312
- 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'
181
+ emailContext: {
182
+ type: 'object',
183
+ description: 'Cover email context',
184
+ properties: {
185
+ recipientName: { type: 'string', description: 'Name of email recipient' },
186
+ senderName: { type: 'string', description: 'Your name (the sender)' },
187
+ additionalContext: { type: 'string', description: 'Tone, relationship notes, etc.' }
188
+ }
313
189
  }
314
190
  },
315
- required: ['analysisId', 'aggressivenessLevel', 'partyPosition']
191
+ required: ['contractVertical', 'representingParty', 'aggressivenessLevel']
316
192
  },
317
193
  annotations: {
318
194
  readOnlyHint: false,
319
195
  destructiveHint: false
320
196
  }
321
197
  },
322
- // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
323
- // QUICK TOOLS - Immediate analysis without waiting for full pipeline
324
- // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
325
- quick_scan: {
326
- name: 'quick_scan',
327
- 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.',
328
- inputSchema: {
329
- type: 'object',
330
- properties: {
331
- contractText: {
332
- type: 'string',
333
- description: 'The contract text (plain text or base64-encoded DOCX). For DOCX files, base64 encode the file contents.'
334
- },
335
- fileName: {
336
- type: 'string',
337
- description: 'Optional filename for context (e.g., "Acme_MSA_2024.docx")'
338
- },
339
- perspective: {
340
- type: 'string',
341
- enum: ['customer', 'vendor', 'neutral'],
342
- description: 'Analyze from customer (buyer), vendor (seller), or neutral perspective. Default: customer'
343
- }
344
- },
345
- required: ['contractText']
346
- },
347
- annotations: {
348
- readOnlyHint: true
349
- }
350
- },
351
- ask_clause: {
352
- name: 'ask_clause',
353
- 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?"',
354
- inputSchema: {
355
- type: 'object',
356
- properties: {
357
- contractText: {
358
- type: 'string',
359
- description: 'The contract text (plain text or base64-encoded DOCX)'
360
- },
361
- question: {
362
- type: 'string',
363
- description: 'Your question about the contract (e.g., "What is the liability cap?", "Is there an auto-renewal clause?")'
364
- },
365
- clauseType: {
366
- type: 'string',
367
- enum: ['indemnification', 'liability', 'ip', 'termination', 'payment', 'confidentiality', 'data_privacy', 'sla', 'force_majeure', 'assignment', 'any'],
368
- description: 'Optional: Focus on a specific clause type, or "any" to search the whole contract. Default: any'
369
- }
370
- },
371
- required: ['contractText', 'question']
372
- },
373
- annotations: {
374
- readOnlyHint: true
375
- }
376
- },
377
- check_dealbreakers: {
378
- name: 'check_dealbreakers',
379
- 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.',
198
+ get_analysis_status: {
199
+ name: 'get_analysis_status',
200
+ description: `Check analysis progress. When complete, returns:
201
+ - redlinedDocxDownloadUrl: Presigned URL to download redlined DOCX (valid 1 hour)
202
+ - negotiationEmailHtml/PlainText: Ready-to-send negotiation email
203
+ - favorabilityScore, topRisks, negotiationPriorities
204
+
205
+ ALWAYS display download URLs as clickable links when analysis completes.`,
380
206
  inputSchema: {
381
207
  type: 'object',
382
208
  properties: {
383
- contractText: {
384
- type: 'string',
385
- description: 'The contract text (plain text or base64-encoded DOCX)'
386
- },
387
- playbookId: {
209
+ analysisId: {
388
210
  type: 'string',
389
- description: 'Optional: Specific playbook to check against. If not provided, uses your default company playbook.'
211
+ description: 'Analysis ID from redline_swarm or power_draft'
390
212
  }
391
213
  },
392
- required: ['contractText']
214
+ required: ['analysisId']
393
215
  },
394
216
  annotations: {
395
217
  readOnlyHint: true
@@ -397,17 +219,17 @@ Pipeline: (1) Context Loading, (2) Data Extraction, (3) Party Identification, (4
397
219
  },
398
220
  download_file: {
399
221
  name: 'download_file',
400
- description: 'Download a file from BitsBound (e.g., the redlined DOCX with Track Changes). Returns the file as base64-encoded content that can be saved locally. The downloadUrl is provided by get_analysis_status when analysis is complete.',
222
+ description: 'Download a file from BitsBound (redlined DOCX, analysis JSON). Returns base64 content or saves to local path.',
401
223
  inputSchema: {
402
224
  type: 'object',
403
225
  properties: {
404
226
  downloadUrl: {
405
227
  type: 'string',
406
- description: 'The download URL from get_analysis_status deliverables (redlinedDocxDownloadUrl)'
228
+ description: 'Download URL from get_analysis_status deliverables'
407
229
  },
408
230
  saveToPath: {
409
231
  type: 'string',
410
- description: 'Optional: Local file path to save the downloaded file. If not provided, returns base64 content.'
232
+ description: 'Optional: Local path to save file. If omitted, returns base64.'
411
233
  }
412
234
  },
413
235
  required: ['downloadUrl']
@@ -424,7 +246,7 @@ export const RESOURCE_DEFINITIONS = {
424
246
  analysis: {
425
247
  uriTemplate: 'bitsbound://analysis/{analysisId}',
426
248
  name: 'Contract Analysis',
427
- description: 'Full analysis results including all 17 analyzer outputs, risk scores, and recommendations',
249
+ description: 'Full analysis results including all analyzer outputs (varies by contract type), risk scores, and recommendations',
428
250
  mimeType: 'application/json'
429
251
  },
430
252
  playbook: {
@@ -454,33 +276,26 @@ export const RESOURCE_DEFINITIONS = {
454
276
  * - O: User experiences a smooth, guided contract analysis flow
455
277
  */
456
278
  export const PROMPT_DEFINITIONS = {
457
- process_contract: {
458
- name: 'process_contract',
459
- description: '📄 Process Contract - Upload a DOCX and get partner-level redlines with Track Changes, risk analysis, and a negotiation email',
460
- arguments: []
461
- },
462
- quick_scan: {
463
- name: 'quick_scan',
464
- description: '⚡ Quick Risk Scan - Get instant risk assessment in 5-10 seconds without waiting for full analysis',
465
- arguments: []
466
- },
467
- ask_about_contract: {
468
- name: 'ask_about_contract',
469
- description: '💬 Ask About a Clause - Upload a contract and ask specific questions about any clause or term',
279
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
280
+ // CORE PROMPTS - 3-prompt interface matching 4-tool architecture
281
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
282
+ redline_swarm: {
283
+ name: 'redline_swarm',
284
+ description: 'Redline Mode - Upload counterparty\'s DOCX and get partner-level redlines with real Track Changes, risk analysis, and negotiation email',
470
285
  arguments: []
471
286
  },
472
- check_dealbreakers: {
473
- name: 'check_dealbreakers',
474
- description: '🚨 Check Dealbreakers - Quick pass/fail check against your playbook rules',
287
+ power_draft: {
288
+ name: 'power_draft',
289
+ description: 'Draft Mode - Generate a complete contract from scratch with multi-pass AI refinement (Opus 4.5 drafts → Analyzers critique → Opus 4.5 refines)',
475
290
  arguments: []
476
291
  },
477
- continue_analysis: {
478
- name: 'continue_analysis',
479
- description: '📊 Continue Previous Analysis - Resume working with a previously analyzed contract',
292
+ check_analysis: {
293
+ name: 'check_analysis',
294
+ description: 'Check Analysis Status - Check progress or download results from a running/completed redline or draft',
480
295
  arguments: [
481
296
  {
482
297
  name: 'analysisId',
483
- description: 'The analysis ID from a previous contract analysis',
298
+ description: 'The analysis ID from redline_swarm or power_draft',
484
299
  required: true
485
300
  }
486
301
  ]
@@ -492,94 +307,116 @@ export const PROMPT_DEFINITIONS = {
492
307
  * NOTE: MCP spec requires content to be { type: 'text', text: string } not plain string
493
308
  */
494
309
  export const PROMPT_MESSAGES = {
495
- process_contract: [
496
- {
497
- role: 'user',
498
- content: { type: 'text', text: `I want to analyze a contract using BitsBound.
499
-
500
- Please help me by:
501
- 1. Ask me for the contract file. I will provide EITHER:
502
- - A full file path (e.g., /Users/john/Documents/contract.docx)
503
- - An uploaded DOCX file
504
- 2. IMPORTANT FILE PATH HANDLING:
505
- - If I provide a FILE PATH: Pass the path DIRECTLY to the 'process_contract' tool's 'filePath' parameter. Do NOT use copy_file_user_to_claude or any other file operations - the MCP server reads the file directly from the path.
506
- - If I upload a file: Use the base64 content with 'docxBase64' parameter.
507
- 3. CRITICAL: After starting the analysis, DO NOT POLL AUTOMATICALLY. The response will include 'checkBackTime' and 'importantNote' - tell me exactly when to come back and ask you to check the status. I will manually ask you to check when I'm ready.
508
- 4. When I ask you to check status (using 'get_analysis_status'), show me:
509
- - Current progress percentage
510
- - If complete, ALWAYS provide these clickable links (they work directly in browser):
511
- * REDLINED DOCX: Display the 'redlinedDocxUrl' as a clickable download link
512
- * NEGOTIATION EMAIL: Display the 'negotiationEmailUrl' as a clickable link to view in browser
513
- - Also show: favorability score, top 5 risks, negotiation priorities
514
-
515
- The analysis typically takes ~25 minutes. Wait for me to ask you to check - do not poll automatically.` }
516
- }
517
- ],
518
- quick_scan: [
519
- {
520
- role: 'user',
521
- content: { type: 'text', text: `I want a quick risk scan of a contract (5-10 seconds, not the full analysis).
522
-
523
- Please help me by:
524
- 1. Asking me to upload or paste the contract
525
- 2. Use the BitsBound 'quick_scan' tool for instant analysis
526
- 3. Show me:
527
- - Contract type and parties
528
- - Favorability estimate
529
- - Top concerns by severity
530
- - Key terms (liability cap, term, payment, etc.)
531
- - Whether I should do a full analysis
532
-
533
- This is for initial triage - not a substitute for full attorney review.` }
534
- }
535
- ],
536
- ask_about_contract: [
310
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
311
+ // CORE PROMPT MESSAGES - Matches 4-tool architecture (redline_swarm, power_draft, get_analysis_status, download_file)
312
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
313
+ redline_swarm: [
537
314
  {
538
315
  role: 'user',
539
- content: { type: 'text', text: `I want to ask questions about specific clauses in a contract.
316
+ content: { type: 'text', text: `I want to analyze and redline a counterparty's contract using BitsBound's REDLINE MODE.
317
+
318
+ Please help me by gathering this information:
540
319
 
541
- Please help me by:
542
- 1. Asking me to upload or paste the contract (or relevant sections)
543
- 2. Ask what I want to know (e.g., "What is the liability cap?", "Is there an auto-renewal?")
544
- 3. Use the BitsBound 'ask_clause' tool for instant answers
545
- 4. Include the actual clause text and any risk assessment
320
+ 1. CONTRACT FILE:
321
+ - File path (e.g., /Users/john/Documents/contract.docx) - preferred
322
+ - Or upload the DOCX directly
546
323
 
547
- I can ask multiple questions - this is a Q&A session about the contract.` }
324
+ 2. CONTRACT TYPE:
325
+ - saas, ma, vc, employment, nda, equipment, commercial-lease, professional-services, or miscellaneous
326
+
327
+ 3. WHO I REPRESENT:
328
+ - saas: customer or vendor
329
+ - ma: buyer or seller
330
+ - vc: investor or founder
331
+ - employment: employer or employee
332
+ - nda: disclosing-party or receiving-party
333
+ - (etc. based on contract type)
334
+
335
+ 4. AGGRESSIVENESS (1-10):
336
+ - 1 = very conciliatory, 5 = balanced, 10 = very aggressive
337
+
338
+ Then call the 'redline_swarm' tool. Instant Swarm™ deploys parallel AI agents to attack every section.
339
+ Analysis takes ~25-35 minutes. Response includes 'checkBackTime' - tell me when to check back.
340
+ Do NOT poll automatically - wait for me to ask.` }
548
341
  }
549
342
  ],
550
- check_dealbreakers: [
343
+ power_draft: [
551
344
  {
552
345
  role: 'user',
553
- content: { type: 'text', text: `I want to check a contract for dealbreakers against my company's playbook.
554
-
555
- Please help me by:
556
- 1. Asking me to upload or paste the contract
557
- 2. Use the BitsBound 'check_dealbreakers' tool
558
- 3. Show me:
559
- - Pass/fail result
560
- - Any dealbreaker issues found
561
- - Missing required clauses
562
- - Who needs to approve if we proceed
563
-
564
- This is a quick pre-screen before spending time on full analysis.` }
346
+ content: { type: 'text', text: `I want to generate a NEW CONTRACT from scratch using BitsBound's DRAFT MODE.
347
+
348
+ NO FILE UPLOAD NEEDED - just provide deal context.
349
+
350
+ Please help me by gathering this information:
351
+
352
+ **REQUIRED:**
353
+
354
+ 1. CONTRACT TYPE:
355
+ - saas (SaaS/Software Agreement)
356
+ - ma (M&A - APA, SPA, Merger)
357
+ - vc (VC - SAFE, Term Sheet, Series A/B/C)
358
+ - employment (Offer Letter, Employment Agreement)
359
+ - nda (Mutual or Unilateral NDA)
360
+ - equipment-lease (Equipment Lease)
361
+ - commercial-lease (Commercial Real Estate Lease)
362
+ - professional-services (SOW, Consulting Agreement)
363
+
364
+ 2. WHO YOU REPRESENT:
365
+ - saas: customer or vendor
366
+ - ma: buyer or seller
367
+ - vc: investor or founder
368
+ - employment: employer or employee
369
+ - nda: disclosing-party or receiving-party
370
+ - equipment-lease: lessee or lessor
371
+ - commercial-lease: tenant or landlord
372
+ - professional-services: client or service-provider
373
+
374
+ 3. TERMS FAVORABILITY (1-10):
375
+ - 1 = minimal protections (fast close)
376
+ - 5 = balanced (default)
377
+ - 10 = maximum protections (bulletproof)
378
+
379
+ **HIGHLY RECOMMENDED - Additional Context:**
380
+ The more context you provide, the better the AI can tailor the contract:
381
+ - Party names (your company, counterparty)
382
+ - Deal value (e.g., $500K/year)
383
+ - Term length (e.g., 3-year term)
384
+ - Key requirements (e.g., "strong IP protections", "robust termination rights")
385
+ - Counterparty info (e.g., "startup", "Fortune 500")
386
+ - Any special provisions needed
387
+
388
+ **OPTIONAL:**
389
+ - Annual Contract Value (for risk calibration)
390
+ - Generate cover email? (default: yes)
391
+
392
+ Then call the 'power_draft' tool. Multi-pass AI architecture:
393
+ 1. Opus 4.5 generates initial draft
394
+ 2. 16+ parallel analyzers critique the draft
395
+ 3. Sonnet 4.5 synthesizes feedback
396
+ 4. Opus 4.5 generates refined second draft
397
+ 5. QB Enhancer finalizes for consistency
398
+
399
+ Draft generation takes ~30-40 minutes. Response includes 'checkBackTime'.
400
+ Do NOT poll automatically - wait for me to ask.` }
565
401
  }
566
402
  ],
567
- continue_analysis: [
403
+ check_analysis: [
568
404
  {
569
405
  role: 'user',
570
- content: { type: 'text', text: `I want to continue working with a previously analyzed contract.
571
-
572
- I have an analysis ID from a previous BitsBound analysis. Please:
573
- 1. Ask me for the analysis ID
574
- 2. Use 'get_analysis_status' to check if it's complete
575
- 3. If complete, I can:
576
- - Ask questions with 'ask_sac' (SAC has full context)
577
- - Generate a redlined document with 'generate_redline'
578
- - Generate a negotiation email with 'generate_negotiation_email'
579
- - Extract specific clauses with 'extract_clause'
580
- - Compare against a playbook with 'compare_playbook'
581
-
582
- What would you like to do with this analysis?` }
406
+ content: { type: 'text', text: `I want to check on a contract analysis or draft generation.
407
+
408
+ Analysis ID: {analysisId}
409
+
410
+ Please use 'get_analysis_status' and show me:
411
+ - Current progress percentage
412
+ - If complete, provide:
413
+ * CLICKABLE download link for the DOCX (redlined or clean draft)
414
+ * Negotiation/cover email content
415
+ * Favorability score
416
+ * Top risks
417
+ * Negotiation priorities
418
+
419
+ If I need to download the file, use 'download_file' with the URL from the status response.` }
583
420
  }
584
421
  ]
585
422
  };
@@ -613,7 +450,7 @@ export const OPENAPI_SPEC = {
613
450
  },
614
451
  servers: [
615
452
  {
616
- url: 'https://bitsbound-saas-backend-mxb1.onrender.com',
453
+ url: 'https://bitsbound-contract-backend.onrender.com',
617
454
  description: 'Production server'
618
455
  }
619
456
  ],
@@ -1162,7 +999,7 @@ Add to your Claude Desktop configuration (\`~/Library/Application Support/Claude
1162
999
 
1163
1000
  1. Create a new Custom GPT at https://chat.openai.com/gpts/editor
1164
1001
  2. Go to "Configure" → "Create new action"
1165
- 3. Import OpenAPI schema from: \`https://bitsbound-saas-backend-mxb1.onrender.com/api/v1/mcp/openapi.json\`
1002
+ 3. Import OpenAPI schema from: \`https://bitsbound-contract-backend.onrender.com/api/v1/mcp/openapi.json\`
1166
1003
  4. Set Authentication: API Key, Header name: \`x-api-key\`
1167
1004
  5. Enter your BitsBound API key
1168
1005
 
@@ -1171,7 +1008,7 @@ Add to your Claude Desktop configuration (\`~/Library/Application Support/Claude
1171
1008
  Use the REST API directly with your API key:
1172
1009
 
1173
1010
  \`\`\`bash
1174
- curl -X POST https://bitsbound-saas-backend-mxb1.onrender.com/api/v1/mcp/analyze \\
1011
+ curl -X POST https://bitsbound-contract-backend.onrender.com/api/v1/mcp/analyze \\
1175
1012
  -H "Content-Type: application/json" \\
1176
1013
  -H "x-api-key: sk_live_your_api_key_here" \\
1177
1014
  -d '{
@@ -1261,18 +1098,19 @@ Compare an analyzed contract against a company playbook.
1261
1098
  ## Example Workflow
1262
1099
 
1263
1100
  \`\`\`
1264
- User: "Analyze this Master Service Agreement and tell me the key risks"
1101
+ User: "Analyze this contract and tell me the key risks"
1265
1102
 
1266
1103
  Claude/ChatGPT:
1267
- 1. Calls process_contract with the uploaded DOCX (with Instant Swarm + Email enabled)
1268
- 2. Polls get_analysis_status to watch progress through 8 stages:
1104
+ 1. Identifies the contract type (MSA, M&A, VC term sheet, employment, NDA, etc.)
1105
+ 2. Calls process_contract with the uploaded DOCX (with Instant Swarm + Email enabled)
1106
+ 3. Polls get_analysis_status to watch progress through 8 stages:
1269
1107
  - Loading Context → Extracting Data → Identifying Parties → Researching
1270
1108
  - AI Analysis → Instant Swarm™ → Generating Email → Synthesizing Results
1271
- 3. Reads results showing favorability score (e.g., 42% - Vendor Favorable)
1272
- 4. Identifies top risks: unlimited liability, broad IP assignment, weak SLA
1273
- 5. User can ask follow-up questions via ask_sac (SAC has full contract context)
1274
- 6. Downloads the redlined DOCX with real Track Changes (from Instant Swarm™)
1275
- 7. Reviews the auto-generated negotiation email (from Email Generator)
1109
+ 4. Reads results showing favorability score (e.g., 42% - Vendor Favorable)
1110
+ 5. Identifies top risks based on contract type and activated analyzers
1111
+ 6. User can ask follow-up questions via ask_sac (SAC has full contract context)
1112
+ 7. Downloads the redlined DOCX with real Track Changes (from Instant Swarm™)
1113
+ 8. Reviews the auto-generated negotiation email (from Email Generator)
1276
1114
  \`\`\`
1277
1115
 
1278
1116
  ## Environment Variables