@didit-protocol/mcp-server 5.1.41 → 5.1.52
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 +72 -2
- package/dist/auth/introspection-verifier.d.ts.map +1 -1
- package/dist/auth/introspection-verifier.js +1 -1
- package/dist/auth/introspection-verifier.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +32 -2
- package/dist/config.js.map +1 -1
- package/dist/device-login.d.ts +98 -0
- package/dist/device-login.d.ts.map +1 -0
- package/dist/device-login.js +455 -0
- package/dist/device-login.js.map +1 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +18 -4
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +324 -18
- package/dist/index.js.map +1 -1
- package/dist/login-cli.d.ts +6 -0
- package/dist/login-cli.d.ts.map +1 -0
- package/dist/login-cli.js +47 -0
- package/dist/login-cli.js.map +1 -0
- package/dist/mcp-modern.d.ts +1 -0
- package/dist/mcp-modern.d.ts.map +1 -1
- package/dist/mcp-modern.js +1 -1
- package/dist/mcp-modern.js.map +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +11 -1
- package/dist/permissions.js.map +1 -1
- package/dist/privileged-tools.d.ts +1 -0
- package/dist/privileged-tools.d.ts.map +1 -1
- package/dist/privileged-tools.js +2 -1
- package/dist/privileged-tools.js.map +1 -1
- package/dist/schema/feature-config-schema.json +2 -2
- package/dist/security.d.ts +9 -8
- package/dist/security.d.ts.map +1 -1
- package/dist/security.js +9 -1
- package/dist/security.js.map +1 -1
- package/dist/tools/auth.d.ts +2 -0
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +114 -14
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/billing.d.ts +32 -2
- package/dist/tools/billing.d.ts.map +1 -1
- package/dist/tools/billing.js +248 -10
- package/dist/tools/billing.js.map +1 -1
- package/dist/tools/members.d.ts +8 -0
- package/dist/tools/members.d.ts.map +1 -1
- package/dist/tools/members.js +73 -4
- package/dist/tools/members.js.map +1 -1
- package/dist/tools/sessions.d.ts +6 -0
- package/dist/tools/sessions.d.ts.map +1 -1
- package/dist/tools/sessions.js +41 -0
- package/dist/tools/sessions.js.map +1 -1
- package/dist/tools/settings.d.ts.map +1 -1
- package/dist/tools/settings.js +3 -1
- package/dist/tools/settings.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -65,6 +65,8 @@ const workflowGraph = __importStar(require("./tools/workflow-graph"));
|
|
|
65
65
|
const feature_config_schema_1 = require("./feature-config-schema");
|
|
66
66
|
const analytics = __importStar(require("./tools/analytics"));
|
|
67
67
|
const compliance = __importStar(require("./tools/compliance"));
|
|
68
|
+
const device_login_1 = require("./device-login");
|
|
69
|
+
const login_cli_1 = require("./login-cli");
|
|
68
70
|
const config_1 = require("./config");
|
|
69
71
|
const blank_args_1 = require("./blank-args");
|
|
70
72
|
const chatgpt_app_1 = require("./chatgpt-app");
|
|
@@ -388,6 +390,7 @@ const TOOL_GROUP_BY_PREFIX = [
|
|
|
388
390
|
["account_", "Account Setup"],
|
|
389
391
|
["context_", "Account & Org"],
|
|
390
392
|
["org_", "Account & Org"],
|
|
393
|
+
["billing_", "Billing"],
|
|
391
394
|
["session_", "Sessions"],
|
|
392
395
|
["workflow_", "Workflows & Questionnaires"],
|
|
393
396
|
["questionnaire_", "Workflows & Questionnaires"],
|
|
@@ -422,6 +425,8 @@ const SCOPE_AGNOSTIC_TOOLS = new Set([
|
|
|
422
425
|
"didit_account_resend_otp",
|
|
423
426
|
"didit_account_login",
|
|
424
427
|
"didit_account_verify_2fa",
|
|
428
|
+
"didit_account_device_login_start",
|
|
429
|
+
"didit_account_device_login_poll",
|
|
425
430
|
"didit_org_list",
|
|
426
431
|
"didit_context_get",
|
|
427
432
|
// Public pricing catalog: no org/app scope to resolve.
|
|
@@ -437,10 +442,13 @@ const ACCOUNT_BOOTSTRAP_TOOLS = new Set([
|
|
|
437
442
|
"didit_account_resend_otp",
|
|
438
443
|
"didit_account_login",
|
|
439
444
|
"didit_account_verify_2fa",
|
|
445
|
+
"didit_account_device_login_start",
|
|
446
|
+
"didit_account_device_login_poll",
|
|
440
447
|
]);
|
|
441
448
|
// These tools remain available in local/stdio contexts, but should not be part
|
|
442
449
|
// of the authenticated ChatGPT app catalog because public app review disallows
|
|
443
450
|
// digital-credit checkout flows and live credential/secret exposure.
|
|
451
|
+
const MONEY_TOOL = "didit_org_top_up";
|
|
444
452
|
const HOSTED_APP_EXCLUDED_TOOLS = new Set([
|
|
445
453
|
...ACCOUNT_BOOTSTRAP_TOOLS,
|
|
446
454
|
"didit_org_reveal_application_api_key",
|
|
@@ -534,6 +542,8 @@ function toolTitle(name) {
|
|
|
534
542
|
// name: revealing a live secret, moving money, consequential decisions, and overwrites.
|
|
535
543
|
const EXPLICIT_DESTRUCTIVE_TOOLS = new Set([
|
|
536
544
|
"didit_org_reveal_application_api_key",
|
|
545
|
+
// Issues a credential; clients ask before running it.
|
|
546
|
+
"didit_org_create_api_key",
|
|
537
547
|
"didit_org_top_up",
|
|
538
548
|
"didit_case_manage",
|
|
539
549
|
"didit_session_update_status",
|
|
@@ -584,12 +594,15 @@ const EXPLICIT_WRITE_TOOLS = new Set([
|
|
|
584
594
|
// requires read:workflows, and applying the graph goes through the didit_workflow_* writes).
|
|
585
595
|
const EXPLICIT_READ_TOOLS = new Set([
|
|
586
596
|
...internal_tools_1.INTERNAL_READ_TOOLS,
|
|
597
|
+
...privileged_tools_1.PRIVILEGED_READ_TOOLS,
|
|
587
598
|
// build_graph computes a graph from a plain feature spec, persisting nothing.
|
|
588
599
|
"didit_workflow_build_graph",
|
|
589
600
|
// The per-session webhook delivery log (its only verb-like token is "webhooks").
|
|
590
601
|
"didit_session_webhooks",
|
|
591
602
|
// Folds a session's decision payload and its workflow graph into the outcome trace.
|
|
592
603
|
"didit_session_explain_decision",
|
|
604
|
+
// Quotes a plan change (a GET): nothing is bought, the person confirms in the console.
|
|
605
|
+
"didit_billing_quote_plan",
|
|
593
606
|
]);
|
|
594
607
|
function annotationsFor(name) {
|
|
595
608
|
const tokens = name.replace(/^didit_/, "").split("_");
|
|
@@ -629,6 +642,13 @@ function annotationsFor(name) {
|
|
|
629
642
|
function createServer(options = {}) {
|
|
630
643
|
const hosted = options.hosted === true;
|
|
631
644
|
const profile = options.profile ?? "full";
|
|
645
|
+
// THE money gate of the hosted server. Every hosted endpoint hides and refuses didit_org_top_up
|
|
646
|
+
// unless it passes `moneyTools: true`, and only the unlisted /mcp/payments endpoint does (http.ts).
|
|
647
|
+
// It never opens on a reduced catalog profile (the ChatGPT catalog has no credit-purchase flow),
|
|
648
|
+
// and stdio is the person's own local server, where the tool is always offered. Checked in three
|
|
649
|
+
// places below: tools/list, the tools/call refusal, and the balance enrichment.
|
|
650
|
+
const moneyTools = hosted && options.moneyTools === true && profile === "full";
|
|
651
|
+
const hostedMoneyBlocked = hosted && !moneyTools;
|
|
632
652
|
// `access_token` on the auth-service discovery tools is a stdio full-profile convenience: it lets
|
|
633
653
|
// someone running the local server hand over the Bearer that didit_account_login returned.
|
|
634
654
|
// A hosted server authenticates with OAuth and reads the caller's Bearer from
|
|
@@ -679,7 +699,9 @@ function createServer(options = {}) {
|
|
|
679
699
|
},
|
|
680
700
|
{
|
|
681
701
|
name: "didit_account_verify_email",
|
|
682
|
-
description: "Verify email with the 6-character code. Returns access_token, refresh_token, organization, application (with client_id and api_key)."
|
|
702
|
+
description: "Verify email with the 6-character code. Returns access_token, refresh_token, organization, application (with client_id and api_key). " +
|
|
703
|
+
"If the account already has two-factor authentication it returns 2fa_required (and a temp_token when it has an authenticator) instead of tokens: finish with didit_account_verify_2fa. " +
|
|
704
|
+
"If the account's organization enforces SSO it returns sso_required: no token or API key is issued here, so ask the person to sign in through their organization's SSO in the Didit console in a browser; do not retry.",
|
|
683
705
|
inputSchema: {
|
|
684
706
|
type: "object",
|
|
685
707
|
properties: {
|
|
@@ -703,7 +725,9 @@ function createServer(options = {}) {
|
|
|
703
725
|
{
|
|
704
726
|
name: "didit_account_login",
|
|
705
727
|
description: "Login to existing Didit account. Returns access_token and refresh_token. If the account has two-factor " +
|
|
706
|
-
"authentication it returns 2fa_required and a temp_token instead: finish with didit_account_verify_2fa."
|
|
728
|
+
"authentication it returns 2fa_required and a temp_token instead: finish with didit_account_verify_2fa. " +
|
|
729
|
+
"If the account's organization enforces SSO it returns sso_required: no token is issued by password, so ask the person to sign in through SSO in the console, or use didit_account_device_login_start. " +
|
|
730
|
+
"For an account that signs in with a passkey or SSO (no password), use didit_account_device_login_start instead.",
|
|
707
731
|
inputSchema: {
|
|
708
732
|
type: "object",
|
|
709
733
|
properties: {
|
|
@@ -713,6 +737,19 @@ function createServer(options = {}) {
|
|
|
713
737
|
required: ["email", "password"],
|
|
714
738
|
},
|
|
715
739
|
},
|
|
740
|
+
{
|
|
741
|
+
name: "didit_account_device_login_start",
|
|
742
|
+
description: "Sign in WITHOUT a password or local browser (OAuth device code): returns a short user_code and a URL the " +
|
|
743
|
+
"person opens on any device to approve this connection. Works for passkey and SSO accounts. Then call " +
|
|
744
|
+
"didit_account_device_login_poll. Credentials are stored locally and used automatically afterwards.",
|
|
745
|
+
inputSchema: { type: "object", properties: {} },
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
name: "didit_account_device_login_poll",
|
|
749
|
+
description: "Wait (up to about 45 seconds) for the person to approve the sign-in started with " +
|
|
750
|
+
"didit_account_device_login_start. Returns status pending (call again) or connected with the granted scope.",
|
|
751
|
+
inputSchema: { type: "object", properties: {} },
|
|
752
|
+
},
|
|
716
753
|
{
|
|
717
754
|
name: "didit_account_verify_2fa",
|
|
718
755
|
description: "Finish logging in to an account with two-factor authentication, using the temp_token from didit_account_login " +
|
|
@@ -944,6 +981,27 @@ function createServer(options = {}) {
|
|
|
944
981
|
required: ["session_id"],
|
|
945
982
|
},
|
|
946
983
|
},
|
|
984
|
+
{
|
|
985
|
+
name: "didit_session_simulate",
|
|
986
|
+
description: "SANDBOX ONLY: finish a session of a sandbox application (mode 'sandbox' in didit_context_get) with the " +
|
|
987
|
+
"outcome you pick, without anyone going through the verification flow, then read it with " +
|
|
988
|
+
"didit_session_get_decision and its webhooks with didit_session_webhooks. Never billed. Pass new_status " +
|
|
989
|
+
"('Approved', 'Declined', 'In Review', 'Expired', 'Abandoned'), a scenario slug ('approve', 'decline_aml_hit', " +
|
|
990
|
+
"'decline_document_expired', 'review_aml_possible_match', ...) or a risk. A live session answers not found.",
|
|
991
|
+
inputSchema: {
|
|
992
|
+
type: "object",
|
|
993
|
+
properties: {
|
|
994
|
+
...orgapp_1.ORG_APP_PROPS,
|
|
995
|
+
session_id: { type: "string", description: "REQUIRED. A session of a sandbox application." },
|
|
996
|
+
new_status: { type: "string", enum: ["Approved", "Declined", "In Review", "Expired", "Abandoned"] },
|
|
997
|
+
scenario: { type: "string", description: "Sandbox scenario slug whose outcome to reproduce." },
|
|
998
|
+
risk: { type: "string", description: "A risk case to add as a warning." },
|
|
999
|
+
comment: { type: "string", description: "Note on the activity entry." },
|
|
1000
|
+
send_webhooks: { type: "boolean", description: "Send the webhooks a real status change sends (default true)." },
|
|
1001
|
+
},
|
|
1002
|
+
required: ["session_id"],
|
|
1003
|
+
},
|
|
1004
|
+
},
|
|
947
1005
|
{
|
|
948
1006
|
name: "didit_session_update_status",
|
|
949
1007
|
description: "Overwrite a session's decision by approving, declining, or requesting resubmission; optionally send a notification email that cannot be recalled. Before calling, obtain explicit user confirmation of the session, new decision, and any email recipient. For resubmission, pass new_status='Resubmitted' and nodes_to_resubmit; already-approved steps are kept.",
|
|
@@ -2130,32 +2188,143 @@ function createServer(options = {}) {
|
|
|
2130
2188
|
{
|
|
2131
2189
|
name: "didit_org_get_balance",
|
|
2132
2190
|
description: "Get current credit balance and auto-refill settings. Every check is billed from the first one: " +
|
|
2133
|
-
"from 1 Nov 2026
|
|
2134
|
-
"their monthly plan credit (Growth $115, Scale $350), and no workflow is free of charge.
|
|
2191
|
+
"from 1 Nov 2026 an eligible Free organization gets $10 of monthly credit usable on any feature, paid " +
|
|
2192
|
+
"plans carry their monthly plan credit (Growth $115, Scale $350), and no workflow is free of charge. " +
|
|
2193
|
+
"The Free credit is decided per organization: `free_credit.receives` says whether this one gets it, " +
|
|
2194
|
+
"and `free_credit.this_month` holds this month's credit, also once used up. `free_credit.eligibility` " +
|
|
2195
|
+
"says why an organization does NOT get it, because the credit needs a work email: personal_email " +
|
|
2196
|
+
"means it signed up with a personal email, temporary_email with a temporary one, company_exists " +
|
|
2197
|
+
"that its company already has an organization, api_created that it was created through the API. " +
|
|
2198
|
+
"Such an organization never had the credit, so it was not used up. Answer from these fields, never " +
|
|
2199
|
+
"from the plan alone; when `free_credit` is absent, say you could not read it. Never answer " +
|
|
2135
2200
|
"a \"not enough credits\" report from this result alone: read the failing workflow with " +
|
|
2136
2201
|
"didit_workflow_list first - `is_white_label_enabled: true` adds $0.20/session, which is a common " +
|
|
2137
2202
|
"cause of credit running out faster than expected. This result also carries `allow_free_usage` " +
|
|
2138
2203
|
"(organizations on negotiated terms keep the monthly free allowance they were sold until renewal; " +
|
|
2139
|
-
"false means that allowance is off for this organization) and `usage_summary.white_label_sessions`."
|
|
2204
|
+
"false means that allowance is off for this organization) and `usage_summary.white_label_sessions`. " +
|
|
2205
|
+
"When the balance cannot cover what the person wants to run, give them `next_steps.top_up_url` (the console " +
|
|
2206
|
+
"top-up dialog with the amount filled in; replace the number to change it) or `next_steps.automatic_top_up_url` " +
|
|
2207
|
+
"(save a card and turn on automatic top-up so the balance never runs out). Didit tools never charge a card. " +
|
|
2208
|
+
"Meanwhile keep building in the organization's sandbox application (`mode: sandbox` in didit_context_get), " +
|
|
2209
|
+
"which is never billed.",
|
|
2140
2210
|
inputSchema: { type: "object", properties: { organization_id: orgapp_1.ORG_APP_PROPS.organization_id } },
|
|
2141
2211
|
},
|
|
2142
2212
|
{
|
|
2143
2213
|
name: "didit_org_top_up",
|
|
2144
|
-
description: "
|
|
2214
|
+
description: "Top up credits ($50 to $20,000 per top-up). payment_method \"checkout\" (default) creates a Stripe Checkout " +
|
|
2215
|
+
"page and returns checkout_session_url for the person to pay; it never charges a card by itself. " +
|
|
2216
|
+
"payment_method \"saved_card\" charges the organization's saved primary card off-session, now, when a person " +
|
|
2217
|
+
"turned on \"Connected AI agents can top up with your saved card\" in the Didit console (Billing > Payment " +
|
|
2218
|
+
"methods; off by default; didit_org_get_balance shows it as agent_top_up.enabled where this tool is offered). " +
|
|
2219
|
+
"It needs idempotency_key: choose ONE unique key per intended top-up (for example a UUID) and reuse that same " +
|
|
2220
|
+
"key on any retry of that same top-up, so a retry can never charge twice; never reuse a key for another " +
|
|
2221
|
+
"amount and never retry with a new key. A refusal carries `code`, `detail` and `next_step` {action, url, " +
|
|
2222
|
+
"description}: agent_top_up_not_enabled (the switch is off), authentication_required (the card's bank asks the " +
|
|
2223
|
+
"cardholder to approve), payment_method_required (no saved card) and card_declined are finished by the " +
|
|
2224
|
+
"person: give them next_step.url (a Top up dialog link that says which agent asked, with the amount filled in).",
|
|
2145
2225
|
inputSchema: {
|
|
2146
2226
|
type: "object",
|
|
2147
2227
|
properties: {
|
|
2228
|
+
organization_id: orgapp_1.ORG_APP_PROPS.organization_id,
|
|
2148
2229
|
amount_in_dollars: { type: "number", description: "Amount in USD (minimum $50, maximum $20,000 per self-serve top-up)" },
|
|
2149
|
-
|
|
2150
|
-
|
|
2230
|
+
payment_method: {
|
|
2231
|
+
type: "string",
|
|
2232
|
+
enum: ["checkout", "saved_card"],
|
|
2233
|
+
description: "checkout (default): a Stripe Checkout page for the person to pay. saved_card: charge the organization's saved primary card now, only while a person has turned on the agent top-up switch in the console; requires idempotency_key.",
|
|
2234
|
+
},
|
|
2235
|
+
idempotency_key: {
|
|
2236
|
+
type: "string",
|
|
2237
|
+
minLength: 1,
|
|
2238
|
+
maxLength: 255,
|
|
2239
|
+
description: "REQUIRED for payment_method saved_card (1 to 255 characters). One unique key per intended top-up; reuse the same key on any retry of that same top-up so the card is never charged twice. Ignored for checkout.",
|
|
2240
|
+
},
|
|
2151
2241
|
confirm: {
|
|
2152
2242
|
type: "boolean",
|
|
2153
|
-
description: "REQUIRED. Must be true
|
|
2243
|
+
description: "REQUIRED. Must be true. Only set after explicit user confirmation of this exact action: checkout creates a payment page, saved_card charges the saved card immediately.",
|
|
2154
2244
|
},
|
|
2155
2245
|
},
|
|
2156
2246
|
required: ["amount_in_dollars"],
|
|
2157
2247
|
},
|
|
2158
2248
|
},
|
|
2249
|
+
{
|
|
2250
|
+
name: "didit_billing_get_plan",
|
|
2251
|
+
description: "Get the organization's plan: the plan and its status, monthly fee and credit, the next charge, the last " +
|
|
2252
|
+
"payment, any unpaid invoice and any scheduled plan change. `next_steps.plans_url` is the console page where " +
|
|
2253
|
+
"the person changes the plan.",
|
|
2254
|
+
inputSchema: { type: "object", properties: { organization_id: orgapp_1.ORG_APP_PROPS.organization_id } },
|
|
2255
|
+
},
|
|
2256
|
+
{
|
|
2257
|
+
name: "didit_billing_quote_plan",
|
|
2258
|
+
description: "Quote a plan change without making it: what it charges today (`amount_due`), the credit it adds " +
|
|
2259
|
+
"(`credit_added`) and the billing period. Plans: free, growth ($99/month, $115 of credit a month, 4% off every " +
|
|
2260
|
+
"price), scale ($299/month, $350 of credit a month, 10% off); yearly billing is cheaper. Show the person the " +
|
|
2261
|
+
"quote; they confirm and pay on `next_steps.plans_url` (Didit tools never buy a plan).",
|
|
2262
|
+
inputSchema: {
|
|
2263
|
+
type: "object",
|
|
2264
|
+
properties: {
|
|
2265
|
+
organization_id: orgapp_1.ORG_APP_PROPS.organization_id,
|
|
2266
|
+
plan: { type: "string", enum: ["free", "growth", "scale"], description: "The plan to quote." },
|
|
2267
|
+
billing_interval: { type: "string", enum: ["monthly", "yearly"], description: "Defaults to monthly." },
|
|
2268
|
+
},
|
|
2269
|
+
required: ["plan"],
|
|
2270
|
+
},
|
|
2271
|
+
},
|
|
2272
|
+
{
|
|
2273
|
+
name: "didit_billing_list_payment_methods",
|
|
2274
|
+
description: "List the organization's saved cards (brand, last 4 digits, expiry) in the order automatic charges try them, " +
|
|
2275
|
+
"card 1 being the primary. An empty list means no card is saved: top-ups then go through Checkout or the " +
|
|
2276
|
+
"console. `next_steps.add_card_url` is where the person adds a card or turns on automatic top-up.",
|
|
2277
|
+
inputSchema: { type: "object", properties: { organization_id: orgapp_1.ORG_APP_PROPS.organization_id } },
|
|
2278
|
+
},
|
|
2279
|
+
{
|
|
2280
|
+
name: "didit_billing_list_receipts",
|
|
2281
|
+
description: "List the organization's payment receipts (top-ups and plan charges), newest first.",
|
|
2282
|
+
inputSchema: {
|
|
2283
|
+
type: "object",
|
|
2284
|
+
properties: {
|
|
2285
|
+
organization_id: orgapp_1.ORG_APP_PROPS.organization_id,
|
|
2286
|
+
limit: { type: "number", description: "Page size (default set by the server)." },
|
|
2287
|
+
offset: { type: "number", description: "Rows to skip." },
|
|
2288
|
+
},
|
|
2289
|
+
},
|
|
2290
|
+
},
|
|
2291
|
+
{
|
|
2292
|
+
name: "didit_billing_get_details",
|
|
2293
|
+
description: "Get the billing details printed on every receipt and invoice: legal name, tax ID, address, billing emails " +
|
|
2294
|
+
"and PO number.",
|
|
2295
|
+
inputSchema: { type: "object", properties: { organization_id: orgapp_1.ORG_APP_PROPS.organization_id } },
|
|
2296
|
+
},
|
|
2297
|
+
{
|
|
2298
|
+
name: "didit_billing_update_details",
|
|
2299
|
+
description: "Change the billing details printed on receipts and invoices. Pass only the fields to change; the rest " +
|
|
2300
|
+
"keep their saved values. Before calling, show the person each change and get their confirmation. When " +
|
|
2301
|
+
"the organization confirms billing changes with an authenticator code, the change is refused and the " +
|
|
2302
|
+
"person saves it in the console instead (the error names the page).",
|
|
2303
|
+
inputSchema: {
|
|
2304
|
+
type: "object",
|
|
2305
|
+
properties: {
|
|
2306
|
+
organization_id: orgapp_1.ORG_APP_PROPS.organization_id,
|
|
2307
|
+
legal_name: { type: "string", description: "The company's legal name." },
|
|
2308
|
+
tax_id_type: { type: "string", description: "Stripe tax ID type, e.g. eu_vat, gb_vat, us_ein. Needs tax_id." },
|
|
2309
|
+
tax_id: { type: "string", description: "The tax ID number. Needs tax_id_type." },
|
|
2310
|
+
address: {
|
|
2311
|
+
type: "object",
|
|
2312
|
+
description: "Billing address; only the lines passed change.",
|
|
2313
|
+
properties: {
|
|
2314
|
+
line1: { type: "string" },
|
|
2315
|
+
line2: { type: "string" },
|
|
2316
|
+
city: { type: "string" },
|
|
2317
|
+
state: { type: "string" },
|
|
2318
|
+
postal_code: { type: "string" },
|
|
2319
|
+
country: { type: "string", description: "ISO 3166-1 alpha-2, e.g. ES, US." },
|
|
2320
|
+
},
|
|
2321
|
+
additionalProperties: false,
|
|
2322
|
+
},
|
|
2323
|
+
billing_emails: { type: "array", items: { type: "string" }, description: "Addresses that receive receipts and invoices (replaces the list)." },
|
|
2324
|
+
po_number: { type: "string", description: "Purchase order number printed on invoices." },
|
|
2325
|
+
},
|
|
2326
|
+
},
|
|
2327
|
+
},
|
|
2159
2328
|
// ── Customization (verification UI branding) ────────────────────────
|
|
2160
2329
|
{
|
|
2161
2330
|
name: "didit_branding_get",
|
|
@@ -2822,10 +2991,41 @@ function createServer(options = {}) {
|
|
|
2822
2991
|
description: "List the roles available in the organization.",
|
|
2823
2992
|
inputSchema: { type: "object", properties: { organization_id: orgapp_1.ORG_APP_PROPS.organization_id } },
|
|
2824
2993
|
},
|
|
2994
|
+
{
|
|
2995
|
+
name: "didit_org_create_api_key",
|
|
2996
|
+
description: "Create the API key the integration you are building needs (sent as x-api-key to the verification API), " +
|
|
2997
|
+
"for one application. Didit allows ONE live key per connected app and application, scoped to what the " +
|
|
2998
|
+
"signed-in person can do (never full access, never API key management), rate-limited and audit-logged; " +
|
|
2999
|
+
"the person sees it with this connected app in the console and can revoke it there. The secret is returned " +
|
|
3000
|
+
"ONCE: write it straight to the project's secret store or .env and never repeat it in the chat. Pick the " +
|
|
3001
|
+
"application by its mode in didit_context_get: a sandbox key to build and test for free, a live key to go " +
|
|
3002
|
+
"live. Requires confirm:true after the person agreed.",
|
|
3003
|
+
inputSchema: {
|
|
3004
|
+
type: "object",
|
|
3005
|
+
properties: {
|
|
3006
|
+
organization_id: { type: "string", description: "REQUIRED. The organization (from didit_context_get)." },
|
|
3007
|
+
application_id: { type: "string", description: "REQUIRED. The application the key is for (from didit_context_get)." },
|
|
3008
|
+
label: { type: "string", description: "Name shown in the console, e.g. 'Acme backend (Codex)'." },
|
|
3009
|
+
scopes: {
|
|
3010
|
+
type: "object",
|
|
3011
|
+
description: "Optional narrower access: resource -> 'read' | 'write' (sessions, decisions, media, users, businesses, " +
|
|
3012
|
+
"transactions, workflows, webhooks, applications, analytics). Omit it for everything the person can do.",
|
|
3013
|
+
additionalProperties: { type: "string", enum: ["read", "write"] },
|
|
3014
|
+
},
|
|
3015
|
+
workflow_ids: { type: "array", items: { type: "string" }, description: "Optional: only these workflows' sessions (needs scopes)." },
|
|
3016
|
+
expires_at: { type: "string", description: "Optional ISO 8601 expiry." },
|
|
3017
|
+
confirm: {
|
|
3018
|
+
type: "boolean",
|
|
3019
|
+
description: "REQUIRED. Must be true - issues a credential shown once. Only set after explicit user confirmation of this exact action.",
|
|
3020
|
+
},
|
|
3021
|
+
},
|
|
3022
|
+
required: ["organization_id", "application_id", "confirm"],
|
|
3023
|
+
},
|
|
3024
|
+
},
|
|
2825
3025
|
{
|
|
2826
3026
|
name: "didit_org_list_api_keys",
|
|
2827
|
-
description: "List API key metadata with raw key values redacted
|
|
2828
|
-
inputSchema: { type: "object", properties: { ...orgapp_1.ORG_APP_PROPS } },
|
|
3027
|
+
description: "List one application's API key metadata with raw key values redacted. API keys belong to an application, so application_id is required: read it from didit_context_get.",
|
|
3028
|
+
inputSchema: { type: "object", properties: { ...orgapp_1.ORG_APP_PROPS }, required: ["application_id"] },
|
|
2829
3029
|
},
|
|
2830
3030
|
// ── Compliance ──────────────────────────────────────────────────────
|
|
2831
3031
|
...(0, internal_tools_1.internalToolDefs)("compliance"),
|
|
@@ -2948,8 +3148,13 @@ function createServer(options = {}) {
|
|
|
2948
3148
|
// checkout / secret-reveal tools — the public app catalog must stay free of
|
|
2949
3149
|
// credential-collection, checkout, and secret-reveal flows. Privileged (staff)
|
|
2950
3150
|
// callers and local stdio setups keep the full catalog.
|
|
2951
|
-
|
|
2952
|
-
|
|
3151
|
+
// Only a remote (HTTP) request carries authInfo. A local stdio server started with
|
|
3152
|
+
// DIDIT_ACCESS_TOKEN is a local setup and keeps the full catalog, as documented; counting
|
|
3153
|
+
// that env token as a remote Bearer hid didit_org_top_up and the key reveal from it.
|
|
3154
|
+
const remoteBearer = Boolean(extra?.authInfo?.token);
|
|
3155
|
+
let catalog = remoteBearer && !isPrivileged
|
|
3156
|
+
? tools.filter((t) => !HOSTED_APP_EXCLUDED_TOOLS.has(t.name) || (moneyTools && t.name === MONEY_TOOL))
|
|
3157
|
+
: tools;
|
|
2953
3158
|
// Remote connectors authenticate with OAuth, so account credentials must never travel
|
|
2954
3159
|
// through the conversation: hosted servers drop the bootstrap tools for EVERY caller
|
|
2955
3160
|
// (staff included), regardless of Bearer state. They remain available on stdio.
|
|
@@ -3014,11 +3219,16 @@ function createServer(options = {}) {
|
|
|
3014
3219
|
targetOrg: argOrg || tokenOrg,
|
|
3015
3220
|
});
|
|
3016
3221
|
const permissionCheck = permission === "would_deny" ? permission : undefined;
|
|
3222
|
+
// Local sign-in (device code): only a stdio server with no Bearer of its own reads the stored
|
|
3223
|
+
// credentials, so hosted mode and DIDIT_ACCESS_TOKEN setups are untouched.
|
|
3224
|
+
const storedToken = !authInfo?.token && !hosted && !process.env.DIDIT_ACCESS_TOKEN && !ACCOUNT_BOOTSTRAP_TOOLS.has(request.params.name)
|
|
3225
|
+
? await storedDeviceLoginToken()
|
|
3226
|
+
: undefined;
|
|
3017
3227
|
return config_1.requestContext.run({
|
|
3018
3228
|
// Hosted mode: per-request Bearer from OAuth introspection. Stdio mode (tests/eval):
|
|
3019
3229
|
// fall back to DIDIT_ACCESS_TOKEN + MCP_DEFAULT_ORG/APP env so the console-path tools
|
|
3020
3230
|
// authenticate as that Bearer without the hosted layer.
|
|
3021
|
-
accessToken: authInfo?.token || process.env.DIDIT_ACCESS_TOKEN || undefined,
|
|
3231
|
+
accessToken: authInfo?.token || process.env.DIDIT_ACCESS_TOKEN || storedToken || undefined,
|
|
3022
3232
|
organizationId: argOrg ||
|
|
3023
3233
|
authInfo?.extra?.organization_id ||
|
|
3024
3234
|
process.env.MCP_DEFAULT_ORG ||
|
|
@@ -3068,6 +3278,41 @@ function createServer(options = {}) {
|
|
|
3068
3278
|
isError: true,
|
|
3069
3279
|
};
|
|
3070
3280
|
}
|
|
3281
|
+
// Mirror of the tools/list exclusion for the secret-reveal tool: a remote Bearer that is not
|
|
3282
|
+
// staff never has it listed, so it never runs it either, whatever scopes the token carries.
|
|
3283
|
+
// Leaving a tool out of tools/list is not access control; this refusal is (2026-11-10 report:
|
|
3284
|
+
// an openid-only grant called the unlisted reveal tool directly). The money tool has its own
|
|
3285
|
+
// refusal below, with a link the person can pay through.
|
|
3286
|
+
if (authInfo?.token &&
|
|
3287
|
+
!(0, privileged_tools_1.isPrivilegedCaller)(authInfo, { hosted }) &&
|
|
3288
|
+
HOSTED_APP_EXCLUDED_TOOLS.has(name) &&
|
|
3289
|
+
name !== MONEY_TOOL) {
|
|
3290
|
+
return {
|
|
3291
|
+
content: [
|
|
3292
|
+
{
|
|
3293
|
+
type: "text",
|
|
3294
|
+
text: `Tool '${name}' is not available to a remote connector. Copy the API key from the application's page in the Didit console, or use the local stdio server (npx @didit-protocol/mcp-server).`,
|
|
3295
|
+
},
|
|
3296
|
+
],
|
|
3297
|
+
isError: true,
|
|
3298
|
+
};
|
|
3299
|
+
}
|
|
3300
|
+
// Mirror of the tools/list exclusion for the one money tool: a remote connector never creates
|
|
3301
|
+
// a payment page itself, even when a client calls the unlisted name. The person pays in the
|
|
3302
|
+
// console, through the link didit_org_get_balance returns.
|
|
3303
|
+
// saved_card moves money with no person present, so not even a staff caller gets it on an endpoint
|
|
3304
|
+
// that is not the payments one; staff keep the Checkout page they always had.
|
|
3305
|
+
if (hostedMoneyBlocked &&
|
|
3306
|
+
name === MONEY_TOOL &&
|
|
3307
|
+
(!(0, privileged_tools_1.isPrivilegedCaller)(authInfo, { hosted }) || callArgs?.payment_method === "saved_card")) {
|
|
3308
|
+
// A signed request link creates no payment and moves no money, so it is allowed here; best
|
|
3309
|
+
// effort, the static text below is the fallback.
|
|
3310
|
+
const signedUrl = await billing.signedTopUpLink(callArgs?.amount_in_dollars ?? callArgs?.amount, callArgs?.organization_id);
|
|
3311
|
+
const text = signedUrl
|
|
3312
|
+
? `Top-ups are paid by the person in the Didit console. Give them this link: ${signedUrl} (it opens the top-up dialog with the amount filled in and says which agent asked; nothing is charged until they pay), or next_steps.automatic_top_up_url from didit_org_get_balance.`
|
|
3313
|
+
: "Top-ups are paid by the person in the Didit console. Call didit_org_get_balance and give them next_steps.top_up_url (the top-up dialog with the amount filled in) or next_steps.automatic_top_up_url.";
|
|
3314
|
+
return { content: [{ type: "text", text }], isError: true };
|
|
3315
|
+
}
|
|
3071
3316
|
// Mirror of the tools/list catalog profile: a tool (or an input property) the endpoint does
|
|
3072
3317
|
// not offer is refused even if the client memorised it from the full catalog.
|
|
3073
3318
|
const profileRefusal = (0, chatgpt_app_1.catalogProfileRefusal)(profile, name, callArgs);
|
|
@@ -3126,6 +3371,12 @@ function createServer(options = {}) {
|
|
|
3126
3371
|
case "didit_account_login":
|
|
3127
3372
|
result = await auth.login(args.email, args.password);
|
|
3128
3373
|
break;
|
|
3374
|
+
case "didit_account_device_login_start":
|
|
3375
|
+
result = await auth.deviceLoginStart();
|
|
3376
|
+
break;
|
|
3377
|
+
case "didit_account_device_login_poll":
|
|
3378
|
+
result = await auth.deviceLoginPoll();
|
|
3379
|
+
break;
|
|
3129
3380
|
case "didit_account_verify_2fa":
|
|
3130
3381
|
result = await auth.verify2fa(args.temp_token, args.code);
|
|
3131
3382
|
break;
|
|
@@ -3177,6 +3428,11 @@ function createServer(options = {}) {
|
|
|
3177
3428
|
case "didit_session_get_location_evidence":
|
|
3178
3429
|
result = await sessions.getSessionLocationEvidence(args.session_id);
|
|
3179
3430
|
break;
|
|
3431
|
+
case "didit_session_simulate": {
|
|
3432
|
+
const { session_id, ...data } = args;
|
|
3433
|
+
result = await sessions.simulateSandboxSession(session_id, data);
|
|
3434
|
+
break;
|
|
3435
|
+
}
|
|
3180
3436
|
case "didit_session_update_status": {
|
|
3181
3437
|
const { session_id, ...data } = args;
|
|
3182
3438
|
result = await sessions.updateSessionStatus(session_id, data);
|
|
@@ -3436,11 +3692,38 @@ function createServer(options = {}) {
|
|
|
3436
3692
|
break;
|
|
3437
3693
|
// Billing
|
|
3438
3694
|
case "didit_org_get_balance":
|
|
3439
|
-
|
|
3695
|
+
// The ChatGPT catalog carries no credit-purchase flow (app review), so no top-up links there.
|
|
3696
|
+
result = await billing.getBalance(args?.organization_id, {
|
|
3697
|
+
links: profile !== "chatgpt",
|
|
3698
|
+
// The agent top-up switch only where an agent may top up: /mcp/payments and stdio.
|
|
3699
|
+
agentTopUp: profile === "full" && !hostedMoneyBlocked,
|
|
3700
|
+
});
|
|
3440
3701
|
break;
|
|
3441
3702
|
case "didit_org_top_up":
|
|
3442
|
-
result = await billing.topUp((args?.amount_in_dollars ?? args?.amount), args?.confirm, args?.
|
|
3703
|
+
result = await billing.topUp((args?.amount_in_dollars ?? args?.amount), args?.confirm, args?.organization_id, { payment_method: args?.payment_method, idempotency_key: args?.idempotency_key });
|
|
3704
|
+
break;
|
|
3705
|
+
case "didit_billing_get_plan":
|
|
3706
|
+
result = await billing.getPlan(args?.organization_id);
|
|
3707
|
+
break;
|
|
3708
|
+
case "didit_billing_quote_plan":
|
|
3709
|
+
result = await billing.quotePlan(args?.plan, args?.billing_interval, args?.organization_id);
|
|
3710
|
+
break;
|
|
3711
|
+
case "didit_billing_list_payment_methods":
|
|
3712
|
+
result = await billing.listPaymentMethods(args?.organization_id);
|
|
3443
3713
|
break;
|
|
3714
|
+
case "didit_billing_list_receipts":
|
|
3715
|
+
result = await billing.listReceipts(args?.organization_id, args?.limit, args?.offset);
|
|
3716
|
+
break;
|
|
3717
|
+
case "didit_billing_get_details":
|
|
3718
|
+
result = await billing.getBillingDetails(args?.organization_id);
|
|
3719
|
+
break;
|
|
3720
|
+
case "didit_billing_update_details": {
|
|
3721
|
+
// The dispatcher already moved organization_id into the request context (stripRoutingIds);
|
|
3722
|
+
// dropping it here too keeps the handler correct if that ever changes.
|
|
3723
|
+
const { organization_id: _org, application_id: _app, ...changes } = (args ?? {});
|
|
3724
|
+
result = await billing.updateBillingDetails(changes);
|
|
3725
|
+
break;
|
|
3726
|
+
}
|
|
3444
3727
|
// Customization
|
|
3445
3728
|
case "didit_branding_get":
|
|
3446
3729
|
result = await customization.getCustomization();
|
|
@@ -3638,7 +3921,11 @@ function createServer(options = {}) {
|
|
|
3638
3921
|
result = await members.listRoles(args?.organization_id);
|
|
3639
3922
|
break;
|
|
3640
3923
|
case "didit_org_list_api_keys":
|
|
3641
|
-
|
|
3924
|
+
// Routing ids are stripped from args above; the ones the caller sent are argOrg / argApp.
|
|
3925
|
+
result = await members.listApiKeys(argOrg, argApp);
|
|
3926
|
+
break;
|
|
3927
|
+
case "didit_org_create_api_key":
|
|
3928
|
+
result = await members.createApiKey(argOrg, argApp, (args ?? {}));
|
|
3642
3929
|
break;
|
|
3643
3930
|
// Compliance
|
|
3644
3931
|
case "didit_workflow_build_graph":
|
|
@@ -3673,8 +3960,10 @@ function createServer(options = {}) {
|
|
|
3673
3960
|
const fieldLine = shape.field ? `\nField: ${shape.field}` : "";
|
|
3674
3961
|
const hintLine = shape.hint ? `\nHint: ${shape.hint}` : "";
|
|
3675
3962
|
const allowedLine = shape.allowed && shape.allowed.length ? `\nAllowed: ${shape.allowed.join(", ")}` : "";
|
|
3963
|
+
// A backend refusal that names where a person finishes the action (agent top-ups) passes it on unchanged.
|
|
3964
|
+
const nextStepLine = shape.next_step ? `\nNext step: ${JSON.stringify(shape.next_step)}` : "";
|
|
3676
3965
|
return {
|
|
3677
|
-
content: [{ type: "text", text: `Error [${shape.code}]: ${shape.message}${fieldLine}${hintLine}${allowedLine}` }],
|
|
3966
|
+
content: [{ type: "text", text: `Error [${shape.code}]: ${shape.message}${fieldLine}${hintLine}${allowedLine}${nextStepLine}` }],
|
|
3678
3967
|
isError: true,
|
|
3679
3968
|
};
|
|
3680
3969
|
}
|
|
@@ -3682,7 +3971,24 @@ function createServer(options = {}) {
|
|
|
3682
3971
|
});
|
|
3683
3972
|
return server;
|
|
3684
3973
|
}
|
|
3974
|
+
// Never throws: a revoked grant is reported once on stderr and the tool then fails like any
|
|
3975
|
+
// unauthenticated call. The message carries no token.
|
|
3976
|
+
async function storedDeviceLoginToken() {
|
|
3977
|
+
try {
|
|
3978
|
+
return await (0, device_login_1.getStoredAccessToken)();
|
|
3979
|
+
}
|
|
3980
|
+
catch (err) {
|
|
3981
|
+
if (err instanceof device_login_1.DeviceLoginError)
|
|
3982
|
+
console.error(`Didit: ${err.message}`);
|
|
3983
|
+
return undefined;
|
|
3984
|
+
}
|
|
3985
|
+
}
|
|
3685
3986
|
async function main() {
|
|
3987
|
+
const cliCommand = (0, login_cli_1.loginCliCommand)(process.argv.slice(2));
|
|
3988
|
+
if (cliCommand) {
|
|
3989
|
+
process.exitCode = await (0, login_cli_1.runLoginCli)(cliCommand);
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3686
3992
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
3687
3993
|
const server = createServer({ profile: (0, chatgpt_app_1.stdioCatalogProfile)() });
|
|
3688
3994
|
await server.connect(transport);
|