debreu-mcp 2.208.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 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";
@@ -156,7 +157,7 @@ const OUTREACH_TOOL_NAMES = new Set([
156
157
  /** Write tools whose 4xx detail is shown to the caller, like the outreach tools:
157
158
  * their 400s explain a bad argument ("period_label 'last summer' is not a
158
159
  * period: use YYYY, ...") that the model can fix and retry. */
159
- const CLIENT_ERROR_TOOL_NAMES = new Set(["update_company", "update_project"]);
160
+ const CLIENT_ERROR_TOOL_NAMES = new Set(["update_company", "update_project", ...TRANSACTION_TOOL_NAMES]);
160
161
  /** "HTTP 4xx: <detail>" from an ``HTTP 4xx: <body>`` error, or null. FastAPI
161
162
  * bodies are ``{"detail": "..."}``, or a validation list on 422. */
162
163
  function clientErrorMessage(msg) {
@@ -498,6 +499,7 @@ const SEQUENCE_STEP_SCHEMA = {
498
499
  const EMAIL_SEQUENCE_BODY_KEYS = ["name", "folder", "description", "mode", "track_opens", "steps"];
499
500
  const TOOLS = [
500
501
  ...AGENT_TOOLS,
502
+ ...TRANSACTION_TOOLS,
501
503
  // ---- Companies (read) ----
502
504
  {
503
505
  name: "lookup_company",
@@ -3633,7 +3635,7 @@ const TOOLS = [
3633
3635
  description: "Delete a record by type and UUID. Supported types: company, person, task, " +
3634
3636
  "metric_schema, project, comment, status_definition, email, calendar, file, " +
3635
3637
  "port_co_relationship, fund, email_template, biopharma_asset, biopharma_indication, " +
3636
- "email_campaign (an outreach), workflow. " +
3638
+ "email_campaign (an outreach), workflow, transaction. " +
3637
3639
  "Performs soft delete (email/calendar/file use the same cascade behavior as app deletes). " +
3638
3640
  "For workflow, removes a tracker from a project — cascades its views and tracked " +
3639
3641
  "companies/people; tasks keep their rows with workflow_id cleared. Add a tracker with add_tracker. " +
@@ -3674,6 +3676,7 @@ const TOOLS = [
3674
3676
  "biopharma_indication",
3675
3677
  "email_campaign",
3676
3678
  "workflow",
3679
+ "transaction",
3677
3680
  ],
3678
3681
  description: "Type of record to delete.",
3679
3682
  },
@@ -4450,6 +4453,15 @@ const BIOPHARMA_INDICATION_BODY_KEYS = [
4450
4453
  ];
4451
4454
  async function handleTool(name, args) {
4452
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
+ }
4453
4465
  if (AGENT_TOOL_NAMES.has(name)) {
4454
4466
  // Discovery may be cached, but every request also checks the flag in
4455
4467
  // the backend. Missing/failed capability lookup never enables Agents.
@@ -4949,16 +4961,18 @@ const PROSPECTING_ONLY_TOOLS = new Set([
4949
4961
  "get_portfolio_prospect",
4950
4962
  ]);
4951
4963
  function createServer() {
4952
- const server = new Server({ name: "debreu-mcp", version: "2.208.0" }, { capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS });
4964
+ const server = new Server({ name: "debreu-mcp", version: "2.209.0" }, { capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS });
4953
4965
  server.setRequestHandler(ListToolsRequestSchema, async () => {
4954
4966
  // Prospecting-only tenants see a narrowed catalog. whoami returns the
4955
4967
  // allowlist. Preserve the standard catalog on errors, but opt-in Agents
4956
4968
  // always fail closed when the capability lookup is unavailable.
4957
4969
  let allow = null;
4958
4970
  let agentsEnabled = false;
4971
+ let transactionsEnabled = false;
4959
4972
  try {
4960
4973
  const who = (await whoami(keyStore.getStore() || API_KEY)).body;
4961
4974
  agentsEnabled = who?.view_agents === true && who?.prospecting_only !== true;
4975
+ transactionsEnabled = who?.view_transactions === true;
4962
4976
  if (who?.prospecting_only && Array.isArray(who.allowed_tools)) {
4963
4977
  allow = new Set(who.allowed_tools);
4964
4978
  }
@@ -4972,6 +4986,8 @@ function createServer() {
4972
4986
  return false;
4973
4987
  if (AGENT_TOOL_NAMES.has(t.name) && !agentsEnabled)
4974
4988
  return false;
4989
+ if (TRANSACTION_TOOL_NAMES.has(t.name) && !transactionsEnabled)
4990
+ return false;
4975
4991
  // Prospecting-only tenants: exactly the whoami allowlist.
4976
4992
  if (allow)
4977
4993
  return allow.has(t.name);