@bitsbound/mcp-server 1.1.1 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,6 +91,14 @@ export type ContractVertical =
91
91
  | 'miscellaneous'; // Unknown/other (AI classifies)
92
92
 
93
93
  export interface AnalyzeContractInput {
94
+ // ════════════════════════════════════════════════════════════════════════════
95
+ // MODE: redline (attack existing contract) vs draft (generate from scratch)
96
+ // ════════════════════════════════════════════════════════════════════════════
97
+ readonly mode?: 'redline' | 'draft'; // Default: 'redline'. Draft mode requires NO file.
98
+
99
+ // ════════════════════════════════════════════════════════════════════════════
100
+ // CONTRACT FILE (REQUIRED for redline mode, IGNORED for draft mode)
101
+ // ════════════════════════════════════════════════════════════════════════════
94
102
  readonly filePath?: string; // RECOMMENDED: Absolute path to DOCX file on disk
95
103
  readonly docxBase64?: string; // Alternative: Base64-encoded DOCX content
96
104
  readonly fileName?: string; // Optional if using filePath (extracted from path)
@@ -227,6 +235,8 @@ export interface CheckDealbreakersInput {
227
235
  export interface AnalyzeContractOutput {
228
236
  readonly analysisId: string;
229
237
  readonly status: 'queued' | 'processing' | 'completed' | 'failed';
238
+ /** T_DRAFT_MODE_2026_01_05: Mode of operation (redline = attack contract, draft = generate from scratch) */
239
+ readonly mode?: 'redline' | 'draft';
230
240
  readonly estimatedTimeMinutes: number;
231
241
  readonly initialRiskSummary?: string;
232
242
  /** ISO timestamp when user should check back (e.g., 25-35 minutes from now) */
@@ -475,21 +485,31 @@ export interface SectionAnalysis {
475
485
 
476
486
  export const TOOL_DEFINITIONS = {
477
487
  // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
478
- // CORE TOOLS - Simplified 3-tool interface for Claude Code Plugin Marketplace
488
+ // CORE TOOLS - 4-tool interface for Claude Code Plugin Marketplace
479
489
  // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
480
490
 
481
- process_contract: {
482
- name: 'process_contract',
483
- description: `Process a contract through BitsBound's full analysis pipeline. Returns partner-level redlined DOCX with Track Changes, negotiation email, and risk analysis.
491
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
492
+ // REDLINE MODE: Attack existing counterparty contract with parallel SAC agents
493
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
494
+ redline_swarm: {
495
+ name: 'redline_swarm',
496
+ description: `**REDLINE MODE** - Attack counterparty's contract with parallel AI agents.
497
+
498
+ 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.
484
499
 
485
500
  **REQUIRED INPUTS (ask the user):**
486
- 1. File path to the DOCX contract
501
+ 1. File path to the counterparty's DOCX contract
487
502
  2. Contract type: saas, ma, vc, employment, nda, equipment, commercial-lease, professional-services, or miscellaneous
488
503
  3. Who you represent: customer/vendor (saas), buyer/seller (ma), investor/founder (vc), etc.
489
504
  4. Aggressiveness level: 1-10 (1=conciliatory, 5=balanced, 10=aggressive)
490
505
 
491
506
  **OPTIONAL:** dealValue, additionalContext, emailRecipient info
492
507
 
508
+ **DELIVERABLES:**
509
+ • Redlined DOCX with real Track Changes (not markup - actual w:ins/w:del)
510
+ • Negotiation email explaining each requested change
511
+ • Favorability score and risk analysis
512
+
493
513
  Analysis takes ~25-35 minutes. Response includes 'checkBackTime' for when to check status.`,
494
514
  inputSchema: {
495
515
  type: 'object',
@@ -561,6 +581,101 @@ Analysis takes ~25-35 minutes. Response includes 'checkBackTime' for when to che
561
581
  }
562
582
  },
563
583
 
584
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
585
+ // DRAFT MODE: Generate contract from scratch with multi-pass AI refinement
586
+ // ────────────────────────────────────────────────────────────────────────────────────────────────────────────────
587
+ power_draft: {
588
+ name: 'power_draft',
589
+ description: `**DRAFT MODE** - Generate a complete contract from scratch.
590
+
591
+ NO FILE UPLOAD NEEDED. Provide deal context and BitsBound generates a partner-level contract using a multi-pass architecture:
592
+ 1. Opus 4.5 generates initial draft based on your requirements
593
+ 2. 16+ parallel analyzers critique the draft
594
+ 3. Sonnet 4.5 synthesizes analyzer feedback
595
+ 4. Opus 4.5 generates refined second draft
596
+ 5. Final QB Enhancer pass for consistency
597
+
598
+ **REQUIRED INPUTS (ask the user):**
599
+ 1. Contract type: saas, ma, vc, employment, nda, equipment-lease, commercial-lease, professional-services
600
+ 2. Who you represent: customer/vendor (saas), buyer/seller (ma), investor/founder (vc), etc.
601
+ 3. Terms Favorability: 1-10 (1=minimal protections/fast close, 5=balanced, 10=maximum protections/bulletproof)
602
+
603
+ **RECOMMENDED:** Additional context describing the deal (value, term, key requirements, counterparty info)
604
+
605
+ **DELIVERABLES:**
606
+ • Clean DOCX ready for negotiation (no Track Changes needed - it's your paper)
607
+ • Cover email introducing the draft (optional)
608
+ • Risk analysis of your own positions
609
+
610
+ Draft generation takes ~30-40 minutes. Response includes 'checkBackTime' for when to check status.`,
611
+ inputSchema: {
612
+ type: 'object',
613
+ properties: {
614
+ // ════════════════════════════════════════════════════════════════════════════
615
+ // REQUIRED - Core Draft Parameters (matches UI)
616
+ // ════════════════════════════════════════════════════════════════════════════
617
+ contractVertical: {
618
+ type: 'string',
619
+ enum: ['saas', 'ma', 'vc', 'employment', 'nda', 'equipment-lease', 'equipment-financing', 'security-agreement', 'loan', 'commercial-lease', 'professional-services'],
620
+ description: 'Contract type to generate. REQUIRED.'
621
+ },
622
+ representingParty: {
623
+ type: 'string',
624
+ 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)'
625
+ },
626
+ aggressivenessLevel: {
627
+ type: 'number',
628
+ minimum: 1,
629
+ maximum: 10,
630
+ description: 'Terms Favorability 1-10: How protective for YOUR party. 1=minimal protections (fast close), 5=balanced (default), 10=maximum protections (bulletproof). REQUIRED.'
631
+ },
632
+
633
+ // ════════════════════════════════════════════════════════════════════════════
634
+ // OPTIONAL - Deal Context (highly recommended for better output)
635
+ // ════════════════════════════════════════════════════════════════════════════
636
+ dealValue: {
637
+ type: 'number',
638
+ description: 'Annual Contract Value for risk calibration. Optional but recommended.'
639
+ },
640
+ dealValueCurrency: {
641
+ type: 'string',
642
+ enum: ['USD', 'EUR', 'GBP', 'CAD', 'AUD'],
643
+ description: 'Currency for deal value. Default: USD'
644
+ },
645
+ additionalContext: {
646
+ type: 'string',
647
+ 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..."'
648
+ },
649
+
650
+ // ════════════════════════════════════════════════════════════════════════════
651
+ // OPTIONAL - Playbook & Email Settings
652
+ // ════════════════════════════════════════════════════════════════════════════
653
+ playbookId: {
654
+ type: 'string',
655
+ description: 'Playbook ID for firm-specific rules. Optional - uses BitsBound Foundational (117 rules) by default.'
656
+ },
657
+ enableEmailGenerator: {
658
+ type: 'boolean',
659
+ description: 'Generate cover email introducing the draft? Default: true'
660
+ },
661
+ emailContext: {
662
+ type: 'object',
663
+ description: 'Cover email context',
664
+ properties: {
665
+ recipientName: { type: 'string', description: 'Name of email recipient' },
666
+ senderName: { type: 'string', description: 'Your name (the sender)' },
667
+ additionalContext: { type: 'string', description: 'Tone, relationship notes, etc.' }
668
+ }
669
+ }
670
+ },
671
+ required: ['contractVertical', 'representingParty', 'aggressivenessLevel']
672
+ },
673
+ annotations: {
674
+ readOnlyHint: false,
675
+ destructiveHint: false
676
+ }
677
+ },
678
+
564
679
  get_analysis_status: {
565
680
  name: 'get_analysis_status',
566
681
  description: `Check analysis progress. When complete, returns:
@@ -574,7 +689,7 @@ ALWAYS display download URLs as clickable links when analysis completes.`,
574
689
  properties: {
575
690
  analysisId: {
576
691
  type: 'string',
577
- description: 'Analysis ID from process_contract'
692
+ description: 'Analysis ID from redline_swarm or power_draft'
578
693
  }
579
694
  },
580
695
  required: ['analysisId']
@@ -650,21 +765,26 @@ export const RESOURCE_DEFINITIONS = {
650
765
  */
651
766
  export const PROMPT_DEFINITIONS = {
652
767
  // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
653
- // CORE PROMPTS - Simplified 2-prompt interface matching 3-tool architecture
768
+ // CORE PROMPTS - 3-prompt interface matching 4-tool architecture
654
769
  // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
655
770
 
656
- process_contract: {
657
- name: 'process_contract',
658
- description: 'Analyze Contract - Upload a DOCX and get partner-level redlines with Track Changes, risk analysis, and a negotiation email',
771
+ redline_swarm: {
772
+ name: 'redline_swarm',
773
+ description: 'Redline Mode - Upload counterparty\'s DOCX and get partner-level redlines with real Track Changes, risk analysis, and negotiation email',
774
+ arguments: []
775
+ },
776
+ power_draft: {
777
+ name: 'power_draft',
778
+ description: 'Draft Mode - Generate a complete contract from scratch with multi-pass AI refinement (Opus 4.5 drafts → Analyzers critique → Opus 4.5 refines)',
659
779
  arguments: []
660
780
  },
661
781
  check_analysis: {
662
782
  name: 'check_analysis',
663
- description: 'Check Analysis Status - Check progress or download results from a running/completed analysis',
783
+ description: 'Check Analysis Status - Check progress or download results from a running/completed redline or draft',
664
784
  arguments: [
665
785
  {
666
786
  name: 'analysisId',
667
- description: 'The analysis ID from process_contract',
787
+ description: 'The analysis ID from redline_swarm or power_draft',
668
788
  required: true
669
789
  }
670
790
  ]
@@ -680,49 +800,111 @@ export type PromptName = keyof typeof PROMPT_DEFINITIONS;
680
800
  */
681
801
  export const PROMPT_MESSAGES: Record<PromptName, { role: 'user'; content: { type: 'text'; text: string } }[]> = {
682
802
  // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
683
- // CORE PROMPT MESSAGES - Simplified to match 3-tool architecture
803
+ // CORE PROMPT MESSAGES - Matches 4-tool architecture (redline_swarm, power_draft, get_analysis_status, download_file)
684
804
  // ════════════════════════════════════════════════════════════════════════════════════════════════════════════════
685
805
 
686
- process_contract: [
806
+ redline_swarm: [
687
807
  {
688
808
  role: 'user',
689
- content: { type: 'text', text: `I want to analyze a contract using BitsBound.
809
+ content: { type: 'text', text: `I want to analyze and redline a counterparty's contract using BitsBound's REDLINE MODE.
690
810
 
691
811
  Please help me by gathering this information:
692
812
 
693
- 1. CONTRACT TYPE:
694
- - saas, ma, vc, employment, nda, equipment, commercial-lease, professional-services, or miscellaneous
695
-
696
- 2. CONTRACT FILE:
813
+ 1. CONTRACT FILE:
697
814
  - File path (e.g., /Users/john/Documents/contract.docx) - preferred
698
815
  - Or upload the DOCX directly
699
816
 
817
+ 2. CONTRACT TYPE:
818
+ - saas, ma, vc, employment, nda, equipment, commercial-lease, professional-services, or miscellaneous
819
+
700
820
  3. WHO I REPRESENT:
701
821
  - saas: customer or vendor
702
822
  - ma: buyer or seller
703
823
  - vc: investor or founder
824
+ - employment: employer or employee
825
+ - nda: disclosing-party or receiving-party
704
826
  - (etc. based on contract type)
705
827
 
706
828
  4. AGGRESSIVENESS (1-10):
707
829
  - 1 = very conciliatory, 5 = balanced, 10 = very aggressive
708
830
 
709
- Then call the 'process_contract' tool. Analysis takes ~25-35 minutes.
710
- The response includes 'checkBackTime' - tell me when to check back.
831
+ Then call the 'redline_swarm' tool. Instant Swarm™ deploys parallel AI agents to attack every section.
832
+ Analysis takes ~25-35 minutes. Response includes 'checkBackTime' - tell me when to check back.
833
+ Do NOT poll automatically - wait for me to ask.` }
834
+ }
835
+ ],
836
+ power_draft: [
837
+ {
838
+ role: 'user',
839
+ content: { type: 'text', text: `I want to generate a NEW CONTRACT from scratch using BitsBound's DRAFT MODE.
840
+
841
+ NO FILE UPLOAD NEEDED - just provide deal context.
842
+
843
+ Please help me by gathering this information:
844
+
845
+ **REQUIRED:**
846
+
847
+ 1. CONTRACT TYPE:
848
+ - saas (SaaS/Software Agreement)
849
+ - ma (M&A - APA, SPA, Merger)
850
+ - vc (VC - SAFE, Term Sheet, Series A/B/C)
851
+ - employment (Offer Letter, Employment Agreement)
852
+ - nda (Mutual or Unilateral NDA)
853
+ - equipment-lease (Equipment Lease)
854
+ - commercial-lease (Commercial Real Estate Lease)
855
+ - professional-services (SOW, Consulting Agreement)
856
+
857
+ 2. WHO YOU REPRESENT:
858
+ - saas: customer or vendor
859
+ - ma: buyer or seller
860
+ - vc: investor or founder
861
+ - employment: employer or employee
862
+ - nda: disclosing-party or receiving-party
863
+ - equipment-lease: lessee or lessor
864
+ - commercial-lease: tenant or landlord
865
+ - professional-services: client or service-provider
866
+
867
+ 3. TERMS FAVORABILITY (1-10):
868
+ - 1 = minimal protections (fast close)
869
+ - 5 = balanced (default)
870
+ - 10 = maximum protections (bulletproof)
871
+
872
+ **HIGHLY RECOMMENDED - Additional Context:**
873
+ The more context you provide, the better the AI can tailor the contract:
874
+ - Party names (your company, counterparty)
875
+ - Deal value (e.g., $500K/year)
876
+ - Term length (e.g., 3-year term)
877
+ - Key requirements (e.g., "strong IP protections", "robust termination rights")
878
+ - Counterparty info (e.g., "startup", "Fortune 500")
879
+ - Any special provisions needed
880
+
881
+ **OPTIONAL:**
882
+ - Annual Contract Value (for risk calibration)
883
+ - Generate cover email? (default: yes)
884
+
885
+ Then call the 'power_draft' tool. Multi-pass AI architecture:
886
+ 1. Opus 4.5 generates initial draft
887
+ 2. 16+ parallel analyzers critique the draft
888
+ 3. Sonnet 4.5 synthesizes feedback
889
+ 4. Opus 4.5 generates refined second draft
890
+ 5. QB Enhancer finalizes for consistency
891
+
892
+ Draft generation takes ~30-40 minutes. Response includes 'checkBackTime'.
711
893
  Do NOT poll automatically - wait for me to ask.` }
712
894
  }
713
895
  ],
714
896
  check_analysis: [
715
897
  {
716
898
  role: 'user',
717
- content: { type: 'text', text: `I want to check on a contract analysis.
899
+ content: { type: 'text', text: `I want to check on a contract analysis or draft generation.
718
900
 
719
901
  Analysis ID: {analysisId}
720
902
 
721
903
  Please use 'get_analysis_status' and show me:
722
904
  - Current progress percentage
723
905
  - If complete, provide:
724
- * CLICKABLE download link for the redlined DOCX
725
- * Negotiation email content
906
+ * CLICKABLE download link for the DOCX (redlined or clean draft)
907
+ * Negotiation/cover email content
726
908
  * Favorability score
727
909
  * Top risks
728
910
  * Negotiation priorities