@lovie-ai/formation-mcp-server 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/mcp/errors.d.ts +15 -8
  2. package/dist/mcp/errors.d.ts.map +1 -1
  3. package/dist/mcp/errors.js.map +1 -1
  4. package/dist/mcp/index.d.ts +1 -0
  5. package/dist/mcp/index.d.ts.map +1 -1
  6. package/dist/mcp/index.js +12 -1
  7. package/dist/mcp/index.js.map +1 -1
  8. package/dist/mcp/middleware/session.d.ts +5 -6
  9. package/dist/mcp/middleware/session.d.ts.map +1 -1
  10. package/dist/mcp/middleware/session.js +70 -91
  11. package/dist/mcp/middleware/session.js.map +1 -1
  12. package/dist/mcp/resources/index.d.ts +6 -0
  13. package/dist/mcp/resources/index.d.ts.map +1 -0
  14. package/dist/mcp/resources/index.js +388 -0
  15. package/dist/mcp/resources/index.js.map +1 -0
  16. package/dist/mcp/server.d.ts.map +1 -1
  17. package/dist/mcp/server.js +24 -0
  18. package/dist/mcp/server.js.map +1 -1
  19. package/dist/mcp/state/FormationSessionStore.d.ts +3 -9
  20. package/dist/mcp/state/FormationSessionStore.d.ts.map +1 -1
  21. package/dist/mcp/state/FormationSessionStore.js +39 -122
  22. package/dist/mcp/state/FormationSessionStore.js.map +1 -1
  23. package/dist/mcp/state/types.d.ts +16 -20
  24. package/dist/mcp/state/types.d.ts.map +1 -1
  25. package/dist/mcp/state/types.js +5 -5
  26. package/dist/mcp/state/types.js.map +1 -1
  27. package/dist/mcp/tools/certificate.d.ts +3 -4
  28. package/dist/mcp/tools/certificate.d.ts.map +1 -1
  29. package/dist/mcp/tools/certificate.js +9 -9
  30. package/dist/mcp/tools/certificate.js.map +1 -1
  31. package/dist/mcp/tools/company.d.ts +6 -7
  32. package/dist/mcp/tools/company.d.ts.map +1 -1
  33. package/dist/mcp/tools/company.js +10 -15
  34. package/dist/mcp/tools/company.js.map +1 -1
  35. package/dist/mcp/tools/index.d.ts +13 -5
  36. package/dist/mcp/tools/index.d.ts.map +1 -1
  37. package/dist/mcp/tools/index.js.map +1 -1
  38. package/dist/mcp/tools/session.d.ts +4 -5
  39. package/dist/mcp/tools/session.d.ts.map +1 -1
  40. package/dist/mcp/tools/session.js +6 -9
  41. package/dist/mcp/tools/session.js.map +1 -1
  42. package/dist/mcp/tools/stakeholders.d.ts +5 -6
  43. package/dist/mcp/tools/stakeholders.d.ts.map +1 -1
  44. package/dist/mcp/tools/stakeholders.js +8 -12
  45. package/dist/mcp/tools/stakeholders.js.map +1 -1
  46. package/dist/mcp/tools/sync.d.ts +2 -3
  47. package/dist/mcp/tools/sync.d.ts.map +1 -1
  48. package/dist/mcp/tools/sync.js +14 -35
  49. package/dist/mcp/tools/sync.js.map +1 -1
  50. package/dist/mcp/validation.d.ts +4 -4
  51. package/dist/mcp/validation.d.ts.map +1 -1
  52. package/dist/mcp/validation.js.map +1 -1
  53. package/package.json +1 -1
