@moovio/sdk 0.6.2 → 0.7.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/FUNCTIONS.md +1 -0
- package/README.md +6 -0
- package/bin/mcp-server.js +51 -9
- package/bin/mcp-server.js.map +12 -11
- package/docs/sdks/accounts/README.md +2 -0
- package/docs/sdks/onboarding/README.md +2 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/mcp-server/extensions.d.ts +9 -0
- package/mcp-server/extensions.d.ts.map +1 -0
- package/mcp-server/extensions.js +6 -0
- package/mcp-server/extensions.js.map +1 -0
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/resources.d.ts +9 -4
- package/mcp-server/resources.d.ts.map +1 -1
- package/mcp-server/resources.js +36 -9
- package/mcp-server/resources.js.map +1 -1
- package/mcp-server/server.d.ts.map +1 -1
- package/mcp-server/server.js +6 -1
- package/mcp-server/server.js.map +1 -1
- package/models/components/achtransactiondetails.d.ts +2 -0
- package/models/components/achtransactiondetails.d.ts.map +1 -1
- package/models/components/achtransactiondetails.js +3 -0
- package/models/components/achtransactiondetails.js.map +1 -1
- package/models/components/achtransactionstatus.d.ts +3 -0
- package/models/components/achtransactionstatus.d.ts.map +1 -1
- package/models/components/achtransactionstatus.js +1 -0
- package/models/components/achtransactionstatus.js.map +1 -1
- package/models/components/createaccount.d.ts +6 -0
- package/models/components/createaccount.d.ts.map +1 -1
- package/models/components/createaccount.js +3 -0
- package/models/components/createaccount.js.map +1 -1
- package/models/components/createterminalapplication.d.ts +4 -4
- package/models/components/terminalapplication.d.ts +4 -4
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/extensions.ts +13 -0
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/resources.ts +75 -14
- package/src/mcp-server/server.ts +16 -1
- package/src/models/components/achtransactiondetails.ts +5 -0
- package/src/models/components/achtransactionstatus.ts +1 -0
- package/src/models/components/createaccount.ts +8 -0
- package/src/models/components/createterminalapplication.ts +4 -4
- package/src/models/components/terminalapplication.ts +4 -4
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
McpServer,
|
|
7
|
+
ResourceMetadata,
|
|
8
|
+
ResourceTemplate,
|
|
9
|
+
} from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
10
|
import { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
7
11
|
import { Variables } from "@modelcontextprotocol/sdk/shared/uriTemplate.js";
|
|
8
12
|
import { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
|
|
9
13
|
import { MoovCore } from "../core.js";
|
|
10
|
-
import {
|
|
14
|
+
import { ConsoleLogger } from "./console-logger.js";
|
|
11
15
|
import { MCPScope } from "./scopes.js";
|
|
12
16
|
import { isAsyncIterable, isBinaryData, valueToBase64 } from "./shared.js";
|
|
13
17
|
|
|
@@ -19,7 +23,8 @@ export type ReadResourceCallback = (
|
|
|
19
23
|
|
|
20
24
|
export type ResourceDefinition = {
|
|
21
25
|
name: string;
|
|
22
|
-
description
|
|
26
|
+
description?: string;
|
|
27
|
+
metadata?: ResourceMetadata;
|
|
23
28
|
scopes?: MCPScope[];
|
|
24
29
|
resource: string;
|
|
25
30
|
read: ReadResourceCallback;
|
|
@@ -35,30 +40,27 @@ export type ReadResourceTemplateCallback = (
|
|
|
35
40
|
export type ResourceTemplateDefinition = {
|
|
36
41
|
name: string;
|
|
37
42
|
description: string;
|
|
43
|
+
metadata?: ResourceMetadata;
|
|
38
44
|
scopes?: MCPScope[];
|
|
39
45
|
resource: ResourceTemplate;
|
|
40
46
|
read: ReadResourceTemplateCallback;
|
|
41
47
|
};
|
|
42
48
|
|
|
43
49
|
export async function formatResult(
|
|
44
|
-
|
|
50
|
+
value: unknown,
|
|
45
51
|
uri: URL,
|
|
46
|
-
init: { response?: Response | undefined },
|
|
52
|
+
init: { mimeType?: string | undefined; response?: Response | undefined },
|
|
47
53
|
): Promise<ReadResourceResult> {
|
|
48
|
-
if (!result.ok) {
|
|
49
|
-
throw result.error;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const { value } = result;
|
|
53
54
|
if (typeof value === "undefined") {
|
|
54
55
|
return { contents: [] };
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
const { response } = init;
|
|
58
|
-
const mimeType = response?.headers.get("content-type") ?? "";
|
|
59
58
|
let contents: ReadResourceResult["contents"] = [];
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
const mimeType = init.mimeType ?? init.response?.headers.get("content-type")
|
|
61
|
+
?? "";
|
|
62
|
+
|
|
63
|
+
if (mimeType.search(/\bjson\b/g) !== -1) {
|
|
62
64
|
contents = [{ uri: uri.toString(), mimeType, text: JSON.stringify(value) }];
|
|
63
65
|
} else if (
|
|
64
66
|
mimeType.startsWith("text/event-stream")
|
|
@@ -71,7 +73,10 @@ export async function formatResult(
|
|
|
71
73
|
text: await stringifySSEToJSON(value),
|
|
72
74
|
},
|
|
73
75
|
];
|
|
74
|
-
} else if (
|
|
76
|
+
} else if (
|
|
77
|
+
(mimeType.startsWith("text/") || mimeType.startsWith("application/"))
|
|
78
|
+
&& typeof value === "string"
|
|
79
|
+
) {
|
|
75
80
|
contents = [{ uri: uri.toString(), mimeType, text: value }];
|
|
76
81
|
} else if (isBinaryData(value)) {
|
|
77
82
|
const blob = await valueToBase64(value);
|
|
@@ -94,3 +99,59 @@ async function stringifySSEToJSON(
|
|
|
94
99
|
|
|
95
100
|
return JSON.stringify(payloads);
|
|
96
101
|
}
|
|
102
|
+
|
|
103
|
+
export function createRegisterResource(
|
|
104
|
+
logger: ConsoleLogger,
|
|
105
|
+
server: McpServer,
|
|
106
|
+
sdk: MoovCore,
|
|
107
|
+
allowedScopes: Set<MCPScope>,
|
|
108
|
+
): (resource: ResourceDefinition) => void {
|
|
109
|
+
return (resource: ResourceDefinition): void => {
|
|
110
|
+
const scopes = resource.scopes ?? [];
|
|
111
|
+
if (!scopes.every((s: MCPScope) => allowedScopes.has(s))) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const metadata: ResourceMetadata = {
|
|
116
|
+
...resource.metadata,
|
|
117
|
+
description: resource.description,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
server.resource(
|
|
121
|
+
resource.name,
|
|
122
|
+
resource.resource,
|
|
123
|
+
metadata,
|
|
124
|
+
async (uri, ctx) => resource.read(sdk, uri, ctx),
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
logger.debug("Registered resource", { name: resource.name });
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function createRegisterResourceTemplate(
|
|
132
|
+
logger: ConsoleLogger,
|
|
133
|
+
server: McpServer,
|
|
134
|
+
sdk: MoovCore,
|
|
135
|
+
allowedScopes: Set<MCPScope>,
|
|
136
|
+
): (resource: ResourceTemplateDefinition) => void {
|
|
137
|
+
return (resource: ResourceTemplateDefinition): void => {
|
|
138
|
+
const scopes = resource.scopes ?? [];
|
|
139
|
+
if (!scopes.every((s: MCPScope) => allowedScopes.has(s))) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const metadata: ResourceMetadata = {
|
|
144
|
+
...resource.metadata,
|
|
145
|
+
description: resource.description,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
server.resource(
|
|
149
|
+
resource.name,
|
|
150
|
+
resource.resource,
|
|
151
|
+
metadata,
|
|
152
|
+
async (uri, vars, ctx) => resource.read(sdk, uri, vars, ctx),
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
logger.debug("Registered resource template", { name: resource.name });
|
|
156
|
+
};
|
|
157
|
+
}
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -6,6 +6,10 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
6
6
|
import { MoovCore } from "../core.js";
|
|
7
7
|
import { SDKOptions } from "../lib/config.js";
|
|
8
8
|
import type { ConsoleLogger } from "./console-logger.js";
|
|
9
|
+
import {
|
|
10
|
+
createRegisterResource,
|
|
11
|
+
createRegisterResourceTemplate,
|
|
12
|
+
} from "./resources.js";
|
|
9
13
|
import { MCPScope, mcpScopes } from "./scopes.js";
|
|
10
14
|
import { createRegisterTool } from "./tools.js";
|
|
11
15
|
import { tool$accountsAssignCountries } from "./tools/accountsAssignCountries.js";
|
|
@@ -151,7 +155,7 @@ export function createMCPServer(deps: {
|
|
|
151
155
|
}) {
|
|
152
156
|
const server = new McpServer({
|
|
153
157
|
name: "Moov",
|
|
154
|
-
version: "0.
|
|
158
|
+
version: "0.7.0",
|
|
155
159
|
});
|
|
156
160
|
|
|
157
161
|
const client = new MoovCore({
|
|
@@ -160,7 +164,9 @@ export function createMCPServer(deps: {
|
|
|
160
164
|
serverURL: deps.serverURL,
|
|
161
165
|
serverIdx: deps.serverIdx,
|
|
162
166
|
});
|
|
167
|
+
|
|
163
168
|
const scopes = new Set(deps.scopes ?? mcpScopes);
|
|
169
|
+
|
|
164
170
|
const allowedTools = deps.allowedTools && new Set(deps.allowedTools);
|
|
165
171
|
const tool = createRegisterTool(
|
|
166
172
|
deps.logger,
|
|
@@ -169,6 +175,15 @@ export function createMCPServer(deps: {
|
|
|
169
175
|
scopes,
|
|
170
176
|
allowedTools,
|
|
171
177
|
);
|
|
178
|
+
const resource = createRegisterResource(deps.logger, server, client, scopes);
|
|
179
|
+
const resourceTemplate = createRegisterResourceTemplate(
|
|
180
|
+
deps.logger,
|
|
181
|
+
server,
|
|
182
|
+
client,
|
|
183
|
+
scopes,
|
|
184
|
+
);
|
|
185
|
+
const register = { tool, resource, resourceTemplate };
|
|
186
|
+
void register; // suppress unused warnings
|
|
172
187
|
|
|
173
188
|
tool(tool$accountsCreate);
|
|
174
189
|
tool(tool$accountsList);
|
|
@@ -51,6 +51,7 @@ export type ACHTransactionDetails = {
|
|
|
51
51
|
* Code used to identify the ACH authorization method.
|
|
52
52
|
*/
|
|
53
53
|
secCode?: SECCode | undefined;
|
|
54
|
+
canceledOn?: Date | undefined;
|
|
54
55
|
initiatedOn?: Date | undefined;
|
|
55
56
|
originatedOn?: Date | undefined;
|
|
56
57
|
correctedOn?: Date | undefined;
|
|
@@ -76,6 +77,8 @@ export const ACHTransactionDetails$inboundSchema: z.ZodType<
|
|
|
76
77
|
companyEntryDescription: z.string().optional(),
|
|
77
78
|
originatingCompanyName: z.string().optional(),
|
|
78
79
|
secCode: SECCode$inboundSchema.optional(),
|
|
80
|
+
canceledOn: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
81
|
+
.optional(),
|
|
79
82
|
initiatedOn: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
80
83
|
.optional(),
|
|
81
84
|
originatedOn: z.string().datetime({ offset: true }).transform(v =>
|
|
@@ -101,6 +104,7 @@ export type ACHTransactionDetails$Outbound = {
|
|
|
101
104
|
companyEntryDescription?: string | undefined;
|
|
102
105
|
originatingCompanyName?: string | undefined;
|
|
103
106
|
secCode?: string | undefined;
|
|
107
|
+
canceledOn?: string | undefined;
|
|
104
108
|
initiatedOn?: string | undefined;
|
|
105
109
|
originatedOn?: string | undefined;
|
|
106
110
|
correctedOn?: string | undefined;
|
|
@@ -123,6 +127,7 @@ export const ACHTransactionDetails$outboundSchema: z.ZodType<
|
|
|
123
127
|
companyEntryDescription: z.string().optional(),
|
|
124
128
|
originatingCompanyName: z.string().optional(),
|
|
125
129
|
secCode: SECCode$outboundSchema.optional(),
|
|
130
|
+
canceledOn: z.date().transform(v => v.toISOString()).optional(),
|
|
126
131
|
initiatedOn: z.date().transform(v => v.toISOString()).optional(),
|
|
127
132
|
originatedOn: z.date().transform(v => v.toISOString()).optional(),
|
|
128
133
|
correctedOn: z.date().transform(v => v.toISOString()).optional(),
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
ManualTermsOfService$Outbound,
|
|
35
35
|
ManualTermsOfService$outboundSchema,
|
|
36
36
|
} from "./manualtermsofservice.js";
|
|
37
|
+
import { Mode, Mode$inboundSchema, Mode$outboundSchema } from "./mode.js";
|
|
37
38
|
import {
|
|
38
39
|
Settings,
|
|
39
40
|
Settings$inboundSchema,
|
|
@@ -78,6 +79,10 @@ export type CreateAccount = {
|
|
|
78
79
|
*/
|
|
79
80
|
settings?: Settings | undefined;
|
|
80
81
|
capabilities?: Array<CapabilityID> | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* The operating mode for an account.
|
|
84
|
+
*/
|
|
85
|
+
mode?: Mode | undefined;
|
|
81
86
|
};
|
|
82
87
|
|
|
83
88
|
/** @internal */
|
|
@@ -155,6 +160,7 @@ export const CreateAccount$inboundSchema: z.ZodType<
|
|
|
155
160
|
customerSupport: CustomerSupport$inboundSchema.optional(),
|
|
156
161
|
settings: Settings$inboundSchema.optional(),
|
|
157
162
|
capabilities: z.array(CapabilityID$inboundSchema).optional(),
|
|
163
|
+
mode: Mode$inboundSchema.optional(),
|
|
158
164
|
});
|
|
159
165
|
|
|
160
166
|
/** @internal */
|
|
@@ -170,6 +176,7 @@ export type CreateAccount$Outbound = {
|
|
|
170
176
|
customerSupport?: CustomerSupport$Outbound | undefined;
|
|
171
177
|
settings?: Settings$Outbound | undefined;
|
|
172
178
|
capabilities?: Array<string> | undefined;
|
|
179
|
+
mode?: string | undefined;
|
|
173
180
|
};
|
|
174
181
|
|
|
175
182
|
/** @internal */
|
|
@@ -189,6 +196,7 @@ export const CreateAccount$outboundSchema: z.ZodType<
|
|
|
189
196
|
customerSupport: CustomerSupport$outboundSchema.optional(),
|
|
190
197
|
settings: Settings$outboundSchema.optional(),
|
|
191
198
|
capabilities: z.array(CapabilityID$outboundSchema).optional(),
|
|
199
|
+
mode: Mode$outboundSchema.optional(),
|
|
192
200
|
});
|
|
193
201
|
|
|
194
202
|
/**
|
|
@@ -21,19 +21,19 @@ export type CreateTerminalApplication = {
|
|
|
21
21
|
*/
|
|
22
22
|
platform: TerminalApplicationPlatform;
|
|
23
23
|
/**
|
|
24
|
-
* The app bundle identifier of the terminal application. Required if platform is ios
|
|
24
|
+
* The app bundle identifier of the terminal application. Required if platform is `ios`.
|
|
25
25
|
*/
|
|
26
26
|
appBundleID?: string | undefined;
|
|
27
27
|
/**
|
|
28
|
-
* The app package name of the terminal application. Required if platform is android
|
|
28
|
+
* The app package name of the terminal application. Required if platform is `android`.
|
|
29
29
|
*/
|
|
30
30
|
packageName?: string | undefined;
|
|
31
31
|
/**
|
|
32
|
-
* The app version of the terminal application. Required if paltform is android
|
|
32
|
+
* The app version of the terminal application. Required if paltform is `android`.
|
|
33
33
|
*/
|
|
34
34
|
sha256Digest?: string | undefined;
|
|
35
35
|
/**
|
|
36
|
-
* The app version of the terminal application. Required if platform is android
|
|
36
|
+
* The app version of the terminal application. Required if platform is `android`.
|
|
37
37
|
*/
|
|
38
38
|
versionCode?: string | undefined;
|
|
39
39
|
};
|
|
@@ -34,19 +34,19 @@ export type TerminalApplication = {
|
|
|
34
34
|
*/
|
|
35
35
|
platform: TerminalApplicationPlatform;
|
|
36
36
|
/**
|
|
37
|
-
* The app bundle identifier of the terminal application. Will be returned if platform is ios
|
|
37
|
+
* The app bundle identifier of the terminal application. Will be returned if platform is `ios`.
|
|
38
38
|
*/
|
|
39
39
|
appBundleID?: string | undefined;
|
|
40
40
|
/**
|
|
41
|
-
* The app package name of the terminal application. Will be returned if platform is android
|
|
41
|
+
* The app package name of the terminal application. Will be returned if platform is `android`.
|
|
42
42
|
*/
|
|
43
43
|
packageName?: string | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* The app version of the terminal application Will be returned if platform is android
|
|
45
|
+
* The app version of the terminal application Will be returned if platform is `android`.
|
|
46
46
|
*/
|
|
47
47
|
sha256Digest?: string | undefined;
|
|
48
48
|
/**
|
|
49
|
-
* The app version of the terminal application Will be returned if platform is android
|
|
49
|
+
* The app version of the terminal application Will be returned if platform is `android`.
|
|
50
50
|
*/
|
|
51
51
|
versionCode?: string | undefined;
|
|
52
52
|
};
|