@opencapstack/mcp-server 0.1.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.
Files changed (77) hide show
  1. package/README.md +166 -0
  2. package/dist/auth.d.ts +7 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +16 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/client.d.ts +6 -0
  7. package/dist/client.d.ts.map +1 -0
  8. package/dist/client.js +30 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/index.d.ts +10 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +59 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/server.d.ts +10 -0
  15. package/dist/server.d.ts.map +1 -0
  16. package/dist/server.js +73 -0
  17. package/dist/server.js.map +1 -0
  18. package/dist/tools/dilution.d.ts +3 -0
  19. package/dist/tools/dilution.d.ts.map +1 -0
  20. package/dist/tools/dilution.js +51 -0
  21. package/dist/tools/dilution.js.map +1 -0
  22. package/dist/tools/documents.d.ts +3 -0
  23. package/dist/tools/documents.d.ts.map +1 -0
  24. package/dist/tools/documents.js +72 -0
  25. package/dist/tools/documents.js.map +1 -0
  26. package/dist/tools/equityPlans.d.ts +3 -0
  27. package/dist/tools/equityPlans.d.ts.map +1 -0
  28. package/dist/tools/equityPlans.js +65 -0
  29. package/dist/tools/equityPlans.js.map +1 -0
  30. package/dist/tools/financialReports.d.ts +3 -0
  31. package/dist/tools/financialReports.d.ts.map +1 -0
  32. package/dist/tools/financialReports.js +79 -0
  33. package/dist/tools/financialReports.js.map +1 -0
  34. package/dist/tools/safes.d.ts +3 -0
  35. package/dist/tools/safes.d.ts.map +1 -0
  36. package/dist/tools/safes.js +102 -0
  37. package/dist/tools/safes.js.map +1 -0
  38. package/dist/tools/shareClasses.d.ts +3 -0
  39. package/dist/tools/shareClasses.d.ts.map +1 -0
  40. package/dist/tools/shareClasses.js +63 -0
  41. package/dist/tools/shareClasses.js.map +1 -0
  42. package/dist/tools/stakeholders.d.ts +3 -0
  43. package/dist/tools/stakeholders.d.ts.map +1 -0
  44. package/dist/tools/stakeholders.js +72 -0
  45. package/dist/tools/stakeholders.js.map +1 -0
  46. package/dist/tools/valuations.d.ts +3 -0
  47. package/dist/tools/valuations.d.ts.map +1 -0
  48. package/dist/tools/valuations.js +67 -0
  49. package/dist/tools/valuations.js.map +1 -0
  50. package/dist/tools/waterfall.d.ts +3 -0
  51. package/dist/tools/waterfall.d.ts.map +1 -0
  52. package/dist/tools/waterfall.js +46 -0
  53. package/dist/tools/waterfall.js.map +1 -0
  54. package/dist/types.d.ts +14 -0
  55. package/dist/types.d.ts.map +1 -0
  56. package/dist/types.js +5 -0
  57. package/dist/types.js.map +1 -0
  58. package/package.json +57 -0
  59. package/src/auth.ts +19 -0
  60. package/src/client.ts +46 -0
  61. package/src/index.ts +70 -0
  62. package/src/server.ts +93 -0
  63. package/src/tools/dilution.ts +54 -0
  64. package/src/tools/documents.ts +74 -0
  65. package/src/tools/equityPlans.ts +67 -0
  66. package/src/tools/financialReports.ts +82 -0
  67. package/src/tools/safes.ts +104 -0
  68. package/src/tools/shareClasses.ts +65 -0
  69. package/src/tools/stakeholders.ts +74 -0
  70. package/src/tools/valuations.ts +73 -0
  71. package/src/tools/waterfall.ts +48 -0
  72. package/src/types.ts +16 -0
  73. package/tests/auth.test.ts +54 -0
  74. package/tests/server.test.ts +95 -0
  75. package/tests/tools/shareClasses.test.ts +133 -0
  76. package/tests/tools/stakeholders.test.ts +147 -0
  77. package/tsconfig.json +16 -0
