@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.
@@ -48,12 +48,48 @@ export interface McpServerConfig {
48
48
  readonly BITSBOUND_API_KEY: string;
49
49
  }
50
50
 
51
- export const DEFAULT_API_URL = 'https://bitsbound-saas-backend-mxb1.onrender.com';
51
+ export const DEFAULT_API_URL = 'https://bitsbound-contract-backend.onrender.com';
52
52
 
53
53
  // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
54
54
  // Tool Input Schemas 'R_DVT_G_D_ToolInputs' - What AI platforms send to each tool
55
55
  // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
56
56
 
57
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
58
+ // Contract Vertical Types 'R_DVT_G_D_ContractVerticals'
59
+ // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
60
+
61
+ /**
62
+ * ContractVertical - The type of contract being analyzed
63
+ * D: Each vertical has its own analyzer set and representing party options
64
+ *
65
+ * Verticals and their Representing Party options:
66
+ * - saas: Customer (Buyer) | Vendor (Seller)
67
+ * - ma: Buyer | Seller
68
+ * - vc: Investor | Founder/Company
69
+ * - employment: Employer | Employee
70
+ * - nda: Disclosing Party | Receiving Party
71
+ * - equipment-lease: Lessee | Lessor
72
+ * - equipment-financing: Debtor | Secured Party
73
+ * - security-agreement: Debtor | Secured Party
74
+ * - loan: Borrower | Lender
75
+ * - commercial-lease: Tenant | Landlord
76
+ * - professional-services: Client | Service Provider
77
+ * - miscellaneous: Party A | Party B (let AI decide best classification)
78
+ */
79
+ export type ContractVertical =
80
+ | 'saas' // MSA, SaaS Agreement, Subscription Agreement
81
+ | 'ma' // APA, SPA, Merger Agreement
82
+ | 'vc' // SAFE, Convertible Note, Series A/B/C
83
+ | 'employment' // Offer Letter, Employment Agreement
84
+ | 'nda' // Mutual NDA, Unilateral NDA
85
+ | 'equipment-lease' // Equipment Lease (lessee/lessor)
86
+ | 'equipment-financing' // Equipment Financing (debtor/secured-party)
87
+ | 'security-agreement' // Security Agreement (debtor/secured-party)
88
+ | 'loan' // Loan Agreement (borrower/lender)
89
+ | 'commercial-lease' // Commercial Lease, Office Lease
90
+ | 'professional-services' // SOW, Consulting Agreement
91
+ | 'miscellaneous'; // Unknown/other (AI classifies)
92
+
57
93
  export interface AnalyzeContractInput {
58
94
  readonly filePath?: string; // RECOMMENDED: Absolute path to DOCX file on disk
59
95
  readonly docxBase64?: string; // Alternative: Base64-encoded DOCX content
@@ -61,10 +97,15 @@ export interface AnalyzeContractInput {
61
97
  readonly analysisDepth?: 'quick' | 'standard' | 'deep';
62
98
  readonly perspective?: 'customer' | 'vendor' | 'neutral'; // DEPRECATED: Use representingParty
63
99
 
100
+ // ════════════════════════════════════════════════════════════════════════════
101
+ // CONTRACT TYPE (determines analyzer set and representing party options)
102
+ // ════════════════════════════════════════════════════════════════════════════
103
+ readonly contractVertical?: ContractVertical; // What type of contract? (REQUIRED)
104
+
64
105
  // ════════════════════════════════════════════════════════════════════════════
65
106
  // DEAL CONTEXT (matches Customer Account dashboard Start Analysis form)
66
107
  // ════════════════════════════════════════════════════════════════════════════
67
- readonly representingParty?: 'customer' | 'vendor' | 'neutral'; // Who is the AI representing? (REQUIRED)
108
+ readonly representingParty?: string; // Who is the AI representing? (contextual per vertical)
68
109
  readonly dealValue?: number; // Estimated deal value / ACV in specified currency
69
110
  readonly dealValueCurrency?: 'USD' | 'EUR' | 'GBP' | 'CAD' | 'AUD'; // Currency (default: USD)
70
111
  readonly industry?: string; // Industry: technology, healthcare, financial, retail, manufacturing, professional, media, education, government, other
@@ -382,7 +423,7 @@ export interface CheckDealbreakersOutput {
382
423
  }
383
424
 
384
425
  // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
385
- // BitsBound SaaS API Types 'R_DVT_G_D_ApiTypes' - For calling the backend
426
+ // BitsBound API Types 'R_DVT_G_D_ApiTypes' - For calling the backend
386
427
  // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
387
428
 
388
429
  export interface BitsBoundApiResponse<T> {
@@ -433,129 +474,93 @@ export interface SectionAnalysis {
433
474
  // ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════
434
475
 
435
476
  export const TOOL_DEFINITIONS = {
436
- process_contract: {
437
- name: 'process_contract',
438
- description: `Process a contract through the full 8-stage BitsBound pipeline.
477
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
478
+ // CORE TOOLS - 4-tool interface for Claude Code Plugin Marketplace
479
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
439
480
 
440
- ⚠️ BEFORE CALLING THIS TOOL: You MUST gather the following information from the user:
481
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
482
+ // REDLINE MODE: Attack existing counterparty contract with parallel SAC agents
483
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
484
+ redline_swarm: {
485
+ name: 'redline_swarm',
486
+ description: `**REDLINE MODE** - Attack counterparty's contract with parallel AI agents.
441
487
 
442
- **REQUIRED - Ask the user:**
443
- 1. representingParty: "Are you representing the Customer (buyer) or Vendor (seller)?"
444
- 2. aggressivenessLevel: "On a scale of 1-10, how aggressive should the redlines be? (1=very conciliatory, 5=balanced, 10=very aggressive)"
488
+ 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.
445
489
 
446
- **RECOMMENDED - Ask if not obvious:**
447
- 3. paperOwnership: "Did the counterparty draft this contract (their paper) or did you draft it (our paper)?"
448
- 4. dealValue + dealValueCurrency: "What's the estimated deal value?"
449
- 5. industry: "What industry is this contract for?"
450
- 6. additionalContext: "Any special context about this deal or relationship I should know?"
490
+ **REQUIRED INPUTS (ask the user):**
491
+ 1. File path to the counterparty's DOCX contract
492
+ 2. Contract type: saas, ma, vc, employment, nda, equipment, commercial-lease, professional-services, or miscellaneous
493
+ 3. Who you represent: customer/vendor (saas), buyer/seller (ma), investor/founder (vc), etc.
494
+ 4. Aggressiveness level: 1-10 (1=conciliatory, 5=balanced, 10=aggressive)
451
495
 
452
- **FOR EMAIL GENERATION - Ask:**
453
- 7. emailRecipient: "Should I generate a negotiation email to send to the counterparty?"
454
- 8. If yes: recipientName, senderName (your name), any additionalContext for the email tone
496
+ **OPTIONAL:** dealValue, additionalContext, emailRecipient info
455
497
 
456
- After gathering this context, call the tool. The response includes "importantNote" with when to check back (~45 min).
498
+ **DELIVERABLES:**
499
+ • Redlined DOCX with real Track Changes (not markup - actual w:ins/w:del)
500
+ • Negotiation email explaining each requested change
501
+ • Favorability score and risk analysis
457
502
 
458
- 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.`,
503
+ Analysis takes ~25-35 minutes. Response includes 'checkBackTime' for when to check status.`,
459
504
  inputSchema: {
460
505
  type: 'object',
461
506
  properties: {
462
- // ══════════════════════════════════════════════════════════════════════
463
- // FILE INPUT (one required)
464
- // ══════════════════════════════════════════════════════════════════════
465
507
  filePath: {
466
508
  type: 'string',
467
- 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.'
509
+ description: 'RECOMMENDED: Absolute path to DOCX file (e.g., "/Users/john/Documents/contract.docx"). Server reads file directly.'
468
510
  },
469
511
  docxBase64: {
470
512
  type: 'string',
471
- description: 'Alternative: The contract document already encoded as base64 string (DOCX format). Use filePath instead if possible.'
513
+ description: 'Alternative: Base64-encoded DOCX content. Use filePath instead when possible.'
472
514
  },
473
515
  fileName: {
474
516
  type: 'string',
475
- description: 'Original filename of the document. If using filePath, this is extracted automatically.'
517
+ description: 'Original filename. Auto-extracted if using filePath.'
518
+ },
519
+ contractVertical: {
520
+ type: 'string',
521
+ enum: ['saas', 'ma', 'vc', 'employment', 'nda', 'equipment-lease', 'equipment-financing', 'security-agreement', 'loan', 'commercial-lease', 'professional-services', 'miscellaneous'],
522
+ description: 'Contract type. Determines analyzers and party options.'
476
523
  },
477
-
478
- // ══════════════════════════════════════════════════════════════════════
479
- // DEAL CONTEXT (ask user for these!)
480
- // ══════════════════════════════════════════════════════════════════════
481
524
  representingParty: {
482
525
  type: 'string',
483
- enum: ['customer', 'vendor', 'neutral'],
484
- description: 'REQUIRED: Who are you representing? customer=buyer, vendor=seller, neutral=balanced review'
526
+ 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)'
527
+ },
528
+ aggressivenessLevel: {
529
+ type: 'number',
530
+ minimum: 1,
531
+ maximum: 10,
532
+ description: 'Redline aggressiveness 1-10. Default: 5'
485
533
  },
486
534
  dealValue: {
487
535
  type: 'number',
488
- description: 'Estimated deal value / annual contract value (ACV). Helps calibrate risk thresholds.'
536
+ description: 'Optional: Deal value for risk calibration'
489
537
  },
490
538
  dealValueCurrency: {
491
539
  type: 'string',
492
540
  enum: ['USD', 'EUR', 'GBP', 'CAD', 'AUD'],
493
- description: 'Currency for deal value. Default: USD'
494
- },
495
- industry: {
496
- type: 'string',
497
- enum: ['technology', 'healthcare', 'financial', 'retail', 'manufacturing', 'professional', 'media', 'education', 'government', 'other'],
498
- description: 'Industry context for analysis. Affects regulatory considerations and benchmarks.'
541
+ description: 'Currency. Default: USD'
499
542
  },
500
543
  additionalContext: {
501
544
  type: 'string',
502
- description: 'Free-form context about the deal: relationship history, priorities, concerns, red lines, etc.'
545
+ description: 'Optional: Deal context, priorities, relationship notes'
503
546
  },
504
547
  paperOwnership: {
505
548
  type: 'string',
506
549
  enum: ['their-paper', 'our-paper'],
507
- description: 'Who drafted the contract? their-paper=counterparty drafted (default, full analysis), our-paper=we drafted (review their markup only)'
508
- },
509
-
510
- // ══════════════════════════════════════════════════════════════════════
511
- // SAC/REDLINE SETTINGS
512
- // ══════════════════════════════════════════════════════════════════════
513
- aggressivenessLevel: {
514
- type: 'number',
515
- minimum: 1,
516
- maximum: 10,
517
- description: 'IMPORTANT: Redline aggressiveness 1-10. 1=very conciliatory (accept most terms), 5=balanced (default), 10=very aggressive (push hard on everything)'
518
- },
519
- enableAutoSwarm: {
520
- type: 'boolean',
521
- description: 'Enable parallel 17-section SAC analysis for comprehensive redlines. Default: true'
550
+ description: 'Who drafted? their-paper=counterparty (default), our-paper=we drafted'
522
551
  },
523
- analysisDepth: {
524
- type: 'string',
525
- enum: ['quick', 'standard', 'deep'],
526
- description: 'Analysis depth: quick (~10 min), standard (~30 min), deep (~45 min). Default: standard'
527
- },
528
-
529
- // ══════════════════════════════════════════════════════════════════════
530
- // EMAIL GENERATION
531
- // ══════════════════════════════════════════════════════════════════════
532
552
  enableEmailGenerator: {
533
553
  type: 'boolean',
534
- description: 'Generate a negotiation email summarizing redlines? Default: true'
535
- },
536
- emailRecipient: {
537
- type: 'string',
538
- enum: ['client', 'counterparty', 'none'],
539
- description: 'Who should the email be addressed to? counterparty=send to other side, client=internal summary, none=skip email'
554
+ description: 'Generate negotiation email? Default: true'
540
555
  },
541
556
  emailContext: {
542
557
  type: 'object',
543
- description: 'Additional context for email generation',
558
+ description: 'Email context',
544
559
  properties: {
545
- recipientName: { type: 'string', description: 'Name of email recipient (e.g., "John Smith")' },
546
- recipientEmail: { type: 'string', description: 'Email address of recipient' },
547
- senderName: { type: 'string', description: 'Your name (the sender)' },
548
- additionalContext: { type: 'string', description: 'Tone/relationship notes for the email (e.g., "We have a good relationship with this vendor")' }
560
+ recipientName: { type: 'string' },
561
+ senderName: { type: 'string' },
562
+ additionalContext: { type: 'string' }
549
563
  }
550
- },
551
-
552
- // ══════════════════════════════════════════════════════════════════════
553
- // DEPRECATED (use representingParty instead)
554
- // ══════════════════════════════════════════════════════════════════════
555
- perspective: {
556
- type: 'string',
557
- enum: ['customer', 'vendor', 'neutral'],
558
- description: 'DEPRECATED: Use representingParty instead'
559
564
  }
560
565
  },
561
566
  required: []
@@ -566,190 +571,94 @@ Pipeline: (1) Context Loading, (2) Data Extraction, (3) Party Identification, (4
566
571
  }
567
572
  },
568
573
 
569
- get_analysis_status: {
570
- name: 'get_analysis_status',
571
- 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.',
572
- inputSchema: {
573
- type: 'object',
574
- properties: {
575
- analysisId: {
576
- type: 'string',
577
- description: 'The processing ID returned from process_contract'
578
- }
579
- },
580
- required: ['analysisId']
581
- },
582
- annotations: {
583
- readOnlyHint: true
584
- }
585
- },
586
-
587
- ask_sac: {
588
- name: 'ask_sac',
589
- 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.',
574
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
575
+ // DRAFT MODE: Generate contract from scratch with multi-pass AI refinement
576
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
577
+ power_draft: {
578
+ name: 'power_draft',
579
+ description: `**DRAFT MODE** - Generate a complete contract from scratch.
580
+
581
+ NO FILE UPLOAD NEEDED. Provide deal context and BitsBound generates a partner-level contract using a multi-pass architecture:
582
+ 1. Opus 4.5 generates initial draft based on your requirements
583
+ 2. 16+ parallel analyzers critique the draft
584
+ 3. Sonnet 4.5 synthesizes analyzer feedback
585
+ 4. Opus 4.5 generates refined second draft
586
+ 5. Final QB Enhancer pass for consistency
587
+
588
+ **REQUIRED INPUTS (ask the user):**
589
+ 1. Contract type: saas, ma, vc, employment, nda, equipment-lease, commercial-lease, professional-services
590
+ 2. Who you represent: customer/vendor (saas), buyer/seller (ma), investor/founder (vc), etc.
591
+ 3. Terms Favorability: 1-10 (1=minimal protections/fast close, 5=balanced, 10=maximum protections/bulletproof)
592
+
593
+ **RECOMMENDED:** Additional context describing the deal (value, term, key requirements, counterparty info)
594
+
595
+ **DELIVERABLES:**
596
+ • Clean DOCX ready for negotiation (no Track Changes needed - it's your paper)
597
+ • Cover email introducing the draft (optional)
598
+ • Risk analysis of your own positions
599
+
600
+ Draft generation takes ~30-40 minutes. Response includes 'checkBackTime' for when to check status.`,
590
601
  inputSchema: {
591
602
  type: 'object',
592
603
  properties: {
593
- analysisId: {
594
- type: 'string',
595
- description: 'The analysis ID of a completed analysis'
596
- },
597
- question: {
604
+ // ════════════════════════════════════════════════════════════════════════════
605
+ // REQUIRED - Core Draft Parameters (matches UI)
606
+ // ════════════════════════════════════════════════════════════════════════════
607
+ contractVertical: {
598
608
  type: 'string',
599
- description: 'Your question about the contract'
609
+ enum: ['saas', 'ma', 'vc', 'employment', 'nda', 'equipment-lease', 'equipment-financing', 'security-agreement', 'loan', 'commercial-lease', 'professional-services'],
610
+ description: 'Contract type to generate. REQUIRED.'
600
611
  },
601
- includeClauseCitations: {
602
- type: 'boolean',
603
- description: 'Include specific clause citations in the response. Default: true'
604
- }
605
- },
606
- required: ['analysisId', 'question']
607
- },
608
- annotations: {
609
- readOnlyHint: true
610
- }
611
- },
612
-
613
- generate_redline: {
614
- name: 'generate_redline',
615
- 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.',
616
- inputSchema: {
617
- type: 'object',
618
- properties: {
619
- analysisId: {
612
+ representingParty: {
620
613
  type: 'string',
621
- description: 'The analysis ID of a completed analysis'
614
+ 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)'
622
615
  },
623
- aggressiveness: {
616
+ aggressivenessLevel: {
624
617
  type: 'number',
625
- enum: [1, 2, 3, 4, 5],
626
- description: 'How aggressive the redlines should be (1=conservative, 5=aggressive). Default: 3'
618
+ minimum: 1,
619
+ maximum: 10,
620
+ description: 'Terms Favorability 1-10: How protective for YOUR party. 1=minimal protections (fast close), 5=balanced (default), 10=maximum protections (bulletproof). REQUIRED.'
627
621
  },
628
- includeComments: {
629
- type: 'boolean',
630
- description: 'Include rationale comments in Word margins. Default: true'
631
- }
632
- },
633
- required: ['analysisId']
634
- },
635
- annotations: {
636
- readOnlyHint: false,
637
- destructiveHint: false
638
- }
639
- },
640
622
 
641
- generate_negotiation_email: {
642
- name: 'generate_negotiation_email',
643
- description: 'Generate a professional negotiation email to send to the counterparty, explaining requested changes and their rationale.',
644
- inputSchema: {
645
- type: 'object',
646
- properties: {
647
- analysisId: {
648
- type: 'string',
649
- description: 'The analysis ID of a completed analysis'
623
+ // ════════════════════════════════════════════════════════════════════════════
624
+ // OPTIONAL - Deal Context (highly recommended for better output)
625
+ // ════════════════════════════════════════════════════════════════════════════
626
+ dealValue: {
627
+ type: 'number',
628
+ description: 'Annual Contract Value for risk calibration. Optional but recommended.'
650
629
  },
651
- tone: {
630
+ dealValueCurrency: {
652
631
  type: 'string',
653
- enum: ['collaborative', 'firm', 'aggressive'],
654
- description: 'Tone of the email. Default: collaborative'
632
+ enum: ['USD', 'EUR', 'GBP', 'CAD', 'AUD'],
633
+ description: 'Currency for deal value. Default: USD'
655
634
  },
656
- recipientRole: {
657
- type: 'string',
658
- description: 'Role of the recipient (e.g., "General Counsel", "Sales Rep", "Procurement"). Helps tailor the message.'
659
- }
660
- },
661
- required: ['analysisId']
662
- },
663
- annotations: {
664
- readOnlyHint: false,
665
- destructiveHint: false
666
- }
667
- },
668
-
669
- extract_clause: {
670
- name: 'extract_clause',
671
- description: 'Extract and analyze a specific clause type from an analyzed contract. Returns the clause text, risk analysis, and suggested improvements.',
672
- inputSchema: {
673
- type: 'object',
674
- properties: {
675
- analysisId: {
635
+ additionalContext: {
676
636
  type: 'string',
677
- description: 'The analysis ID of a completed analysis'
637
+ 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..."'
678
638
  },
679
- clauseType: {
680
- type: 'string',
681
- enum: ['indemnification', 'liability', 'ip', 'termination', 'payment', 'confidentiality', 'data_privacy', 'sla', 'force_majeure', 'assignment'],
682
- description: 'The type of clause to extract'
683
- }
684
- },
685
- required: ['analysisId', 'clauseType']
686
- },
687
- annotations: {
688
- readOnlyHint: true
689
- }
690
- },
691
639
 
692
- compare_playbook: {
693
- name: 'compare_playbook',
694
- description: 'Compare an analyzed contract against a company playbook to identify deviations from pre-approved positions and required approvals.',
695
- inputSchema: {
696
- type: 'object',
697
- properties: {
698
- analysisId: {
699
- type: 'string',
700
- description: 'The analysis ID of a completed analysis'
701
- },
640
+ // ════════════════════════════════════════════════════════════════════════════
641
+ // OPTIONAL - Playbook & Email Settings
642
+ // ════════════════════════════════════════════════════════════════════════════
702
643
  playbookId: {
703
644
  type: 'string',
704
- description: 'The ID of the playbook to compare against'
705
- }
706
- },
707
- required: ['analysisId', 'playbookId']
708
- },
709
- annotations: {
710
- readOnlyHint: true
711
- }
712
- },
713
-
714
- // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
715
- // INSTANT SWARM - Parallel N-Section Redlining (spawns N agents for N sections, max parallelization)
716
- // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
717
-
718
- instant_swarm: {
719
- name: 'instant_swarm',
720
- 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.',
721
- inputSchema: {
722
- type: 'object',
723
- properties: {
724
- analysisId: {
725
- type: 'string',
726
- description: 'The analysis ID from a completed process_contract call. The analysis provides contract context for each section.'
727
- },
728
- aggressivenessLevel: {
729
- type: 'number',
730
- enum: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
731
- description: 'How aggressive the redlines should be (1=conservative, 10=very aggressive). Recommended: 5-7 for balanced approach.'
732
- },
733
- partyPosition: {
734
- type: 'string',
735
- enum: ['customer', 'vendor'],
736
- description: 'Which side are you on? "customer" = you are buying/receiving services. "vendor" = you are selling/providing services.'
645
+ description: 'Playbook ID for firm-specific rules. Optional - uses BitsBound Foundational (117 rules) by default.'
737
646
  },
738
- ourPartyName: {
739
- type: 'string',
740
- description: 'Your company name as it should appear in redlines (e.g., "Acme Corp").'
741
- },
742
- counterpartyName: {
743
- type: 'string',
744
- description: 'The other party\'s name (e.g., "Vendor Inc").'
647
+ enableEmailGenerator: {
648
+ type: 'boolean',
649
+ description: 'Generate cover email introducing the draft? Default: true'
745
650
  },
746
- targetSections: {
747
- type: 'array',
748
- items: { type: 'string' },
749
- 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'
651
+ emailContext: {
652
+ type: 'object',
653
+ description: 'Cover email context',
654
+ properties: {
655
+ recipientName: { type: 'string', description: 'Name of email recipient' },
656
+ senderName: { type: 'string', description: 'Your name (the sender)' },
657
+ additionalContext: { type: 'string', description: 'Tone, relationship notes, etc.' }
658
+ }
750
659
  }
751
660
  },
752
- required: ['analysisId', 'aggressivenessLevel', 'partyPosition']
661
+ required: ['contractVertical', 'representingParty', 'aggressivenessLevel']
753
662
  },
754
663
  annotations: {
755
664
  readOnlyHint: false,
@@ -757,80 +666,23 @@ Pipeline: (1) Context Loading, (2) Data Extraction, (3) Party Identification, (4
757
666
  }
758
667
  },
759
668
 
760
- // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
761
- // QUICK TOOLS - Immediate analysis without waiting for full pipeline
762
- // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
763
-
764
- quick_scan: {
765
- name: 'quick_scan',
766
- 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.',
767
- inputSchema: {
768
- type: 'object',
769
- properties: {
770
- contractText: {
771
- type: 'string',
772
- description: 'The contract text (plain text or base64-encoded DOCX). For DOCX files, base64 encode the file contents.'
773
- },
774
- fileName: {
775
- type: 'string',
776
- description: 'Optional filename for context (e.g., "Acme_MSA_2024.docx")'
777
- },
778
- perspective: {
779
- type: 'string',
780
- enum: ['customer', 'vendor', 'neutral'],
781
- description: 'Analyze from customer (buyer), vendor (seller), or neutral perspective. Default: customer'
782
- }
783
- },
784
- required: ['contractText']
785
- },
786
- annotations: {
787
- readOnlyHint: true
788
- }
789
- },
790
-
791
- ask_clause: {
792
- name: 'ask_clause',
793
- 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?"',
794
- inputSchema: {
795
- type: 'object',
796
- properties: {
797
- contractText: {
798
- type: 'string',
799
- description: 'The contract text (plain text or base64-encoded DOCX)'
800
- },
801
- question: {
802
- type: 'string',
803
- description: 'Your question about the contract (e.g., "What is the liability cap?", "Is there an auto-renewal clause?")'
804
- },
805
- clauseType: {
806
- type: 'string',
807
- enum: ['indemnification', 'liability', 'ip', 'termination', 'payment', 'confidentiality', 'data_privacy', 'sla', 'force_majeure', 'assignment', 'any'],
808
- description: 'Optional: Focus on a specific clause type, or "any" to search the whole contract. Default: any'
809
- }
810
- },
811
- required: ['contractText', 'question']
812
- },
813
- annotations: {
814
- readOnlyHint: true
815
- }
816
- },
669
+ get_analysis_status: {
670
+ name: 'get_analysis_status',
671
+ description: `Check analysis progress. When complete, returns:
672
+ - redlinedDocxDownloadUrl: Presigned URL to download redlined DOCX (valid 1 hour)
673
+ - negotiationEmailHtml/PlainText: Ready-to-send negotiation email
674
+ - favorabilityScore, topRisks, negotiationPriorities
817
675
 
818
- check_dealbreakers: {
819
- name: 'check_dealbreakers',
820
- 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.',
676
+ ALWAYS display download URLs as clickable links when analysis completes.`,
821
677
  inputSchema: {
822
678
  type: 'object',
823
679
  properties: {
824
- contractText: {
825
- type: 'string',
826
- description: 'The contract text (plain text or base64-encoded DOCX)'
827
- },
828
- playbookId: {
680
+ analysisId: {
829
681
  type: 'string',
830
- description: 'Optional: Specific playbook to check against. If not provided, uses your default company playbook.'
682
+ description: 'Analysis ID from redline_swarm or power_draft'
831
683
  }
832
684
  },
833
- required: ['contractText']
685
+ required: ['analysisId']
834
686
  },
835
687
  annotations: {
836
688
  readOnlyHint: true
@@ -839,17 +691,17 @@ Pipeline: (1) Context Loading, (2) Data Extraction, (3) Party Identification, (4
839
691
 
840
692
  download_file: {
841
693
  name: 'download_file',
842
- 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.',
694
+ description: 'Download a file from BitsBound (redlined DOCX, analysis JSON). Returns base64 content or saves to local path.',
843
695
  inputSchema: {
844
696
  type: 'object',
845
697
  properties: {
846
698
  downloadUrl: {
847
699
  type: 'string',
848
- description: 'The download URL from get_analysis_status deliverables (redlinedDocxDownloadUrl)'
700
+ description: 'Download URL from get_analysis_status deliverables'
849
701
  },
850
702
  saveToPath: {
851
703
  type: 'string',
852
- description: 'Optional: Local file path to save the downloaded file. If not provided, returns base64 content.'
704
+ description: 'Optional: Local path to save file. If omitted, returns base64.'
853
705
  }
854
706
  },
855
707
  required: ['downloadUrl']
@@ -870,7 +722,7 @@ export const RESOURCE_DEFINITIONS = {
870
722
  analysis: {
871
723
  uriTemplate: 'bitsbound://analysis/{analysisId}',
872
724
  name: 'Contract Analysis',
873
- description: 'Full analysis results including all 17 analyzer outputs, risk scores, and recommendations',
725
+ description: 'Full analysis results including all analyzer outputs (varies by contract type), risk scores, and recommendations',
874
726
  mimeType: 'application/json'
875
727
  },
876
728
  playbook: {
@@ -902,33 +754,27 @@ export const RESOURCE_DEFINITIONS = {
902
754
  * - O: User experiences a smooth, guided contract analysis flow
903
755
  */
904
756
  export const PROMPT_DEFINITIONS = {
905
- process_contract: {
906
- name: 'process_contract',
907
- description: '📄 Process Contract - Upload a DOCX and get partner-level redlines with Track Changes, risk analysis, and a negotiation email',
908
- arguments: []
909
- },
910
- quick_scan: {
911
- name: 'quick_scan',
912
- description: '⚡ Quick Risk Scan - Get instant risk assessment in 5-10 seconds without waiting for full analysis',
913
- arguments: []
914
- },
915
- ask_about_contract: {
916
- name: 'ask_about_contract',
917
- description: '💬 Ask About a Clause - Upload a contract and ask specific questions about any clause or term',
757
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
758
+ // CORE PROMPTS - 3-prompt interface matching 4-tool architecture
759
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
760
+
761
+ redline_swarm: {
762
+ name: 'redline_swarm',
763
+ description: 'Redline Mode - Upload counterparty\'s DOCX and get partner-level redlines with real Track Changes, risk analysis, and negotiation email',
918
764
  arguments: []
919
765
  },
920
- check_dealbreakers: {
921
- name: 'check_dealbreakers',
922
- description: '🚨 Check Dealbreakers - Quick pass/fail check against your playbook rules',
766
+ power_draft: {
767
+ name: 'power_draft',
768
+ description: 'Draft Mode - Generate a complete contract from scratch with multi-pass AI refinement (Opus 4.5 drafts → Analyzers critique → Opus 4.5 refines)',
923
769
  arguments: []
924
770
  },
925
- continue_analysis: {
926
- name: 'continue_analysis',
927
- description: '📊 Continue Previous Analysis - Resume working with a previously analyzed contract',
771
+ check_analysis: {
772
+ name: 'check_analysis',
773
+ description: 'Check Analysis Status - Check progress or download results from a running/completed redline or draft',
928
774
  arguments: [
929
775
  {
930
776
  name: 'analysisId',
931
- description: 'The analysis ID from a previous contract analysis',
777
+ description: 'The analysis ID from redline_swarm or power_draft',
932
778
  required: true
933
779
  }
934
780
  ]
@@ -943,94 +789,117 @@ export type PromptName = keyof typeof PROMPT_DEFINITIONS;
943
789
  * NOTE: MCP spec requires content to be { type: 'text', text: string } not plain string
944
790
  */
945
791
  export const PROMPT_MESSAGES: Record<PromptName, { role: 'user'; content: { type: 'text'; text: string } }[]> = {
946
- process_contract: [
947
- {
948
- role: 'user',
949
- content: { type: 'text', text: `I want to analyze a contract using BitsBound.
950
-
951
- Please help me by:
952
- 1. Ask me for the contract file. I will provide EITHER:
953
- - A full file path (e.g., /Users/john/Documents/contract.docx)
954
- - An uploaded DOCX file
955
- 2. IMPORTANT FILE PATH HANDLING:
956
- - 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.
957
- - If I upload a file: Use the base64 content with 'docxBase64' parameter.
958
- 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.
959
- 4. When I ask you to check status (using 'get_analysis_status'), show me:
960
- - Current progress percentage
961
- - If complete, ALWAYS provide these clickable links (they work directly in browser):
962
- * REDLINED DOCX: Display the 'redlinedDocxUrl' as a clickable download link
963
- * NEGOTIATION EMAIL: Display the 'negotiationEmailUrl' as a clickable link to view in browser
964
- - Also show: favorability score, top 5 risks, negotiation priorities
965
-
966
- The analysis typically takes ~25 minutes. Wait for me to ask you to check - do not poll automatically.` }
967
- }
968
- ],
969
- quick_scan: [
970
- {
971
- role: 'user',
972
- content: { type: 'text', text: `I want a quick risk scan of a contract (5-10 seconds, not the full analysis).
973
-
974
- Please help me by:
975
- 1. Asking me to upload or paste the contract
976
- 2. Use the BitsBound 'quick_scan' tool for instant analysis
977
- 3. Show me:
978
- - Contract type and parties
979
- - Favorability estimate
980
- - Top concerns by severity
981
- - Key terms (liability cap, term, payment, etc.)
982
- - Whether I should do a full analysis
983
-
984
- This is for initial triage - not a substitute for full attorney review.` }
985
- }
986
- ],
987
- ask_about_contract: [
792
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
793
+ // CORE PROMPT MESSAGES - Matches 4-tool architecture (redline_swarm, power_draft, get_analysis_status, download_file)
794
+ // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
795
+
796
+ redline_swarm: [
988
797
  {
989
798
  role: 'user',
990
- content: { type: 'text', text: `I want to ask questions about specific clauses in a contract.
799
+ content: { type: 'text', text: `I want to analyze and redline a counterparty's contract using BitsBound's REDLINE MODE.
991
800
 
992
- Please help me by:
993
- 1. Asking me to upload or paste the contract (or relevant sections)
994
- 2. Ask what I want to know (e.g., "What is the liability cap?", "Is there an auto-renewal?")
995
- 3. Use the BitsBound 'ask_clause' tool for instant answers
996
- 4. Include the actual clause text and any risk assessment
801
+ Please help me by gathering this information:
997
802
 
998
- I can ask multiple questions - this is a Q&A session about the contract.` }
803
+ 1. CONTRACT FILE:
804
+ - File path (e.g., /Users/john/Documents/contract.docx) - preferred
805
+ - Or upload the DOCX directly
806
+
807
+ 2. CONTRACT TYPE:
808
+ - saas, ma, vc, employment, nda, equipment, commercial-lease, professional-services, or miscellaneous
809
+
810
+ 3. WHO I REPRESENT:
811
+ - saas: customer or vendor
812
+ - ma: buyer or seller
813
+ - vc: investor or founder
814
+ - employment: employer or employee
815
+ - nda: disclosing-party or receiving-party
816
+ - (etc. based on contract type)
817
+
818
+ 4. AGGRESSIVENESS (1-10):
819
+ - 1 = very conciliatory, 5 = balanced, 10 = very aggressive
820
+
821
+ Then call the 'redline_swarm' tool. Instant Swarm™ deploys parallel AI agents to attack every section.
822
+ Analysis takes ~25-35 minutes. Response includes 'checkBackTime' - tell me when to check back.
823
+ Do NOT poll automatically - wait for me to ask.` }
999
824
  }
1000
825
  ],
1001
- check_dealbreakers: [
826
+ power_draft: [
1002
827
  {
1003
828
  role: 'user',
1004
- content: { type: 'text', text: `I want to check a contract for dealbreakers against my company's playbook.
1005
-
1006
- Please help me by:
1007
- 1. Asking me to upload or paste the contract
1008
- 2. Use the BitsBound 'check_dealbreakers' tool
1009
- 3. Show me:
1010
- - Pass/fail result
1011
- - Any dealbreaker issues found
1012
- - Missing required clauses
1013
- - Who needs to approve if we proceed
1014
-
1015
- This is a quick pre-screen before spending time on full analysis.` }
829
+ content: { type: 'text', text: `I want to generate a NEW CONTRACT from scratch using BitsBound's DRAFT MODE.
830
+
831
+ NO FILE UPLOAD NEEDED - just provide deal context.
832
+
833
+ Please help me by gathering this information:
834
+
835
+ **REQUIRED:**
836
+
837
+ 1. CONTRACT TYPE:
838
+ - saas (SaaS/Software Agreement)
839
+ - ma (M&A - APA, SPA, Merger)
840
+ - vc (VC - SAFE, Term Sheet, Series A/B/C)
841
+ - employment (Offer Letter, Employment Agreement)
842
+ - nda (Mutual or Unilateral NDA)
843
+ - equipment-lease (Equipment Lease)
844
+ - commercial-lease (Commercial Real Estate Lease)
845
+ - professional-services (SOW, Consulting Agreement)
846
+
847
+ 2. WHO YOU REPRESENT:
848
+ - saas: customer or vendor
849
+ - ma: buyer or seller
850
+ - vc: investor or founder
851
+ - employment: employer or employee
852
+ - nda: disclosing-party or receiving-party
853
+ - equipment-lease: lessee or lessor
854
+ - commercial-lease: tenant or landlord
855
+ - professional-services: client or service-provider
856
+
857
+ 3. TERMS FAVORABILITY (1-10):
858
+ - 1 = minimal protections (fast close)
859
+ - 5 = balanced (default)
860
+ - 10 = maximum protections (bulletproof)
861
+
862
+ **HIGHLY RECOMMENDED - Additional Context:**
863
+ The more context you provide, the better the AI can tailor the contract:
864
+ - Party names (your company, counterparty)
865
+ - Deal value (e.g., $500K/year)
866
+ - Term length (e.g., 3-year term)
867
+ - Key requirements (e.g., "strong IP protections", "robust termination rights")
868
+ - Counterparty info (e.g., "startup", "Fortune 500")
869
+ - Any special provisions needed
870
+
871
+ **OPTIONAL:**
872
+ - Annual Contract Value (for risk calibration)
873
+ - Generate cover email? (default: yes)
874
+
875
+ Then call the 'power_draft' tool. Multi-pass AI architecture:
876
+ 1. Opus 4.5 generates initial draft
877
+ 2. 16+ parallel analyzers critique the draft
878
+ 3. Sonnet 4.5 synthesizes feedback
879
+ 4. Opus 4.5 generates refined second draft
880
+ 5. QB Enhancer finalizes for consistency
881
+
882
+ Draft generation takes ~30-40 minutes. Response includes 'checkBackTime'.
883
+ Do NOT poll automatically - wait for me to ask.` }
1016
884
  }
1017
885
  ],
1018
- continue_analysis: [
886
+ check_analysis: [
1019
887
  {
1020
888
  role: 'user',
1021
- content: { type: 'text', text: `I want to continue working with a previously analyzed contract.
1022
-
1023
- I have an analysis ID from a previous BitsBound analysis. Please:
1024
- 1. Ask me for the analysis ID
1025
- 2. Use 'get_analysis_status' to check if it's complete
1026
- 3. If complete, I can:
1027
- - Ask questions with 'ask_sac' (SAC has full context)
1028
- - Generate a redlined document with 'generate_redline'
1029
- - Generate a negotiation email with 'generate_negotiation_email'
1030
- - Extract specific clauses with 'extract_clause'
1031
- - Compare against a playbook with 'compare_playbook'
1032
-
1033
- What would you like to do with this analysis?` }
889
+ content: { type: 'text', text: `I want to check on a contract analysis or draft generation.
890
+
891
+ Analysis ID: {analysisId}
892
+
893
+ Please use 'get_analysis_status' and show me:
894
+ - Current progress percentage
895
+ - If complete, provide:
896
+ * CLICKABLE download link for the DOCX (redlined or clean draft)
897
+ * Negotiation/cover email content
898
+ * Favorability score
899
+ * Top risks
900
+ * Negotiation priorities
901
+
902
+ If I need to download the file, use 'download_file' with the URL from the status response.` }
1034
903
  }
1035
904
  ]
1036
905
  };
@@ -1066,7 +935,7 @@ export const OPENAPI_SPEC = {
1066
935
  },
1067
936
  servers: [
1068
937
  {
1069
- url: 'https://bitsbound-saas-backend-mxb1.onrender.com',
938
+ url: 'https://bitsbound-contract-backend.onrender.com',
1070
939
  description: 'Production server'
1071
940
  }
1072
941
  ],
@@ -1618,7 +1487,7 @@ Add to your Claude Desktop configuration (\`~/Library/Application Support/Claude
1618
1487
 
1619
1488
  1. Create a new Custom GPT at https://chat.openai.com/gpts/editor
1620
1489
  2. Go to "Configure" → "Create new action"
1621
- 3. Import OpenAPI schema from: \`https://bitsbound-saas-backend-mxb1.onrender.com/api/v1/mcp/openapi.json\`
1490
+ 3. Import OpenAPI schema from: \`https://bitsbound-contract-backend.onrender.com/api/v1/mcp/openapi.json\`
1622
1491
  4. Set Authentication: API Key, Header name: \`x-api-key\`
1623
1492
  5. Enter your BitsBound API key
1624
1493
 
@@ -1627,7 +1496,7 @@ Add to your Claude Desktop configuration (\`~/Library/Application Support/Claude
1627
1496
  Use the REST API directly with your API key:
1628
1497
 
1629
1498
  \`\`\`bash
1630
- curl -X POST https://bitsbound-saas-backend-mxb1.onrender.com/api/v1/mcp/analyze \\
1499
+ curl -X POST https://bitsbound-contract-backend.onrender.com/api/v1/mcp/analyze \\
1631
1500
  -H "Content-Type: application/json" \\
1632
1501
  -H "x-api-key: sk_live_your_api_key_here" \\
1633
1502
  -d '{
@@ -1717,18 +1586,19 @@ Compare an analyzed contract against a company playbook.
1717
1586
  ## Example Workflow
1718
1587
 
1719
1588
  \`\`\`
1720
- User: "Analyze this Master Service Agreement and tell me the key risks"
1589
+ User: "Analyze this contract and tell me the key risks"
1721
1590
 
1722
1591
  Claude/ChatGPT:
1723
- 1. Calls process_contract with the uploaded DOCX (with Instant Swarm + Email enabled)
1724
- 2. Polls get_analysis_status to watch progress through 8 stages:
1592
+ 1. Identifies the contract type (MSA, M&A, VC term sheet, employment, NDA, etc.)
1593
+ 2. Calls process_contract with the uploaded DOCX (with Instant Swarm + Email enabled)
1594
+ 3. Polls get_analysis_status to watch progress through 8 stages:
1725
1595
  - Loading Context → Extracting Data → Identifying Parties → Researching
1726
1596
  - AI Analysis → Instant Swarm™ → Generating Email → Synthesizing Results
1727
- 3. Reads results showing favorability score (e.g., 42% - Vendor Favorable)
1728
- 4. Identifies top risks: unlimited liability, broad IP assignment, weak SLA
1729
- 5. User can ask follow-up questions via ask_sac (SAC has full contract context)
1730
- 6. Downloads the redlined DOCX with real Track Changes (from Instant Swarm™)
1731
- 7. Reviews the auto-generated negotiation email (from Email Generator)
1597
+ 4. Reads results showing favorability score (e.g., 42% - Vendor Favorable)
1598
+ 5. Identifies top risks based on contract type and activated analyzers
1599
+ 6. User can ask follow-up questions via ask_sac (SAC has full contract context)
1600
+ 7. Downloads the redlined DOCX with real Track Changes (from Instant Swarm™)
1601
+ 8. Reviews the auto-generated negotiation email (from Email Generator)
1732
1602
  \`\`\`
1733
1603
 
1734
1604
  ## Environment Variables