@@ -0,0 +1,388 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESOURCE_CONTENT = exports.FORMATION_RESOURCES = void 0;
4
+ exports.getResourceContent = getResourceContent;
5
+ exports.getAllResources = getAllResources;
6
+ // Resource definitions
7
+ exports.FORMATION_RESOURCES = [
8
+ {
9
+ uri: 'formation://guide',
10
+ name: 'Formation Guide',
11
+ description: 'Step-by-step guide for Delaware company formation process',
12
+ mimeType: 'text/markdown',
13
+ },
14
+ {
15
+ uri: 'formation://pricing',
16
+ name: 'Pricing Information',
17
+ description: 'Delaware filing fees and service costs',
18
+ mimeType: 'text/markdown',
19
+ },
20
+ {
21
+ uri: 'formation://company-types',
22
+ name: 'Company Types',
23
+ description: 'Detailed comparison of LLC, C-Corp, and S-Corp',
24
+ mimeType: 'text/markdown',
25
+ },
26
+ {
27
+ uri: 'formation://faq',
28
+ name: 'FAQ',
29
+ description: 'Frequently asked questions about company formation',
30
+ mimeType: 'text/markdown',
31
+ },
32
+ {
33
+ uri: 'formation://requirements',
34
+ name: 'Requirements',
35
+ description: 'Required information for Delaware company formation',
36
+ mimeType: 'text/markdown',
37
+ },
38
+ ];
39
+ // Resource content - EDIT THIS CONTENT TO CUSTOMIZE YOUR MCP
40
+ exports.RESOURCE_CONTENT = {
41
+ 'formation://guide': `# Lovie - Delaware Company Formation Guide
42
+
43
+ ## Overview
44
+ Lovie helps you form a Delaware company step-by-step, completely free. The process takes about 3-5 minutes to complete.
45
+
46
+ **What you get with Lovie:**
47
+ - Free company formation (no service fees)
48
+ - Lovie as your incorporator
49
+ - All legally compliant documents
50
+ - In-house legal team working every day to keep you compliant
51
+ - Step-by-step compliance guide
52
+ - Help with business address and banking
53
+
54
+ ## Steps
55
+
56
+ ### 1. Start a Session
57
+ Call \`formation_start\` to begin. You'll receive a session ID to use for all subsequent calls.
58
+
59
+ ### 2. Select State
60
+ Call \`formation_set_state\` with state "DE" (Delaware is currently the only supported state).
61
+
62
+ ### 3. Choose Company Type
63
+ Call \`formation_set_company_type\` with one of:
64
+ - **LLC** - Limited Liability Company (simplest, most flexible)
65
+ - **C-Corp** - C Corporation (best for raising investment)
66
+ - **S-Corp** - S Corporation (tax advantages for small businesses)
67
+
68
+ ### 4. Select Entity Ending
69
+ Call \`formation_set_entity_ending\` to choose your company's legal suffix:
70
+ - LLC: "LLC", "L.L.C.", "Limited Liability Company"
71
+ - Corp: "Inc.", "Incorporated", "Corp.", "Corporation"
72
+
73
+ ### 5. Set Company Name
74
+ Call \`formation_set_company_name\` with your desired company name (without the ending).
75
+
76
+ ### 6. Check Name Availability (Optional)
77
+ Call \`formation_check_name\` to verify the name is available with Delaware Secretary of State.
78
+
79
+ ### 7. Set Registered Agent
80
+ Call \`formation_set_registered_agent\` with agent details. A registered agent is required in Delaware.
81
+
82
+ ### 8. Set Share Structure (Corps only)
83
+ For C-Corp or S-Corp, call \`formation_set_share_structure\` to define authorized shares and par value.
84
+
85
+ ### 9. Add Shareholders/Members
86
+ Call \`formation_add_shareholder\` for each owner. Total ownership must not exceed 100%.
87
+
88
+ ### 10. Set Authorized Party
89
+ Call \`formation_set_authorized_party\` - this person signs the formation documents.
90
+
91
+ ### 11. Generate Certificate
92
+ Call \`formation_generate_certificate\` to create the Certificate of Incorporation PDF.
93
+
94
+ ### 12. Review and Approve
95
+ Review the PDF at the provided URL, then call \`formation_approve_certificate\` to complete.
96
+
97
+ ## Tips
98
+ - Use \`formation_get_status\` anytime to see current progress
99
+ - Use \`formation_resume\` to get guidance on the next step
100
+ - Sessions expire after 24 hours
101
+ `,
102
+ 'formation://pricing': `# Lovie Formation Pricing
103
+
104
+ ## Lovie Service Fee
105
+ **FREE** - We don't charge you for company formation. Lovie handles everything at no cost to you.
106
+
107
+ ## What's Included (Free)
108
+ - Company formation filing
109
+ - Lovie as your incorporator
110
+ - All legally compliant documents
111
+ - Certificate of Formation/Incorporation
112
+ - Operating Agreement (LLC) or Bylaws (Corp)
113
+ - Step-by-step compliance guide
114
+ - Ongoing compliance reminders
115
+ - **In-house legal team** working every day to keep you compliant with local and federal law
116
+
117
+ ## State Filing Fees (Paid to Delaware)
118
+ These are government fees that go directly to Delaware:
119
+
120
+ ### LLC
121
+ - **Standard Filing**: $90
122
+ - **Same-Day Filing**: +$100
123
+ - **24-Hour Filing**: +$50
124
+
125
+ ### Corporation (C-Corp / S-Corp)
126
+ - **Standard Filing**: $89 (minimum)
127
+ - **Same-Day Filing**: +$100
128
+ - **24-Hour Filing**: +$50
129
+
130
+ ## Annual Fees (Delaware Requirements)
131
+
132
+ ### LLC
133
+ - **Annual Tax**: $300 (due June 1st each year)
134
+
135
+ ### Corporation
136
+ - **Franchise Tax**: Minimum $175/year
137
+ - **Annual Report Fee**: $50/year
138
+
139
+ ## Additional Lovie Services
140
+
141
+ ### Business Address
142
+ - **Virtual Address**: Available through Lovie
143
+ - **Physical Address**: Available through Lovie
144
+
145
+ ### Banking
146
+ - **Business Bank Account**: Lovie helps you open and manage your company bank account
147
+
148
+ ### Lovie Financial Platform
149
+ - AI-first generative UI for all your financial needs
150
+ - Token-based pricing (a little more than free)
151
+ - Expense tracking, invoicing, payments, and more
152
+ `,
153
+ 'formation://company-types': `# Company Types Comparison
154
+
155
+ ## LLC (Limited Liability Company)
156
+
157
+ ### Best For
158
+ - Small businesses and startups
159
+ - Solo entrepreneurs
160
+ - Real estate holdings
161
+ - Consulting businesses
162
+
163
+ ### Advantages
164
+ - Simple formation and maintenance
165
+ - Flexible management structure
166
+ - Pass-through taxation (no double taxation)
167
+ - Limited liability protection
168
+ - No ownership restrictions
169
+
170
+ ### Disadvantages
171
+ - Cannot issue stock
172
+ - Less attractive to venture capital investors
173
+ - Self-employment taxes on profits
174
+
175
+ ---
176
+
177
+ ## C-Corporation
178
+
179
+ ### Best For
180
+ - Startups seeking venture capital
181
+ - Companies planning to go public
182
+ - Businesses with many shareholders
183
+ - International expansion
184
+
185
+ ### Advantages
186
+ - Can issue multiple classes of stock
187
+ - Attractive to investors
188
+ - Unlimited growth potential
189
+ - Employee stock options
190
+ - Perpetual existence
191
+
192
+ ### Disadvantages
193
+ - Double taxation (corporate + dividend)
194
+ - More complex compliance requirements
195
+ - Board of directors required
196
+ - Formal meeting requirements
197
+
198
+ ---
199
+
200
+ ## S-Corporation
201
+
202
+ ### Best For
203
+ - Small businesses wanting corporate structure
204
+ - Companies with fewer than 100 shareholders
205
+ - Businesses seeking tax advantages
206
+
207
+ ### Advantages
208
+ - Pass-through taxation
209
+ - Limited liability protection
210
+ - Can pay reasonable salary (saves self-employment tax)
211
+ - Corporate structure and credibility
212
+
213
+ ### Disadvantages
214
+ - Limited to 100 shareholders
215
+ - Only US citizens/residents can be shareholders
216
+ - One class of stock only
217
+ - Strict eligibility requirements
218
+ - Must elect S-Corp status with IRS
219
+ `,
220
+ 'formation://faq': `# Frequently Asked Questions
221
+
222
+ ## About Lovie
223
+
224
+ ### What is Lovie?
225
+ Lovie is an AI-first financial platform that helps you start and run your business. We provide free company formation, compliance tools, banking assistance, and a complete financial management platform.
226
+
227
+ ### How much does Lovie charge for formation?
228
+ **Nothing!** Lovie's formation service is completely free. You only pay the state filing fees that go directly to Delaware.
229
+
230
+ ### What makes Lovie different?
231
+ - **Free formation**: No service fees
232
+ - **Lovie as incorporator**: We handle all the paperwork
233
+ - **In-house legal team**: Our legal experts work every day to keep you compliant
234
+ - **Compliance included**: Legal documents and ongoing compliance guides
235
+ - **AI-first platform**: Generative UI for all your financial needs
236
+ - **Token-based pricing**: Our financial platform is almost free
237
+
238
+ ---
239
+
240
+ ## General Questions
241
+
242
+ ### Why Delaware?
243
+ Delaware is the most popular state for incorporation because:
244
+ - Business-friendly laws and Court of Chancery
245
+ - Privacy protection (no public disclosure of officers/directors)
246
+ - No state income tax for companies operating outside Delaware
247
+ - Well-established corporate law precedents
248
+ - Fast filing times
249
+
250
+ ### How long does formation take?
251
+ - **Standard**: 3-5 business days
252
+ - **24-Hour**: Next business day
253
+ - **Same-Day**: Same business day
254
+
255
+ ### Do I need to live in Delaware?
256
+ No. You can form a Delaware company from anywhere in the world. Lovie provides registered agent services in Delaware.
257
+
258
+ ---
259
+
260
+ ## Lovie Services
261
+
262
+ ### Can Lovie help with a business address?
263
+ Yes! Lovie offers both virtual and physical business addresses.
264
+
265
+ ### Can Lovie help open a bank account?
266
+ Yes! Lovie helps you open and manage your company bank account, integrated with our financial platform.
267
+
268
+ ### What is Lovie's financial platform?
269
+ An AI-first generative UI platform for:
270
+ - Expense tracking
271
+ - Invoicing
272
+ - Payments
273
+ - Financial reporting
274
+ - Compliance management
275
+ - And more...
276
+
277
+ All with token-based pricing (a little more than free).
278
+
279
+ ---
280
+
281
+ ## LLC Questions
282
+
283
+ ### What is an Operating Agreement?
284
+ A document that outlines ownership, management structure, and operating procedures. Lovie provides this document for free.
285
+
286
+ ### Can a single person form an LLC?
287
+ Yes. Delaware allows single-member LLCs.
288
+
289
+ ---
290
+
291
+ ## Corporation Questions
292
+
293
+ ### What's the difference between authorized and issued shares?
294
+ - **Authorized shares**: Maximum shares the company CAN issue
295
+ - **Issued shares**: Shares actually given to shareholders
296
+
297
+ ### What is par value?
298
+ The minimum price at which shares can be issued. Most startups use $0.0001 per share.
299
+
300
+ ### How many shares should I authorize?
301
+ Common practice: 10,000,000 shares at $0.0001 par value.
302
+
303
+ ---
304
+
305
+ ## After Formation
306
+
307
+ ### What do I need to do after forming my company?
308
+ Lovie guides you through everything:
309
+ 1. Obtain an EIN from the IRS
310
+ 2. Open a business bank account (Lovie helps!)
311
+ 3. Set up your Operating Agreement or Bylaws (provided by Lovie)
312
+ 4. Issue stock certificates (Corp)
313
+ 5. File beneficial ownership report with FinCEN
314
+ 6. Stay compliant with Lovie's compliance reminders
315
+ `,
316
+ 'formation://requirements': `# Lovie Formation Requirements
317
+
318
+ ## What You Need to Provide
319
+
320
+ ### Company Details
321
+ - **Company Name**: Must be unique in Delaware
322
+ - **Company Type**: LLC, C-Corp, or S-Corp
323
+ - **Entity Ending**: Legal suffix (LLC, Inc., Corp., etc.)
324
+
325
+ ### Registered Agent
326
+ Lovie can serve as your registered agent, or you can specify:
327
+ - **Name**: Individual or company name
328
+ - **Physical Address**: Must be in Delaware
329
+ - **Email**: For correspondence
330
+ - **Phone**: Contact number
331
+
332
+ ### Share Structure (Corporations Only)
333
+ - **Authorized Shares**: Number of shares the company can issue
334
+ - **Par Value**: Minimum price per share (e.g., $0.0001)
335
+
336
+ ### Shareholders/Members
337
+ For each owner:
338
+ - **Full Name**: Legal name
339
+ - **Email Address**: Valid email
340
+ - **Ownership Percentage**: Share of the company
341
+ - **Address**: Mailing address (optional but recommended)
342
+
343
+ ### Authorized Party
344
+ Lovie will be your incorporator. We handle the signing and filing.
345
+
346
+ ---
347
+
348
+ ## Name Requirements
349
+
350
+ ### Delaware Name Rules
351
+ - Must be distinguishable from existing Delaware entities
352
+ - Must include proper entity ending
353
+ - Cannot imply government affiliation
354
+ - Cannot include restricted words without approval
355
+
356
+ ### Restricted Words (Require Approval)
357
+ - Bank, Banking, Banker
358
+ - Insurance, Assurance
359
+ - Trust, Trustee
360
+ - University, College
361
+
362
+ ---
363
+
364
+ ## What Lovie Provides (Free)
365
+
366
+ ### Documents Included
367
+ 1. **Certificate of Formation/Incorporation**: Official document from Delaware
368
+ 2. **Operating Agreement** (LLC) or **Bylaws** (Corp)
369
+ 3. **Stock Certificates** (Corp)
370
+ 4. **Compliance Calendar**: Reminders for annual filings and taxes
371
+
372
+ ### After Formation Support
373
+ - EIN application guidance
374
+ - Bank account setup assistance
375
+ - Ongoing compliance reminders
376
+ - In-house legal team keeping you compliant with local and federal law
377
+ - Access to Lovie's AI-first financial platform
378
+ `,
379
+ };
380
+ // Get resource content by URI
381
+ function getResourceContent(uri) {
382
+ return exports.RESOURCE_CONTENT[uri] || null;
383
+ }
384
+ // List all available resources
385
+ function getAllResources() {
386
+ return exports.FORMATION_RESOURCES;
387
+ }
388
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/resources/index.ts"],"names":[],"mappings":";;;AA+XA,gDAEC;AAGD,0CAEC;AApYD,uBAAuB;AACV,QAAA,mBAAmB,GAAe;IAC7C;QACE,GAAG,EAAE,mBAAmB;QACxB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,2DAA2D;QACxE,QAAQ,EAAE,eAAe;KAC1B;IACD;QACE,GAAG,EAAE,qBAAqB;QAC1B,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,wCAAwC;QACrD,QAAQ,EAAE,eAAe;KAC1B;IACD;QACE,GAAG,EAAE,2BAA2B;QAChC,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,gDAAgD;QAC7D,QAAQ,EAAE,eAAe;KAC1B;IACD;QACE,GAAG,EAAE,iBAAiB;QACtB,IAAI,EAAE,KAAK;QACX,WAAW,EAAE,oDAAoD;QACjE,QAAQ,EAAE,eAAe;KAC1B;IACD;QACE,GAAG,EAAE,0BAA0B;QAC/B,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,qDAAqD;QAClE,QAAQ,EAAE,eAAe;KAC1B;CACF,CAAC;AAEF,6DAA6D;AAChD,QAAA,gBAAgB,GAA2B;IACtD,mBAAmB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DtB;IAEC,qBAAqB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDxB;IAEC,2BAA2B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkE9B;IAEC,iBAAiB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FpB;IAEC,0BAA0B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8D7B;CACA,CAAC;AAEF,8BAA8B;AAC9B,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,OAAO,wBAAgB,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;AACvC,CAAC;AAED,+BAA+B;AAC/B,SAAgB,eAAe;IAC7B,OAAO,2BAAmB,CAAC;AAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AASnE,wBAAgB,eAAe,IAAI,MAAM,CAuDxC;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBtD"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAOnE,wBAAgB,eAAe,IAAI,MAAM,CAkFxC;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBtD"}
@@ -7,6 +7,7 @@ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
7
7
  const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