package/README.md ADDED
@@ -0,0 +1,166 @@
1
+ # @opencapstack/mcp-server
2
+
3
+ An MCP (Model Context Protocol) server for OpenCap Stack. Connect your cap table to Claude Desktop, Claude Code, Cursor, and any MCP-compatible client to manage stakeholders, share classes, SAFEs, dilution models, waterfall analyses, and financial reports — all through natural language.
4
+
5
+ ---
6
+
7
+ ## Quick start
8
+
9
+ ```bash
10
+ npx @opencapstack/mcp-server
11
+ ```
12
+
13
+ The server reads your API key from the `OPENCAP_API_KEY` environment variable and starts on stdio by default.
14
+
15
+ ---
16
+
17
+ ## Configuration
18
+
19
+ ### Claude Desktop
20
+
21
+ Add the following to your Claude Desktop config file:
22
+
23
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
24
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
25
+
26
+ ```json
27
+ {
28
+ "mcpServers": {
29
+ "opencap": {
30
+ "command": "npx",
31
+ "args": ["@opencapstack/mcp-server"],
32
+ "env": {
33
+ "OPENCAP_API_KEY": "your-jwt-token-here",
34
+ "OPENCAP_BASE_URL": "https://api.opencapstack.com"
35
+ }
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ Restart Claude Desktop after saving.
42
+
43
+ ### Claude Code
44
+
45
+ Add to your Claude Code MCP settings (`.claude/settings.json` or via `claude mcp add`):
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "opencap": {
51
+ "command": "npx",
52
+ "args": ["@opencapstack/mcp-server"],
53
+ "env": {
54
+ "OPENCAP_API_KEY": "your-jwt-token-here"
55
+ }
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ Or from the command line:
62
+
63
+ ```bash
64
+ claude mcp add opencap npx @opencapstack/mcp-server
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Environment variables
70
+
71
+ | Variable | Required | Default | Description |
72
+ |----------|----------|---------|-------------|
73
+ | `OPENCAP_API_KEY` | Yes | — | Your OpenCap JWT token. Get one at `https://api.opencapstack.com/api/v1/auth/login` |
74
+ | `OPENCAP_BASE_URL` | No | `https://api.opencapstack.com` | Base URL for the OpenCap API |
75
+ | `TRANSPORT` | No | `stdio` | Transport mode: `stdio` or `sse` |
76
+ | `PORT` | No | `3001` | Port for the SSE HTTP server (only used when `TRANSPORT=sse`) |
77
+
78
+ ---
79
+
80
+ ## Available tools
81
+
82
+ | Tool | Description |
83
+ |------|-------------|
84
+ | `list_stakeholders` | List all stakeholders in the cap table |
85
+ | `get_stakeholder` | Get details for a stakeholder by ID |
86
+ | `create_stakeholder` | Add a new stakeholder |
87
+ | `update_stakeholder` | Update an existing stakeholder |
88
+ | `list_share_classes` | List all share classes |
89
+ | `get_share_class` | Get details for a share class by ID |
90
+ | `create_share_class` | Create a new share class |
91
+ | `list_equity_plans` | List all equity plans |
92
+ | `get_equity_plan` | Get details for an equity plan |
93
+ | `create_equity_plan` | Create a new equity incentive plan |
94
+ | `list_safes` | List all SAFE instruments |
95
+ | `get_safe` | Get details for a SAFE by ID |
96
+ | `create_safe` | Record a new SAFE |
97
+ | `update_safe` | Update a SAFE (e.g. record conversion) |
98
+ | `list_documents` | List cap table documents |
99
+ | `get_document` | Get a document by ID |
100
+ | `search_documents` | Search documents by keyword |
101
+ | `get_latest_valuation` | Get the most recent 409A valuation |
102
+ | `get_valuation_history` | Get the valuation history timeline |
103
+ | `create_valuation_request` | Record a new valuation |
104
+ | `calculate_dilution` | Model dilution from a new issuance |
105
+ | `get_fully_diluted_shares` | Get fully diluted share count |
106
+ | `run_waterfall_analysis` | Model exit proceeds distribution |
107
+ | `list_financial_reports` | List financial reports |
108
+ | `get_financial_report` | Get a financial report by ID |
109
+ | `create_financial_report` | Generate a new financial report |
110
+
111
+ ---
112
+
113
+ ## Self-hosted usage
114
+
115
+ If you run your own OpenCap Stack instance, set `OPENCAP_BASE_URL` to your instance's API base URL:
116
+
117
+ ```json
118
+ {
119
+ "env": {
120
+ "OPENCAP_API_KEY": "your-jwt-token",
121
+ "OPENCAP_BASE_URL": "https://opencap.yourcompany.internal"
122
+ }
123
+ }
124
+ ```
125
+
126
+ ### SSE transport (web clients)
127
+
128
+ Start the server in SSE mode for HTTP-based MCP clients:
129
+
130
+ ```bash
131
+ TRANSPORT=sse PORT=3001 OPENCAP_API_KEY=your-token npx @opencapstack/mcp-server
132
+ ```
133
+
134
+ The server will expose:
135
+ - `GET /sse` — SSE connection endpoint
136
+ - `POST /messages?sessionId=<id>` — message endpoint
137
+
138
+ ---
139
+
140
+ ## Security
141
+
142
+ **Never hardcode your API key.** Always pass it through environment variables.
143
+
144
+ - Do not commit `.env` files containing `OPENCAP_API_KEY` to source control.
145
+ - Rotate your API key regularly at `https://app.opencapstack.com/settings`.
146
+ - When using the SSE transport, run the server behind a reverse proxy with TLS and access controls.
147
+ - API keys are scoped to your account — treat them like passwords.
148
+
149
+ ---
150
+
151
+ ## Development
152
+
153
+ ```bash
154
+ git clone https://github.com/Open-Cap-Stack/opencapstack
155
+ cd packages/opencap-mcp
156
+ npm install
157
+ npm run build # compile TypeScript
158
+ npm run dev # run with tsx (no compile step)
159
+ npm test # run Jest tests
160
+ ```
161
+
162
+ ---
163
+
164
+ ## License
165
+
166
+ MIT
package/dist/auth.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Authentication utilities for the OpenCap MCP server.
3
+ * Reads OPENCAP_API_KEY and OPENCAP_BASE_URL from the environment.
4
+ */
5
+ export declare function getApiKey(): string;
6
+ export declare function getBaseUrl(): string;
7
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,SAAS,IAAI,MAAM,CASlC;AAED,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
package/dist/auth.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Authentication utilities for the OpenCap MCP server.
3
+ * Reads OPENCAP_API_KEY and OPENCAP_BASE_URL from the environment.
4
+ */
5
+ export function getApiKey() {
6
+ const key = process.env.OPENCAP_API_KEY;
7
+ if (!key) {
8
+ throw new Error('Set OPENCAP_API_KEY to your OpenCap JWT token. ' +
9
+ 'Get one at https://api.opencapstack.com/api/v1/auth/login');
10
+ }
11
+ return key;
12
+ }
13
+ export function getBaseUrl() {
14
+ return process.env.OPENCAP_BASE_URL ?? 'https://api.opencapstack.com';
15
+ }
16
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IACxC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,iDAAiD;YAC/C,2DAA2D,CAC9D,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,8BAA8B,CAAC;AACxE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Shared HTTP client with auth and error handling.
3
+ */
4
+ import { type AxiosInstance } from 'axios';
5
+ export declare function createClient(apiKey: string): AxiosInstance;
6
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAIlD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAqC1D"}
package/dist/client.js ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Shared HTTP client with auth and error handling.
3
+ */
4
+ import axios from 'axios';
5
+ import { McpError, ErrorCode } from '@modelcontextprotocol/sdk/types.js';
6
+ import { getBaseUrl } from './auth.js';
7
+ export function createClient(apiKey) {
8
+ const client = axios.create({
9
+ baseURL: getBaseUrl(),
10
+ headers: {
11
+ Authorization: `Bearer ${apiKey}`,
12
+ 'Content-Type': 'application/json',
13
+ },
14
+ timeout: 30_000,
15
+ });
16
+ client.interceptors.response.use((response) => response, (error) => {
17
+ const status = error.response?.status;
18
+ if (status === 401) {
19
+ throw new McpError(ErrorCode.InvalidRequest, 'API key rejected or expired — regenerate at https://app.opencapstack.com/settings');
20
+ }
21
+ if (status === 403) {
22
+ throw new McpError(ErrorCode.InvalidRequest, 'Access denied — check your account permissions');
23
+ }
24
+ // Re-throw other errors with the server message when available
25
+ const message = error.response?.data?.message ?? error.message ?? 'Unknown API error';
26
+ throw new McpError(ErrorCode.InternalError, `OpenCap API error: ${message}`);
27
+ });
28
+ return client;
29
+ }
30
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC1B,OAAO,EAAE,UAAU,EAAE;QACrB,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,MAAM,EAAE;YACjC,cAAc,EAAE,kBAAkB;SACnC;QACD,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IAEH,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAC9B,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACtB,CAAC,KAAK,EAAE,EAAE;QACR,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC;QAEtC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,cAAc,EACxB,mFAAmF,CACpF,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;YACnB,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,cAAc,EACxB,gDAAgD,CACjD,CAAC;QACJ,CAAC;QAED,+DAA+D;QAC/D,MAAM,OAAO,GACX,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,mBAAmB,CAAC;QACxE,MAAM,IAAI,QAAQ,CAAC,SAAS,CAAC,aAAa,EAAE,sBAAsB,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * OpenCap MCP Server entry point.
4
+ *
5
+ * Supports two transport modes:
6
+ * TRANSPORT=stdio (default) — for Claude Desktop / Claude Code
7
+ * TRANSPORT=sse — HTTP + SSE, useful for web-based clients
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG"}
package/dist/index.js ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * OpenCap MCP Server entry point.
4
+ *
5
+ * Supports two transport modes:
6
+ * TRANSPORT=stdio (default) — for Claude Desktop / Claude Code
7
+ * TRANSPORT=sse — HTTP + SSE, useful for web-based clients
8
+ */
9
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
10
+ import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
11
+ import { createServer } from './server.js';
12
+ import { getApiKey } from './auth.js';
13
+ import { createClient } from './client.js';
14
+ async function main() {
15
+ // Fail fast if the API key is missing
16
+ const apiKey = getApiKey();
17
+ const client = createClient(apiKey);
18
+ const server = createServer(client);
19
+ const transport = process.env.TRANSPORT ?? 'stdio';
20
+ if (transport === 'sse') {
21
+ // Dynamically import express so it doesn't slow down the stdio path
22
+ const { default: express } = await import('express');
23
+ const app = express();
24
+ const port = Number(process.env.PORT ?? 3001);
25
+ // Map to hold active SSE transports keyed by session
26
+ const transports = new Map();
27
+ app.get('/sse', async (req, res) => {
28
+ const sseTransport = new SSEServerTransport('/messages', res);
29
+ transports.set(sseTransport.sessionId, sseTransport);
30
+ res.on('close', () => {
31
+ transports.delete(sseTransport.sessionId);
32
+ });
33
+ await server.connect(sseTransport);
34
+ });
35
+ app.post('/messages', express.json(), async (req, res) => {
36
+ const sessionId = req.query['sessionId'];
37
+ const sseTransport = transports.get(sessionId);
38
+ if (!sseTransport) {
39
+ res.status(404).json({ error: 'Session not found' });
40
+ return;
41
+ }
42
+ await sseTransport.handlePostMessage(req, res);
43
+ });
44
+ app.listen(port, () => {
45
+ console.error(`OpenCap MCP server listening on http://localhost:${port}`);
46
+ });
47
+ }
48
+ else {
49
+ // stdio transport (default)
50
+ const stdioTransport = new StdioServerTransport();
51
+ await server.connect(stdioTransport);
52
+ console.error('OpenCap MCP server running on stdio');
53
+ }
54
+ }
55
+ main().catch((err) => {
56
+ console.error('Fatal error:', err instanceof Error ? err.message : err);
57
+ process.exit(1);
58
+ });
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,KAAK,UAAU,IAAI;IACjB,sCAAsC;IACtC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAEpC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,IA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YAAY,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;YACpB,OAAO,CAAC,KAAK,CAAC,oDAAoD,IAAI,EAAE,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,4BAA4B;QAC5B,MAAM,cAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAClD,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvD,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * MCP server setup and tool registration.
3
+ */
4
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
5
+ import { type AxiosInstance } from 'axios';
6
+ import { type ToolDefinition } from './types.js';
7
+ declare const ALL_TOOLS: ToolDefinition[];
8
+ export declare function createServer(client: AxiosInstance): Server;
9
+ export { ALL_TOOLS };
10
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAQnE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAY3C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,QAAA,MAAM,SAAS,EAAE,cAAc,EAU9B,CAAC;AAEF,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAiD1D;AAKD,OAAO,EAAE,SAAS,EAAE,CAAC"}
package/dist/server.js ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * MCP server setup and tool registration.
3
+ */
4
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
5
+ import { CallToolRequestSchema, CallToolResultSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
6
+ import { zodToJsonSchema } from 'zod-to-json-schema';
7
+ import { stakeholderTools } from './tools/stakeholders.js';
8
+ import { shareClassTools } from './tools/shareClasses.js';
9
+ import { equityPlanTools } from './tools/equityPlans.js';
10
+ import { safeTools } from './tools/safes.js';
11
+ import { documentTools } from './tools/documents.js';
12
+ import { valuationTools } from './tools/valuations.js';
13
+ import { dilutionTools } from './tools/dilution.js';
14
+ import { waterfallTools } from './tools/waterfall.js';
15
+ import { financialReportTools } from './tools/financialReports.js';
16
+ const ALL_TOOLS = [
17
+ ...stakeholderTools,
18
+ ...shareClassTools,
19
+ ...equityPlanTools,
20
+ ...safeTools,
21
+ ...documentTools,
22
+ ...valuationTools,
23
+ ...dilutionTools,
24
+ ...waterfallTools,
25
+ ...financialReportTools,
26
+ ];
27
+ export function createServer(client) {
28
+ const server = new Server({
29
+ name: 'opencap-mcp',
30
+ version: '0.1.0',
31
+ }, {
32
+ capabilities: {
33
+ tools: {},
34
+ },
35
+ });
36
+ // List tools handler
37
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
38
+ const tools = ALL_TOOLS.map((tool) => ({
39
+ name: tool.name,
40
+ description: tool.description,
41
+ inputSchema: zodToJsonSchema(tool.inputSchema),
42
+ }));
43
+ return { tools };
44
+ });
45
+ // Call tool handler
46
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
47
+ const { name, arguments: args } = request.params;
48
+ const tool = ALL_TOOLS.find((t) => t.name === name);
49
+ if (!tool) {
50
+ return {
51
+ content: [{ type: 'text', text: `Unknown tool: ${name}` }],
52
+ isError: true,
53
+ };
54
+ }
55
+ try {
56
+ const parsed = tool.inputSchema.parse(args ?? {});
57
+ const result = await tool.handler(parsed, client);
58
+ return result;
59
+ }
60
+ catch (error) {
61
+ const message = error instanceof Error ? error.message : String(error);
62
+ return {
63
+ content: [{ type: 'text', text: `Tool error: ${message}` }],
64
+ isError: true,
65
+ };
66
+ }
67
+ });
68
+ return server;
69
+ }
70
+ // Keep the schema reference to avoid unused-import warnings
71
+ void CallToolResultSchema;
72
+ export { ALL_TOOLS };
73
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,GAGvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,SAAS,GAAqB;IAClC,GAAG,gBAAgB;IACnB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAA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C,WAAW,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YAClD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAClD,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACvE,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,OAAO,EAAE,EAAE,CAAC;gBAC3D,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,4DAA4D;AAC5D,KAAK,oBAAoB,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from '../types.js';
2
+ export declare const dilutionTools: ToolDefinition[];
3
+ //# sourceMappingURL=dilution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dilution.d.ts","sourceRoot":"","sources":["../../src/tools/dilution.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,aAAa,EAAE,cAAc,EAkDzC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ export const dilutionTools = [
3
+ {
4
+ name: 'calculate_dilution',
5
+ description: 'Calculate dilution impact for a hypothetical new funding round or equity issuance. ' +
6
+ 'Returns pre- and post-dilution ownership percentages for each stakeholder.',
7
+ inputSchema: z.object({
8
+ companyId: z.string().describe('Company ID'),
9
+ newSharesIssued: z
10
+ .number()
11
+ .int()
12
+ .positive()
13
+ .describe('Number of new shares to be issued in the scenario'),
14
+ includeOptionPool: z
15
+ .boolean()
16
+ .optional()
17
+ .default(false)
18
+ .describe('Whether to include unissued option pool shares in the denominator'),
19
+ includeSafes: z
20
+ .boolean()
21
+ .optional()
22
+ .default(true)
23
+ .describe('Whether to include SAFEs in conversion when calculating dilution'),
24
+ }),
25
+ handler: async (input, client) => {
26
+ const { data } = await client.post('/api/v1/dilution/calculate', input);
27
+ return {
28
+ content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
29
+ };
30
+ },
31
+ },
32
+ {
33
+ name: 'get_fully_diluted_shares',
34
+ description: 'Get the current fully diluted share count including outstanding shares, ' +
35
+ 'options (granted and reserved), warrants, and convertible instruments.',
36
+ inputSchema: z.object({
37
+ companyId: z.string().describe('Company ID'),
38
+ asOfDate: z
39
+ .string()
40
+ .optional()
41
+ .describe('Calculate as of a specific date (ISO 8601 YYYY-MM-DD). Defaults to today.'),
42
+ }),
43
+ handler: async (input, client) => {
44
+ const { data } = await client.get('/api/v1/dilution/fully-diluted', {
45
+ params: input,
46
+ });
47
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
48
+ },
49
+ },
50
+ ];
51
+ //# sourceMappingURL=dilution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dilution.js","sourceRoot":"","sources":["../../src/tools/dilution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C;QACE,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,qFAAqF;YACrF,4EAA4E;QAC9E,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC5C,eAAe,EAAE,CAAC;iBACf,MAAM,EAAE;iBACR,GAAG,EAAE;iBACL,QAAQ,EAAE;iBACV,QAAQ,CAAC,mDAAmD,CAAC;YAChE,iBAAiB,EAAE,CA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AAC;KACF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from '../types.js';
2
+ export declare const documentTools: ToolDefinition[];
3
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,aAAa,EAAE,cAAc,EAsEzC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { z } from 'zod';
2
+ export const documentTools = [
3
+ {
4
+ name: 'list_documents',
5
+ description: 'List documents stored in OpenCap (shareholder agreements, option grants, board consents, etc.).',
6
+ inputSchema: z.object({
7
+ companyId: z.string().optional().describe('Filter by company ID'),
8
+ documentType: z
9
+ .enum([
10
+ 'shareholder_agreement',
11
+ 'option_grant',
12
+ 'board_consent',
13
+ 'safe',
14
+ 'certificate',
15
+ 'other',
16
+ ])
17
+ .optional()
18
+ .describe('Filter by document type'),
19
+ stakeholderId: z
20
+ .string()
21
+ .optional()
22
+ .describe('Filter documents associated with a stakeholder'),
23
+ limit: z.number().optional().default(50).describe('Max results to return'),
24
+ }),
25
+ handler: async (input, client) => {
26
+ const { data } = await client.get('/api/v1/documents', { params: input });
27
+ const documents = data.documents ?? data;
28
+ return {
29
+ content: [{ type: 'text', text: JSON.stringify(documents, null, 2) }],
30
+ };
31
+ },
32
+ },
33
+ {
34
+ name: 'get_document',
35
+ description: 'Get metadata and details for a specific document by ID.',
36
+ inputSchema: z.object({
37
+ id: z.string().describe('Document ID'),
38
+ }),
39
+ handler: async (input, client) => {
40
+ const { data } = await client.get(`/api/v1/documents/${input.id}`);
41
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
42
+ },
43
+ },
44
+ {
45
+ name: 'search_documents',
46
+ description: 'Search documents by keyword or metadata across all company documents.',
47
+ inputSchema: z.object({
48
+ query: z.string().describe('Search query string'),
49
+ companyId: z.string().optional().describe('Limit search to a specific company'),
50
+ documentType: z
51
+ .enum([
52
+ 'shareholder_agreement',
53
+ 'option_grant',
54
+ 'board_consent',
55
+ 'safe',
56
+ 'certificate',
57
+ 'other',
58
+ ])
59
+ .optional()
60
+ .describe('Filter by document type'),
61
+ limit: z.number().optional().default(20).describe('Max results to return'),
62
+ }),
63
+ handler: async (input, client) => {
64
+ const { data } = await client.get('/api/v1/documents/search', { params: input });
65
+ const results = data.results ?? data;
66
+ return {
67
+ content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],
68
+ };
69
+ },
70
+ },
71
+ ];
72
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,iGAAiG;QACnG,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;YACjE,YAAY,EAAE,CAAC;iBACZ,IAAI,CAAC;gBACJ,uBAAuB;gBACvB,cAAc;gBACd,eAAe;gBACf,MAAM;gBACN,aAAa;gBACb,OAAO;aACR,CAAC;iBACD,QAAQ,EAAE;iBACV,QAAQ,CAAC,yBAAyB,CAAC;YACtC,aAAa,EAAE,CAAC;iBACb,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,gDAAgD,CAAC;YAC7D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;SAC3E,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE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BACJ,uBAAuB;gBACvB,cAAc;gBACd,eAAe;gBACf,MAAM;gBACN,aAAa;gBACb,OAAO;aACR,CAAC;iBACD,QAAQ,EAAE;iBACV,QAAQ,CAAC,yBAAyB,CAAC;YACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;SAC3E,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YACjF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;YACrC,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACpE,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type ToolDefinition } from '../types.js';
2
+ export declare const equityPlanTools: ToolDefinition[];
3
+ //# sourceMappingURL=equityPlans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"equityPlans.d.ts","sourceRoot":"","sources":["../../src/tools/equityPlans.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,eAAe,EAAE,cAAc,EA+D3C,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod';
2
+ export const equityPlanTools = [
3
+ {
4
+ name: 'list_equity_plans',
5
+ description: 'List all equity plans (stock option plans, RSU plans, etc.) in the company.',
6
+ inputSchema: z.object({
7
+ companyId: z.string().optional().describe('Filter by company ID'),
8
+ limit: z.number().optional().default(50).describe('Max results to return'),
9
+ }),
10
+ handler: async (input, client) => {
11
+ const { data } = await client.get('/api/v1/equity-plans', { params: input });
12
+ const plans = data.equityPlans ?? data;
13
+ return {
14
+ content: [{ type: 'text', text: JSON.stringify(plans, null, 2) }],
15
+ };
16
+ },
17
+ },
18
+ {
19
+ name: 'get_equity_plan',
20
+ description: 'Get details for a specific equity plan by ID.',
21
+ inputSchema: z.object({
22
+ id: z.string().describe('Equity plan ID'),
23
+ }),
24
+ handler: async (input, client) => {
25
+ const { data } = await client.get(`/api/v1/equity-plans/${input.id}`);
26
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
27
+ },
28
+ },
29
+ {
30
+ name: 'create_equity_plan',
31
+ description: 'Create a new equity incentive plan for employees or advisors.',
32
+ inputSchema: z.object({
33
+ name: z.string().describe('Plan name, e.g. "2024 Stock Option Plan"'),
34
+ planType: z
35
+ .enum(['ISO', 'NSO', 'RSA', 'RSU', 'SAR', 'other'])
36
+ .describe('Type of equity plan'),
37
+ sharesReserved: z
38
+ .number()
39
+ .int()
40
+ .positive()
41
+ .describe('Number of shares reserved for this plan'),
42
+ companyId: z.string().describe('Company ID this plan belongs to'),
43
+ expirationDate: z
44
+ .string()
45
+ .optional()
46
+ .describe('Plan expiration date in ISO 8601 format (YYYY-MM-DD)'),
47
+ defaultVestingSchedule: z
48
+ .object({
49
+ totalMonths: z.number().int().positive().describe('Total vesting period in months'),
50
+ cliffMonths: z.number().int().min(0).describe('Cliff period in months'),
51
+ })
52
+ .optional()
53
+ .describe('Default vesting schedule for grants under this plan'),
54
+ }),
55
+ handler: async (input, client) => {
56
+ const { data } = await client.post('/api/v1/equity-plans', input);
57
+ return {
58
+ content: [
59
+ { type: 'text', text: `Equity plan created: ${JSON.stringify(data, null, 2)}` },
60
+ ],
61
+ };
62
+ },
63
+ },
64
+ ];
65
+ //# sourceMappingURL=equityPlans.js.map