debreu-mcp 2.207.0 → 2.209.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.
- package/README.md +12 -1
- package/dist/index.js +25 -3
- package/dist/index.js.map +1 -1
- package/dist/transactionTools.d.ts +457 -0
- package/dist/transactionTools.js +144 -0
- package/dist/transactionTools.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,6 +92,17 @@ When `processing.pending` or `processing.reconciliation_pending` is true, item s
|
|
|
92
92
|
|
|
93
93
|
There is **no send action**: emails must be sent by the user through Debreu, Gmail, or Outlook. Calendar holds and reply tracking remain owned by the agent runtime. Deploy the backend and this MCP server together to enable the tools; no new database migration is needed for MCP access.
|
|
94
94
|
|
|
95
|
+
### Transactions (feature-gated)
|
|
96
|
+
|
|
97
|
+
M&A precedent deals. These four tools appear only when the authenticated user's `view_transactions` flag is enabled (not on prospecting-only accounts); the backend checks the flag on every request too.
|
|
98
|
+
|
|
99
|
+
| Tool | Description |
|
|
100
|
+
|------|-------------|
|
|
101
|
+
| `query_transactions` | Search the team's precedent deals by company (with role or buy/sell side), type, status, closed-date range and deal value ($M); paginated with `has_more` / `next_offset`. |
|
|
102
|
+
| `get_transaction` | One deal with its parties (company, role, side), multiples (metric, value, basis) and sources. |
|
|
103
|
+
| `create_transactions` | Log up to 100 deals per call. Parties take `company_id` or `company_name` (unclear names return candidates, never a new company); money in $M with a currency per field; returns per-row results and possible duplicates. |
|
|
104
|
+
| `update_transaction` | Patch scalars; `parties` / `multiples` / `sources`, when sent, replace that list. Delete with `delete_record` type `transaction`. |
|
|
105
|
+
|
|
95
106
|
### Companies
|
|
96
107
|
|
|
97
108
|
| Tool | Description |
|
|
@@ -298,7 +309,7 @@ There is **no send action**: emails must be sent by the user through Debreu, Gma
|
|
|
298
309
|
|
|
299
310
|
| Tool | Description |
|
|
300
311
|
|------|-------------|
|
|
301
|
-
| `delete_record` | Delete any record by type and UUID. Supports: company, person, task, metric_schema, project, comment, status_definition, email, calendar, file, port_co_relationship, fund, email_template, biopharma_asset, biopharma_indication, email_campaign, workflow. `workflow` removes a tracker from a project (cascades its views + tracked companies/people; tasks keep their rows with `workflow_id` cleared). For `company`, this is team-scoped — it removes the company from your team only (the company record and other teams' data are preserved); re-adding it restores your team's records. |
|
|
312
|
+
| `delete_record` | Delete any record by type and UUID. Supports: company, person, task, metric_schema, project, comment, status_definition, email, calendar, file, port_co_relationship, fund, email_template, biopharma_asset, biopharma_indication, email_campaign, workflow, transaction. `workflow` removes a tracker from a project (cascades its views + tracked companies/people; tasks keep their rows with `workflow_id` cleared). For `company`, this is team-scoped — it removes the company from your team only (the company record and other teams' data are preserved); re-adding it restores your team's records. |
|
|
302
313
|
|
|
303
314
|
### Prospecting-only
|
|
304
315
|
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { AGENT_TOOLS, AGENT_TOOL_NAMES, agentConflictMessage } from "./agentTools.js";
|
|
3
|
+
import { TRANSACTION_TOOLS, TRANSACTION_TOOL_NAMES } from "./transactionTools.js";
|
|
3
4
|
import * as fs from "node:fs";
|
|
4
5
|
import * as path from "node:path";
|
|
5
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -153,6 +154,10 @@ const OUTREACH_TOOL_NAMES = new Set([
|
|
|
153
154
|
"get_email_outreach_sequence",
|
|
154
155
|
"stop_email_outreach_sequence",
|
|
155
156
|
]);
|
|
157
|
+
/** Write tools whose 4xx detail is shown to the caller, like the outreach tools:
|
|
158
|
+
* their 400s explain a bad argument ("period_label 'last summer' is not a
|
|
159
|
+
* period: use YYYY, ...") that the model can fix and retry. */
|
|
160
|
+
const CLIENT_ERROR_TOOL_NAMES = new Set(["update_company", "update_project", ...TRANSACTION_TOOL_NAMES]);
|
|
156
161
|
/** "HTTP 4xx: <detail>" from an ``HTTP 4xx: <body>`` error, or null. FastAPI
|
|
157
162
|
* bodies are ``{"detail": "..."}``, or a validation list on 422. */
|
|
158
163
|
function clientErrorMessage(msg) {
|
|
@@ -494,6 +499,7 @@ const SEQUENCE_STEP_SCHEMA = {
|
|
|
494
499
|
const EMAIL_SEQUENCE_BODY_KEYS = ["name", "folder", "description", "mode", "track_opens", "steps"];
|
|
495
500
|
const TOOLS = [
|
|
496
501
|
...AGENT_TOOLS,
|
|
502
|
+
...TRANSACTION_TOOLS,
|
|
497
503
|
// ---- Companies (read) ----
|
|
498
504
|
{
|
|
499
505
|
name: "lookup_company",
|
|
@@ -3629,7 +3635,7 @@ const TOOLS = [
|
|
|
3629
3635
|
description: "Delete a record by type and UUID. Supported types: company, person, task, " +
|
|
3630
3636
|
"metric_schema, project, comment, status_definition, email, calendar, file, " +
|
|
3631
3637
|
"port_co_relationship, fund, email_template, biopharma_asset, biopharma_indication, " +
|
|
3632
|
-
"email_campaign (an outreach), workflow. " +
|
|
3638
|
+
"email_campaign (an outreach), workflow, transaction. " +
|
|
3633
3639
|
"Performs soft delete (email/calendar/file use the same cascade behavior as app deletes). " +
|
|
3634
3640
|
"For workflow, removes a tracker from a project — cascades its views and tracked " +
|
|
3635
3641
|
"companies/people; tasks keep their rows with workflow_id cleared. Add a tracker with add_tracker. " +
|
|
@@ -3670,6 +3676,7 @@ const TOOLS = [
|
|
|
3670
3676
|
"biopharma_indication",
|
|
3671
3677
|
"email_campaign",
|
|
3672
3678
|
"workflow",
|
|
3679
|
+
"transaction",
|
|
3673
3680
|
],
|
|
3674
3681
|
description: "Type of record to delete.",
|
|
3675
3682
|
},
|
|
@@ -4446,6 +4453,15 @@ const BIOPHARMA_INDICATION_BODY_KEYS = [
|
|
|
4446
4453
|
];
|
|
4447
4454
|
async function handleTool(name, args) {
|
|
4448
4455
|
try {
|
|
4456
|
+
if (TRANSACTION_TOOL_NAMES.has(name)) {
|
|
4457
|
+
// Listed only with view_transactions; the backend checks the flag again.
|
|
4458
|
+
const capability = await whoami(keyStore.getStore() || API_KEY);
|
|
4459
|
+
if (capability.body?.view_transactions !== true) {
|
|
4460
|
+
return errorResult("Transactions is not enabled for this account");
|
|
4461
|
+
}
|
|
4462
|
+
const slug = name.replace(/_/g, "-");
|
|
4463
|
+
return textResult(await apiPost(`/api/v1/ext/tools/${slug}`, args));
|
|
4464
|
+
}
|
|
4449
4465
|
if (AGENT_TOOL_NAMES.has(name)) {
|
|
4450
4466
|
// Discovery may be cached, but every request also checks the flag in
|
|
4451
4467
|
// the backend. Missing/failed capability lookup never enables Agents.
|
|
@@ -4861,10 +4877,12 @@ async function handleTool(name, args) {
|
|
|
4861
4877
|
const timeoutMsg = queryTimeoutMessage(msg);
|
|
4862
4878
|
if (timeoutMsg)
|
|
4863
4879
|
return errorResult(timeoutMsg);
|
|
4864
|
-
if (OUTREACH_TOOL_NAMES.has(name)) {
|
|
4880
|
+
if (OUTREACH_TOOL_NAMES.has(name) || CLIENT_ERROR_TOOL_NAMES.has(name)) {
|
|
4865
4881
|
const clientMsg = clientErrorMessage(msg);
|
|
4866
4882
|
if (clientMsg)
|
|
4867
4883
|
return errorResult(clientMsg);
|
|
4884
|
+
}
|
|
4885
|
+
if (OUTREACH_TOOL_NAMES.has(name)) {
|
|
4868
4886
|
// The handler's own argument checks ("action must be ...").
|
|
4869
4887
|
if (!/^HTTP \d{3}/.test(msg))
|
|
4870
4888
|
return errorResult(msg);
|
|
@@ -4943,16 +4961,18 @@ const PROSPECTING_ONLY_TOOLS = new Set([
|
|
|
4943
4961
|
"get_portfolio_prospect",
|
|
4944
4962
|
]);
|
|
4945
4963
|
function createServer() {
|
|
4946
|
-
const server = new Server({ name: "debreu-mcp", version: "2.
|
|
4964
|
+
const server = new Server({ name: "debreu-mcp", version: "2.209.0" }, { capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS });
|
|
4947
4965
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
4948
4966
|
// Prospecting-only tenants see a narrowed catalog. whoami returns the
|
|
4949
4967
|
// allowlist. Preserve the standard catalog on errors, but opt-in Agents
|
|
4950
4968
|
// always fail closed when the capability lookup is unavailable.
|
|
4951
4969
|
let allow = null;
|
|
4952
4970
|
let agentsEnabled = false;
|
|
4971
|
+
let transactionsEnabled = false;
|
|
4953
4972
|
try {
|
|
4954
4973
|
const who = (await whoami(keyStore.getStore() || API_KEY)).body;
|
|
4955
4974
|
agentsEnabled = who?.view_agents === true && who?.prospecting_only !== true;
|
|
4975
|
+
transactionsEnabled = who?.view_transactions === true;
|
|
4956
4976
|
if (who?.prospecting_only && Array.isArray(who.allowed_tools)) {
|
|
4957
4977
|
allow = new Set(who.allowed_tools);
|
|
4958
4978
|
}
|
|
@@ -4966,6 +4986,8 @@ function createServer() {
|
|
|
4966
4986
|
return false;
|
|
4967
4987
|
if (AGENT_TOOL_NAMES.has(t.name) && !agentsEnabled)
|
|
4968
4988
|
return false;
|
|
4989
|
+
if (TRANSACTION_TOOL_NAMES.has(t.name) && !transactionsEnabled)
|
|
4990
|
+
return false;
|
|
4969
4991
|
// Prospecting-only tenants: exactly the whoami allowlist.
|
|
4970
4992
|
if (allow)
|
|
4971
4993
|
return allow.has(t.name);
|