@raytio/mcp-server 10.4.1 → 10.6.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/dist/capabilities/tool-capability.d.ts.map +1 -1
- package/dist/capabilities/tool-capability.js +9 -0
- package/dist/capabilities/tool-capability.js.map +1 -1
- package/dist/raytio/api-client.d.ts.map +1 -1
- package/dist/raytio/api-client.js +3 -0
- package/dist/raytio/api-client.js.map +1 -1
- package/dist/tools/_shared/idempotent-create.d.ts +4 -0
- package/dist/tools/_shared/idempotent-create.d.ts.map +1 -0
- package/dist/tools/_shared/idempotent-create.js +17 -0
- package/dist/tools/_shared/idempotent-create.js.map +1 -0
- package/dist/tools/_shared/side-effect.d.ts +3 -8
- package/dist/tools/_shared/side-effect.d.ts.map +1 -1
- package/dist/tools/_shared/side-effect.js +5 -10
- package/dist/tools/_shared/side-effect.js.map +1 -1
- package/dist/tools/fgl/journal-batch-create.d.ts.map +1 -1
- package/dist/tools/fgl/journal-batch-create.js +24 -78
- package/dist/tools/fgl/journal-batch-create.js.map +1 -1
- package/dist/tools/fxm/fxm-funds-account-consent-grant.d.ts +2 -3
- package/dist/tools/fxm/fxm-funds-account-consent-grant.d.ts.map +1 -1
- package/dist/tools/fxm/fxm-funds-account-consent-grant.js +9 -11
- package/dist/tools/fxm/fxm-funds-account-consent-grant.js.map +1 -1
- package/dist/tools/fxm/fxm-payment-method-register.d.ts +1 -3
- package/dist/tools/fxm/fxm-payment-method-register.d.ts.map +1 -1
- package/dist/tools/fxm/fxm-payment-method-register.js +8 -11
- package/dist/tools/fxm/fxm-payment-method-register.js.map +1 -1
- package/dist/tools/imports/index.d.ts +8 -8
- package/dist/tools/imports/index.d.ts.map +1 -1
- package/dist/tools/imports/index.js +23 -3
- package/dist/tools/imports/index.js.map +1 -1
- package/dist/tools/ppm/template-instantiate.d.ts.map +1 -1
- package/dist/tools/ppm/template-instantiate.js +9 -5
- package/dist/tools/ppm/template-instantiate.js.map +1 -1
- package/dist/tools/ppm/work-item-create.d.ts.map +1 -1
- package/dist/tools/ppm/work-item-create.js +6 -2
- package/dist/tools/ppm/work-item-create.js.map +1 -1
- package/dist/tools/prm/prm-party-create.d.ts.map +1 -1
- package/dist/tools/prm/prm-party-create.js +6 -2
- package/dist/tools/prm/prm-party-create.js.map +1 -1
- package/dist/tools/sfa/deal-create.d.ts.map +1 -1
- package/dist/tools/sfa/deal-create.js +6 -2
- package/dist/tools/sfa/deal-create.js.map +1 -1
- package/dist/tools/sfa/deal-line-create.d.ts.map +1 -1
- package/dist/tools/sfa/deal-line-create.js +6 -2
- package/dist/tools/sfa/deal-line-create.js.map +1 -1
- package/dist/tools/sfa/lead-create.d.ts.map +1 -1
- package/dist/tools/sfa/lead-create.js +6 -2
- package/dist/tools/sfa/lead-create.js.map +1 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +3 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/tools/wrm/wrm-agent-run-create.d.ts.map +1 -1
- package/dist/tools/wrm/wrm-agent-run-create.js +8 -2
- package/dist/tools/wrm/wrm-agent-run-create.js.map +1 -1
- package/dist/tools/wrm/wrm-credential-request-create.d.ts.map +1 -1
- package/dist/tools/wrm/wrm-credential-request-create.js +30 -78
- package/dist/tools/wrm/wrm-credential-request-create.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { idempotencyKeySchema } from '../_shared/side-effect.js';
|
|
2
|
+
import { rpcCap } from '../../capabilities/tool-capability.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
|
-
import { successResponse, errorResponse,
|
|
3
|
-
import { WRM_WORKER_SELECT } from '../../wrm/projection.js';
|
|
4
|
-
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { successResponse, errorResponse, API_ERROR } from '../types.js';
|
|
5
5
|
export const credentialRequestCreateTool = {
|
|
6
6
|
name: 'wrm_credential_request_create',
|
|
7
7
|
description: 'Creates a credential request for an agent worker. Builds an Access Application (AA), ' +
|
|
8
8
|
'adds the worker to the AA guest list, creates credential and request records, ' +
|
|
9
9
|
'and notifies the specified human user to share the credential via the AA flow. ' +
|
|
10
10
|
'Returns { request_id, aa_id, credential_id }.',
|
|
11
|
+
idempotency: 'explicit_key',
|
|
11
12
|
inputSchema: z.object({
|
|
13
|
+
idempotency_key: idempotencyKeySchema,
|
|
12
14
|
worker_id: z.string().describe('UUID of the requesting worker'),
|
|
13
15
|
credential_name: z.string().describe('Name identifying this credential (e.g. "github_api_token")'),
|
|
14
16
|
credential_type: z
|
|
@@ -19,85 +21,35 @@ export const credentialRequestCreateTool = {
|
|
|
19
21
|
ttl_seconds: z.number().optional().describe('Credential TTL in seconds (default 3600)'),
|
|
20
22
|
work_item_id: z.string().optional().describe('UUID of the related PPM work item (optional)'),
|
|
21
23
|
}),
|
|
22
|
-
capabilities: [
|
|
23
|
-
cap('wrm_workers', 'SELECT'),
|
|
24
|
-
cap('dsm_access_application_users', 'INSERT'),
|
|
25
|
-
cap('dsm_access_applications', 'INSERT'),
|
|
26
|
-
cap('wrm_credential_requests', 'INSERT'),
|
|
27
|
-
cap('wrm_worker_credentials', 'INSERT'),
|
|
28
|
-
// NOTE: Step 6 also POSTs /db/v1/fnd_notifications, but that call is
|
|
29
|
-
// fire-and-forget and explicitly non-fatal. Declaring it as a hard
|
|
30
|
-
// requirement hides this whole tool from callers who hold every
|
|
31
|
-
// permission it actually needs, so it is registered as an optional
|
|
32
|
-
// endpoint in capability-completeness.test.ts instead of declared
|
|
33
|
-
// here. See OPTIONAL_ENDPOINTS there for the rationale.
|
|
34
|
-
],
|
|
24
|
+
capabilities: [...rpcCap('wrm_create_credential_request')],
|
|
35
25
|
handler: async (args, ctx) => {
|
|
36
26
|
const input = args;
|
|
37
27
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const aaRecords = await ctx.apiClient.post('/db/v1/dsm_access_applications?select=id', {
|
|
52
|
-
name: `Credential Request: ${input.credential_name}`,
|
|
53
|
-
description: input.purpose,
|
|
54
|
-
}, { headers: { Prefer: 'return=representation' } });
|
|
55
|
-
const aaId = aaRecords[0].id;
|
|
56
|
-
// Step 3: Add worker's user_id to AA guest list
|
|
57
|
-
await ctx.apiClient.post('/db/v1/dsm_access_application_users', { aa_id: aaId, user_id: worker.user_id }, { headers: { Prefer: 'return=representation' } });
|
|
58
|
-
// Step 4: Create credential record (status=PENDING, encrypted_value empty until fulfilled)
|
|
59
|
-
const credBody = {
|
|
60
|
-
worker_id: input.worker_id,
|
|
61
|
-
credential_name: input.credential_name,
|
|
62
|
-
credential_type: input.credential_type,
|
|
63
|
-
encrypted_value: {},
|
|
64
|
-
source_aa_id: aaId,
|
|
65
|
-
expires_at: expiresAt,
|
|
66
|
-
status: 'PENDING',
|
|
67
|
-
request_context: {
|
|
68
|
-
purpose: input.purpose,
|
|
69
|
-
work_item_id: input.work_item_id ?? null,
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
const credRecords = await ctx.apiClient.post('/db/v1/wrm_worker_credentials?select=id', credBody, { headers: { Prefer: 'return=representation' } });
|
|
73
|
-
const credentialId = credRecords[0].id;
|
|
74
|
-
// Step 5: Create credential request record (tracks lifecycle)
|
|
75
|
-
const reqBody = {
|
|
76
|
-
worker_id: input.worker_id,
|
|
77
|
-
requested_from_user_id: input.request_from_user_id,
|
|
78
|
-
aa_id: aaId,
|
|
79
|
-
credential_id: credentialId,
|
|
80
|
-
credential_name: input.credential_name,
|
|
81
|
-
credential_type: input.credential_type,
|
|
82
|
-
purpose: input.purpose,
|
|
83
|
-
ttl_seconds: ttl,
|
|
84
|
-
status: 'PENDING',
|
|
85
|
-
};
|
|
86
|
-
if (input.work_item_id)
|
|
87
|
-
reqBody.work_item_id = input.work_item_id;
|
|
88
|
-
const reqRecords = await ctx.apiClient.post('/db/v1/wrm_credential_requests?select=id', reqBody, { headers: { Prefer: 'return=representation' } });
|
|
89
|
-
const requestId = reqRecords[0].id;
|
|
28
|
+
const result = z.object({
|
|
29
|
+
request_id: z.string(), aa_id: z.string(), credential_id: z.string(), replayed: z.boolean(),
|
|
30
|
+
}).parse(await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/rpc/wrm_create_credential_request`, {
|
|
31
|
+
p_worker_id: input.worker_id,
|
|
32
|
+
p_request_from_user_id: input.request_from_user_id,
|
|
33
|
+
p_credential_name: input.credential_name,
|
|
34
|
+
p_credential_type: input.credential_type,
|
|
35
|
+
p_purpose: input.purpose,
|
|
36
|
+
p_ttl_seconds: input.ttl_seconds ?? 3600,
|
|
37
|
+
p_work_item_id: input.work_item_id ?? null,
|
|
38
|
+
p_idempotency_key: input.idempotency_key ?? null,
|
|
39
|
+
}));
|
|
40
|
+
const { request_id: requestId, aa_id: aaId, credential_id: credentialId } = result;
|
|
90
41
|
// Step 6: Fire-and-forget notification to the human (non-fatal if it fails)
|
|
91
|
-
|
|
92
|
-
.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
42
|
+
if (!result.replayed)
|
|
43
|
+
ctx.apiClient
|
|
44
|
+
.post(`${ctx.apiClient.dbBasePath}/fnd_notifications`, {
|
|
45
|
+
user_id: input.request_from_user_id,
|
|
46
|
+
notification_type: 'CREDENTIAL_REQUEST',
|
|
47
|
+
title: `Credential request: ${input.credential_name}`,
|
|
48
|
+
message: `An AI agent is requesting the credential "${input.credential_name}". Purpose: ${input.purpose}`,
|
|
49
|
+
metadata: { request_id: requestId, aa_id: aaId, credential_id: credentialId },
|
|
50
|
+
})
|
|
51
|
+
.catch(() => undefined);
|
|
52
|
+
return successResponse(result);
|
|
101
53
|
}
|
|
102
54
|
catch (error) {
|
|
103
55
|
return errorResponse(API_ERROR, `Failed to create credential request: ${error.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrm-credential-request-create.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-credential-request-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"wrm-credential-request-create.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-credential-request-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExE,MAAM,CAAC,MAAM,2BAA2B,GAAS;IAC/C,IAAI,EAAE,+BAA+B;IACrC,WAAW,EACT,uFAAuF;QACvF,gFAAgF;QAChF,iFAAiF;QACjF,+CAA+C;IACjD,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,eAAe,EAAE,oBAAoB;QACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QAC/D,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;QAClG,eAAe,EAAE,CAAC;aACf,IAAI,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC;aACrE,QAAQ,CAAC,oCAAoC,CAAC;QACjD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;QACxF,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;QAC9F,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,Q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