8
8
  const index_1 = require("./tools/index");
9
9
  const FormationSessionStore_1 = require("./state/FormationSessionStore");
10
+ const index_2 = require("./resources/index");
10
11
  function createMCPServer() {
11
12
  const server = new index_js_1.Server({
12
13
  name: 'lovie-formation',
@@ -14,6 +15,7 @@ function createMCPServer() {
14
15
  }, {
15
16
  capabilities: {
16
17
  tools: {},
18
+ resources: {},
17
19
  },
18
20
  });
19
21
  // Initialize session store
@@ -23,6 +25,28 @@ function createMCPServer() {
23
25
  const tools = (0, index_1.getAllTools)();
24
26
  return { tools };
25
27
  });
28
+ // List available resources
29
+ server.setRequestHandler(types_js_1.ListResourcesRequestSchema, async () => {
30
+ const resources = (0, index_2.getAllResources)();
31
+ return { resources };
32
+ });
33
+ // Read resource content
34
+ server.setRequestHandler(types_js_1.ReadResourceRequestSchema, async (request) => {
35
+ const { uri } = request.params;
36
+ const content = (0, index_2.getResourceContent)(uri);
37
+ if (!content) {
38
+ throw new Error(`Resource not found: ${uri}`);
39
+ }
40
+ return {
41
+ contents: [
42
+ {
43
+ uri,
44
+ mimeType: 'text/markdown',
45
+ text: content,
46
+ },
47
+ ],
48
+ };
49
+ });
26
50
  // Handle tool calls
27
51
  server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
28
52
  const { name, arguments: args } = request.params;
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";;AASA,0CAuDC;AAED,4CAgBC;AAlFD,wEAAmE;AACnE,wEAAiF;AACjF,iEAG4C;AAC5C,yCAA4D;AAC5D,yEAAgE;AAEhE,SAAgB,eAAe;IAC7B,MAAM,MAAM,GAAG,IAAI,i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K,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YAC9E,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;4BACnB,KAAK,EAAE,IAAI;4BACX,IAAI,EAAE,YAAY;4BAClB,OAAO,EAAE,YAAY;yBACtB,EAAE,IAAI,EAAE,CAAC,CAAC;qBACZ;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAEM,KAAK,UAAU,gBAAgB;IACpC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,2BAA2B;IAC3B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;QAC9B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,17 +1,11 @@
1
1
  import { FormationSession } from './types';
2
2
  export declare class FormationSessionStore {
3
- private cache;
4
- private storageDir;
5
- private sessionExpiryDays;
6
- constructor(storageDir?: string, sessionExpiryDays?: number);
7
- private getFilePath;
8
- ensureStorageDir(): Promise<void>;
9
3
  create(): Promise<FormationSession>;
10
4
  get(sessionId: string): Promise<FormationSession | null>;
11
5
  save(session: FormationSession): Promise<void>;
12
- delete(sessionId: string): Promise<void>;
13
- list(): Promise<string[]>;
14
- private isExpired;
6
+ delete(sessionId: string): Promise<boolean>;
7
+ list(): Promise<FormationSession[]>;
8
+ cleanup(): Promise<number>;
15
9
  }
16
10
  export declare function getSessionStore(): FormationSessionStore;
17
11
  //# sourceMappingURL=FormationSessionStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormationSessionStore.d.ts","sourceRoot":"","sources":["../../../src/mcp/state/FormationSessionStore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAgC,MAAM,SAAS,CAAC;AAGzE,qBAAa,qBAAqB;IAChC,OAAO,CAAC,KAAK,CAA4C;IACzD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,iBAAiB,CAAS;gBAEtB,UAAU,CAAC,EAAE,MAAM,EAAE,iBAAiB,GAAE,MAAU;IAK9D,OAAO,CAAC,WAAW;IAIb,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIjC,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAmBnC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAgCxD,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB9C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYxC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAQ/B,OAAO,CAAC,SAAS;CAIlB;AAKD,wBAAgB,eAAe,IAAI,qBAAqB,CAKvD"}
1
+ {"version":3,"file":"FormationSessionStore.d.ts","sourceRoot":"","sources":["../../../src/mcp/state/FormationSessionStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAgC,MAAM,SAAS,CAAC;AASzE,qBAAa,qBAAqB;IAE1B,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAiBnC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAKxD,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK3C,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAKnC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;CAajC;AAKD,wBAAgB,eAAe,IAAI,qBAAqB,CAKvD"}
@@ -1,150 +1,67 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.FormationSessionStore = void 0;
37
4
  exports.getSessionStore = getSessionStore;
38
- const fs_1 = require("fs");
39
- const path = __importStar(require("path"));
40
- const types_1 = require("./types");
41
5
  const uuid_1 = require("uuid");
6
+ const types_1 = require("./types");
7
+ // In-memory session store (for development/testing)
8
+ // In production, this would use Redis or a database
9
+ const sessions = new Map();
10
+ // Session TTL in milliseconds (24 hours)
11
+ const SESSION_TTL_MS = 24 * 60 * 60 * 1000;
42
12
  class FormationSessionStore {
43
- constructor(storageDir, sessionExpiryDays = 7) {
44
- this.cache = new Map();
45
- this.storageDir = storageDir || process.env.MCP_SESSION_DIR || './data/sessions';
46
- this.sessionExpiryDays = sessionExpiryDays;
47
- }
48
- getFilePath(sessionId) {
49
- return path.join(this.storageDir, `${sessionId}.json`);
50
- }
51
- async ensureStorageDir() {
52
- await fs_1.promises.mkdir(this.storageDir, { recursive: true });
53
- }
13
+ // Create a new session
54
14
  async create() {
55
- const sessionId = (0, uuid_1.v4)();
56
- const now = new Date().toISOString();
57
- const expiresAt = new Date(Date.now() + this.sessionExpiryDays * 24 * 60 * 60 * 1000).toISOString();
15
+ const now = new Date();
58
16
  const session = {
59
- sessionId,
60
- currentStep: types_1.FormationStep.CREATED,
17
+ sessionId: (0, uuid_1.v4)(),
61
18
  status: types_1.SessionStatus.CREATED,
62
- createdAt: now,
63
- updatedAt: now,
64
- expiresAt,
65
- shareholders: []
19
+ currentStep: types_1.FormationStep.CREATED,
20
+ shareholders: [],
21
+ createdAt: now.toISOString(),
22
+ updatedAt: now.toISOString(),
23
+ expiresAt: new Date(now.getTime() + SESSION_TTL_MS).toISOString(),
66
24
  };
67
- await this.save(session);
25
+ sessions.set(session.sessionId, session);
68
26
  return session;
69
27
  }
28
+ // Get session by ID
70
29
  async get(sessionId) {
71
- // Check cache first
72
- if (this.cache.has(sessionId)) {
73
- const session = this.cache.get(sessionId);
74
- if (this.isExpired(session)) {
75
- await this.delete(sessionId);
76
- return null;
77
- }
78
- return session;
79
- }
80
- // Load from file
81
- const filePath = this.getFilePath(sessionId);
82
- try {
83
- const data = await fs_1.promises.readFile(filePath, 'utf-8');
84
- const session = JSON.parse(data);
85
- if (this.isExpired(session)) {
86
- await this.delete(sessionId);
87
- return null;
88
- }
89
- this.cache.set(sessionId, session);
90
- return session;
91
- }
92
- catch (error) {
93
- if (error.code === 'ENOENT') {
94
- return null;
95
- }
96
- throw error;
97
- }
30
+ return sessions.get(sessionId) || null;
98
31
  }
32
+ // Save/update session
99
33
  async save(session) {
100
- await this.ensureStorageDir();
101
34
  session.updatedAt = new Date().toISOString();
102
- // Update status based on step
103
- if (session.currentStep === types_1.FormationStep.COMPLETED) {
104
- session.status = types_1.SessionStatus.COMPLETED;
105
- }
106
- else if (session.currentStep === types_1.FormationStep.CERTIFICATE_GENERATED) {
107
- session.status = types_1.SessionStatus.REVIEW;
108
- }
109
- else if (session.currentStep !== types_1.FormationStep.CREATED) {
110
- session.status = types_1.SessionStatus.IN_PROGRESS;
111
- }
112
- const filePath = this.getFilePath(session.sessionId);
113
- await fs_1.promises.writeFile(filePath, JSON.stringify(session, null, 2), 'utf-8');
114
- this.cache.set(session.sessionId, session);
35
+ sessions.set(session.sessionId, session);
115
36
  }
37
+ // Delete session
116
38
  async delete(sessionId) {
117
- this.cache.delete(sessionId);
118
- const filePath = this.getFilePath(sessionId);
119
- try {
120
- await fs_1.promises.unlink(filePath);
121
- }
122
- catch (error) {
123
- if (error.code !== 'ENOENT') {
124
- throw error;
125
- }
126
- }
39
+ return sessions.delete(sessionId);
127
40
  }
41
+ // List all sessions (for debugging)
128
42
  async list() {
129
- await this.ensureStorageDir();
130
- const files = await fs_1.promises.readdir(this.storageDir);
131
- return files
132
- .filter(f => f.endsWith('.json'))
133
- .map(f => f.replace('.json', ''));
43
+ return Array.from(sessions.values());
134
44
  }
135
- isExpired(session) {
136
- if (!session.expiresAt)
137
- return false;
138
- return new Date(session.expiresAt) < new Date();
45
+ // Clean up expired sessions
46
+ async cleanup() {
47
+ const now = new Date();
48
+ let cleaned = 0;
49
+ for (const [sessionId, session] of sessions) {
50
+ if (new Date(session.expiresAt) < now) {
51
+ sessions.delete(sessionId);
52
+ cleaned++;
53
+ }
54
+ }
55
+ return cleaned;
139
56
  }
140
57
  }
141
58
  exports.FormationSessionStore = FormationSessionStore;
142
- // Singleton instance for convenience
143
- let defaultStore = null;
59
+ // Singleton instance
60
+ let storeInstance = null;
144
61
  function getSessionStore() {
145
- if (!defaultStore) {
146
- defaultStore = new FormationSessionStore();
62
+ if (!storeInstance) {
63
+ storeInstance = new FormationSessionStore();
147
64
  }
148
- return defaultStore;
65
+ return storeInstance;
149
66
  }
150
67
  //# sourceMappingURL=FormationSessionStore.js.map