@ory/mcp-server 0.1.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.
@@ -0,0 +1,375 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerOAuth2Tools = registerOAuth2Tools;
4
+ const zod_1 = require("zod");
5
+ const executor_js_1 = require("../executor.js");
6
+ const projectParam = zod_1.z.string().optional().describe("Ory project ID or slug");
7
+ const workspaceParam = zod_1.z.string().optional().describe("Ory workspace ID or name");
8
+ const oauth2ClientFlagSchema = {
9
+ name: zod_1.z.string().optional().describe("Human-readable client name"),
10
+ grant_types: zod_1.z
11
+ .array(zod_1.z.string())
12
+ .optional()
13
+ .describe("Allowed grant types (e.g. authorization_code, client_credentials, refresh_token)"),
14
+ response_types: zod_1.z
15
+ .array(zod_1.z.string())
16
+ .optional()
17
+ .describe("Allowed response types (e.g. code, token, id_token)"),
18
+ scope: zod_1.z
19
+ .array(zod_1.z.string())
20
+ .optional()
21
+ .describe("Allowed scopes (e.g. openid, offline_access)"),
22
+ redirect_uris: zod_1.z
23
+ .array(zod_1.z.string())
24
+ .optional()
25
+ .describe("Allowed redirect URIs after OAuth2 flow"),
26
+ audience: zod_1.z
27
+ .array(zod_1.z.string())
28
+ .optional()
29
+ .describe("Allowed access token audiences"),
30
+ allowed_cors_origins: zod_1.z
31
+ .array(zod_1.z.string())
32
+ .optional()
33
+ .describe("URLs allowed to make CORS requests"),
34
+ post_logout_callbacks: zod_1.z
35
+ .array(zod_1.z.string())
36
+ .optional()
37
+ .describe("Allowed post-logout redirect URIs"),
38
+ token_endpoint_auth_method: zod_1.z
39
+ .string()
40
+ .optional()
41
+ .describe("Token endpoint auth method (client_secret_post, client_secret_basic, private_key_jwt, none)"),
42
+ access_token_strategy: zod_1.z
43
+ .enum(["opaque", "jwt"])
44
+ .optional()
45
+ .describe("Access token strategy"),
46
+ client_uri: zod_1.z.string().optional().describe("Informational client URL"),
47
+ logo_uri: zod_1.z.string().optional().describe("Logo URL for the client"),
48
+ policy_uri: zod_1.z.string().optional().describe("Privacy policy URL"),
49
+ tos_uri: zod_1.z.string().optional().describe("Terms of service URL"),
50
+ metadata: zod_1.z
51
+ .string()
52
+ .optional()
53
+ .describe("Arbitrary JSON metadata string"),
54
+ owner: zod_1.z.string().optional().describe("Owner identifier"),
55
+ contacts: zod_1.z
56
+ .array(zod_1.z.string())
57
+ .optional()
58
+ .describe("Contact emails"),
59
+ secret: zod_1.z.string().optional().describe("Provide the client secret"),
60
+ subject_type: zod_1.z
61
+ .enum(["public", "pairwise"])
62
+ .optional()
63
+ .describe("Subject identifier algorithm"),
64
+ jwks_uri: zod_1.z.string().optional().describe("URL where JWKS should be fetched from"),
65
+ skip_consent: zod_1.z
66
+ .boolean()
67
+ .optional()
68
+ .describe("Skip consent screen for this client"),
69
+ skip_logout_consent: zod_1.z
70
+ .boolean()
71
+ .optional()
72
+ .describe("Skip logout consent screen for this client"),
73
+ backchannel_logout_callback: zod_1.z
74
+ .string()
75
+ .optional()
76
+ .describe("Backchannel logout callback URL"),
77
+ frontchannel_logout_callback: zod_1.z
78
+ .string()
79
+ .optional()
80
+ .describe("Frontchannel logout callback URL"),
81
+ };
82
+ function appendOauth2ClientFlags(args, params) {
83
+ if (typeof params.name === "string")
84
+ args.push("--name", params.name);
85
+ for (const gt of params.grant_types ?? []) {
86
+ args.push("--grant-type", gt);
87
+ }
88
+ for (const rt of params.response_types ?? []) {
89
+ args.push("--response-type", rt);
90
+ }
91
+ if (Array.isArray(params.scope) && params.scope.length) {
92
+ args.push("--scope", params.scope.join(","));
93
+ }
94
+ for (const uri of params.redirect_uris ?? []) {
95
+ args.push("--redirect-uri", uri);
96
+ }
97
+ for (const aud of params.audience ?? []) {
98
+ args.push("--audience", aud);
99
+ }
100
+ for (const origin of params.allowed_cors_origins ?? []) {
101
+ args.push("--allowed-cors-origin", origin);
102
+ }
103
+ for (const cb of params.post_logout_callbacks ?? []) {
104
+ args.push("--post-logout-callback", cb);
105
+ }
106
+ if (typeof params.token_endpoint_auth_method === "string") {
107
+ args.push("--token-endpoint-auth-method", params.token_endpoint_auth_method);
108
+ }
109
+ if (typeof params.access_token_strategy === "string") {
110
+ args.push("--access-token-strategy", params.access_token_strategy);
111
+ }
112
+ if (typeof params.client_uri === "string")
113
+ args.push("--client-uri", params.client_uri);
114
+ if (typeof params.logo_uri === "string")
115
+ args.push("--logo-uri", params.logo_uri);
116
+ if (typeof params.policy_uri === "string")
117
+ args.push("--policy-uri", params.policy_uri);
118
+ if (typeof params.tos_uri === "string")
119
+ args.push("--tos-uri", params.tos_uri);
120
+ if (typeof params.metadata === "string")
121
+ args.push("--metadata", params.metadata);
122
+ if (typeof params.owner === "string")
123
+ args.push("--owner", params.owner);
124
+ for (const contact of params.contacts ?? []) {
125
+ args.push("--contact", contact);
126
+ }
127
+ if (typeof params.secret === "string")
128
+ args.push("--secret", params.secret);
129
+ if (typeof params.subject_type === "string") {
130
+ args.push("--subject-type", params.subject_type);
131
+ }
132
+ if (typeof params.jwks_uri === "string")
133
+ args.push("--jwks-uri", params.jwks_uri);
134
+ if (params.skip_consent === true)
135
+ args.push("--skip-consent");
136
+ if (params.skip_logout_consent === true)
137
+ args.push("--skip-logout-consent");
138
+ if (typeof params.backchannel_logout_callback === "string") {
139
+ args.push("--backchannel-logout-callback", params.backchannel_logout_callback);
140
+ }
141
+ if (typeof params.frontchannel_logout_callback === "string") {
142
+ args.push("--frontchannel-logout-callback", params.frontchannel_logout_callback);
143
+ }
144
+ }
145
+ function registerOAuth2Tools(server) {
146
+ server.registerTool("ory_list_oauth2_clients", {
147
+ title: "List OAuth2 Clients",
148
+ description: "List OAuth 2.0 Clients in the Ory project.",
149
+ inputSchema: {
150
+ project: projectParam,
151
+ workspace: workspaceParam,
152
+ page_size: zod_1.z
153
+ .number()
154
+ .int()
155
+ .positive()
156
+ .optional()
157
+ .describe("Maximum items per page (default 100)"),
158
+ page_token: zod_1.z
159
+ .string()
160
+ .optional()
161
+ .describe("Pagination token from previous response"),
162
+ },
163
+ }, async (params) => {
164
+ const args = ["list", "oauth2-clients", ...(0, executor_js_1.buildCommonArgs)(params)];
165
+ if (params.page_size)
166
+ args.push("--page-size", String(params.page_size));
167
+ if (params.page_token)
168
+ args.push("--page-token", params.page_token);
169
+ return (0, executor_js_1.execOryTool)(args);
170
+ });
171
+ server.registerTool("ory_get_oauth2_client", {
172
+ title: "Get OAuth2 Client",
173
+ description: "Get full details about one or more OAuth 2.0 Clients by their ID(s).",
174
+ inputSchema: {
175
+ ids: zod_1.z
176
+ .array(zod_1.z.string())
177
+ .min(1)
178
+ .describe("One or more OAuth2 client IDs"),
179
+ project: projectParam,
180
+ workspace: workspaceParam,
181
+ },
182
+ }, async (params) => {
183
+ const args = [
184
+ "get",
185
+ "oauth2-client",
186
+ ...params.ids,
187
+ ...(0, executor_js_1.buildCommonArgs)(params),
188
+ ];
189
+ return (0, executor_js_1.execOryTool)(args);
190
+ });
191
+ server.registerTool("ory_create_oauth2_client", {
192
+ title: "Create OAuth2 Client",
193
+ description: "Create a new OAuth 2.0 Client. Returns the client details including the client secret (shown only once).",
194
+ inputSchema: {
195
+ ...oauth2ClientFlagSchema,
196
+ id: zod_1.z.string().optional().describe("Provide the client ID"),
197
+ project: projectParam,
198
+ workspace: workspaceParam,
199
+ },
200
+ }, async (params) => {
201
+ const args = ["create", "oauth2-client", ...(0, executor_js_1.buildCommonArgs)(params)];
202
+ if (typeof params.id === "string")
203
+ args.push("--id", params.id);
204
+ appendOauth2ClientFlags(args, params);
205
+ return (0, executor_js_1.execOryTool)(args);
206
+ });
207
+ server.registerTool("ory_update_oauth2_client", {
208
+ title: "Update OAuth2 Client",
209
+ description: "Replace an OAuth 2.0 Client by its ID. WARNING: this replaces the entire client; unspecified fields revert to defaults.",
210
+ inputSchema: {
211
+ id: zod_1.z.string().describe("OAuth2 client ID to update"),
212
+ ...oauth2ClientFlagSchema,
213
+ project: projectParam,
214
+ workspace: workspaceParam,
215
+ },
216
+ }, async (params) => {
217
+ const args = [
218
+ "update",
219
+ "oauth2-client",
220
+ params.id,
221
+ ...(0, executor_js_1.buildCommonArgs)(params),
222
+ ];
223
+ appendOauth2ClientFlags(args, params);
224
+ return (0, executor_js_1.execOryTool)(args);
225
+ });
226
+ server.registerTool("ory_import_oauth2_client", {
227
+ title: "Import OAuth2 Clients",
228
+ description: "Import one or more OAuth 2.0 Clients from a JSON file or inline JSON content. Existing clients are NOT updated — the import will fail if a client already exists.",
229
+ inputSchema: {
230
+ content: zod_1.z
231
+ .string()
232
+ .optional()
233
+ .describe("OAuth2 client JSON (single object or array). Used if 'file' is not provided."),
234
+ file: zod_1.z
235
+ .string()
236
+ .optional()
237
+ .describe("Path to JSON file on disk (takes precedence over content)."),
238
+ project: projectParam,
239
+ workspace: workspaceParam,
240
+ },
241
+ }, async (params) => (0, executor_js_1.withFileOrContent)(params, ".json", (filePath) => {
242
+ const args = [
243
+ "import",
244
+ "oauth2-client",
245
+ filePath,
246
+ ...(0, executor_js_1.buildCommonArgs)(params),
247
+ ];
248
+ return (0, executor_js_1.execOryTool)(args);
249
+ }));
250
+ server.registerTool("ory_delete_oauth2_client", {
251
+ title: "Delete OAuth2 Client",
252
+ description: "Delete one or more OAuth 2.0 Clients by their ID(s). This action is irreversible.",
253
+ inputSchema: {
254
+ ids: zod_1.z
255
+ .array(zod_1.z.string())
256
+ .min(1)
257
+ .describe("One or more OAuth2 client IDs to delete"),
258
+ project: projectParam,
259
+ workspace: workspaceParam,
260
+ },
261
+ }, async (params) => {
262
+ const args = [
263
+ "delete",
264
+ "oauth2-client",
265
+ ...params.ids,
266
+ ...(0, executor_js_1.buildCommonArgs)(params),
267
+ ];
268
+ return (0, executor_js_1.execOryTool)(args);
269
+ });
270
+ server.registerTool("ory_delete_oauth2_access_tokens", {
271
+ title: "Delete OAuth2 Access Tokens",
272
+ description: "Revoke all OAuth 2.0 access tokens issued for a given client.",
273
+ inputSchema: {
274
+ client_id: zod_1.z.string().describe("OAuth2 client ID whose tokens should be revoked"),
275
+ project: projectParam,
276
+ workspace: workspaceParam,
277
+ },
278
+ }, async (params) => {
279
+ const args = [
280
+ "delete",
281
+ "access-tokens",
282
+ params.client_id,
283
+ ...(0, executor_js_1.buildCommonArgs)(params),
284
+ ];
285
+ return (0, executor_js_1.execOryTool)(args);
286
+ });
287
+ server.registerTool("ory_introspect_token", {
288
+ title: "Introspect Token",
289
+ description: "Introspect an OAuth 2.0 Access or Refresh Token to check its validity and metadata.",
290
+ inputSchema: {
291
+ token: zod_1.z.string().describe("The OAuth2 access or refresh token to introspect"),
292
+ scope: zod_1.z
293
+ .array(zod_1.z.string())
294
+ .optional()
295
+ .describe("Additionally check if these scopes were granted"),
296
+ project: projectParam,
297
+ workspace: workspaceParam,
298
+ },
299
+ }, async (params) => {
300
+ const args = [
301
+ "introspect",
302
+ "token",
303
+ params.token,
304
+ ...(0, executor_js_1.buildCommonArgs)(params),
305
+ ];
306
+ if (params.scope?.length) {
307
+ for (const s of params.scope) {
308
+ args.push("--scope", s);
309
+ }
310
+ }
311
+ return (0, executor_js_1.execOryTool)(args);
312
+ });
313
+ server.registerTool("ory_revoke_token", {
314
+ title: "Revoke Token",
315
+ description: "Revoke an OAuth 2.0 access or refresh token issued by the project.",
316
+ inputSchema: {
317
+ token: zod_1.z.string().describe("The OAuth2 token to revoke"),
318
+ client_id: zod_1.z
319
+ .string()
320
+ .optional()
321
+ .describe("OAuth2 client ID (defaults to OAUTH2_CLIENT_ID env var)"),
322
+ client_secret: zod_1.z
323
+ .string()
324
+ .optional()
325
+ .describe("OAuth2 client secret (defaults to OAUTH2_CLIENT_SECRET env var)"),
326
+ project: projectParam,
327
+ workspace: workspaceParam,
328
+ },
329
+ }, async (params) => {
330
+ const args = [
331
+ "revoke",
332
+ "token",
333
+ params.token,
334
+ ...(0, executor_js_1.buildCommonArgs)(params),
335
+ ];
336
+ if (params.client_id)
337
+ args.push("--client-id", params.client_id);
338
+ if (params.client_secret)
339
+ args.push("--client-secret", params.client_secret);
340
+ return (0, executor_js_1.execOryTool)(args);
341
+ });
342
+ server.registerTool("ory_perform_client_credentials", {
343
+ title: "Perform Client Credentials Flow",
344
+ description: "Exchange an OAuth 2.0 client_id/client_secret for an access token via the client_credentials grant.",
345
+ inputSchema: {
346
+ client_id: zod_1.z.string().describe("OAuth2 client ID"),
347
+ client_secret: zod_1.z.string().describe("OAuth2 client secret"),
348
+ scope: zod_1.z
349
+ .array(zod_1.z.string())
350
+ .optional()
351
+ .describe("OAuth2 scopes to request"),
352
+ audience: zod_1.z
353
+ .array(zod_1.z.string())
354
+ .optional()
355
+ .describe("Requested access token audiences"),
356
+ project: projectParam,
357
+ workspace: workspaceParam,
358
+ },
359
+ }, async (params) => {
360
+ const args = [
361
+ "perform",
362
+ "client-credentials",
363
+ "--client-id",
364
+ params.client_id,
365
+ "--client-secret",
366
+ params.client_secret,
367
+ ...(0, executor_js_1.buildCommonArgs)(params),
368
+ ];
369
+ for (const s of params.scope ?? [])
370
+ args.push("--scope", s);
371
+ for (const a of params.audience ?? [])
372
+ args.push("--audience", a);
373
+ return (0, executor_js_1.execOryTool)(args);
374
+ });
375
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerOrganizationTools(server: McpServer): void;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerOrganizationTools = registerOrganizationTools;
4
+ const zod_1 = require("zod");
5
+ const executor_js_1 = require("../executor.js");
6
+ const projectParam = zod_1.z.string().optional().describe("Ory project ID or slug");
7
+ const workspaceParam = zod_1.z.string().optional().describe("Ory workspace ID or name");
8
+ function registerOrganizationTools(server) {
9
+ server.registerTool("ory_list_organizations", {
10
+ title: "List Organizations",
11
+ description: "List Ory Network B2B organizations within a project.",
12
+ inputSchema: {
13
+ project: projectParam,
14
+ workspace: workspaceParam,
15
+ },
16
+ }, async (params) => {
17
+ const args = ["list", "organizations", ...(0, executor_js_1.buildCommonArgs)(params)];
18
+ return (0, executor_js_1.execOryTool)(args);
19
+ });
20
+ server.registerTool("ory_create_organization", {
21
+ title: "Create Organization",
22
+ description: "Create a new B2B organization within an Ory Network project.",
23
+ inputSchema: {
24
+ label: zod_1.z.string().describe("Organization label / display name"),
25
+ domains: zod_1.z
26
+ .array(zod_1.z.string())
27
+ .optional()
28
+ .describe("Domains associated with the organization (e.g. example.com)"),
29
+ project: projectParam,
30
+ workspace: workspaceParam,
31
+ },
32
+ }, async (params) => {
33
+ const args = [
34
+ "create",
35
+ "organization",
36
+ params.label,
37
+ ...(0, executor_js_1.buildCommonArgs)(params),
38
+ ];
39
+ if (params.domains?.length) {
40
+ args.push("--domains", params.domains.join(","));
41
+ }
42
+ return (0, executor_js_1.execOryTool)(args);
43
+ });
44
+ server.registerTool("ory_update_organization", {
45
+ title: "Update Organization",
46
+ description: "Update a B2B organization (label and/or domains).",
47
+ inputSchema: {
48
+ id: zod_1.z.string().describe("Organization ID"),
49
+ label: zod_1.z.string().optional().describe("New label"),
50
+ domains: zod_1.z
51
+ .array(zod_1.z.string())
52
+ .optional()
53
+ .describe("New list of domains (replaces existing)"),
54
+ project: projectParam,
55
+ },
56
+ }, async (params) => {
57
+ const args = [
58
+ "update",
59
+ "organization",
60
+ params.id,
61
+ ...(0, executor_js_1.buildCommonArgs)(params),
62
+ ];
63
+ if (params.label)
64
+ args.push("--label", params.label);
65
+ if (params.domains?.length) {
66
+ args.push("--domains", params.domains.join(","));
67
+ }
68
+ return (0, executor_js_1.execOryTool)(args);
69
+ });
70
+ server.registerTool("ory_delete_organization", {
71
+ title: "Delete Organization",
72
+ description: "Delete a B2B organization by ID. This action is irreversible.",
73
+ inputSchema: {
74
+ id: zod_1.z.string().describe("Organization ID"),
75
+ project: projectParam,
76
+ workspace: workspaceParam,
77
+ },
78
+ }, async (params) => {
79
+ const args = [
80
+ "delete",
81
+ "organization",
82
+ params.id,
83
+ ...(0, executor_js_1.buildCommonArgs)(params),
84
+ ];
85
+ return (0, executor_js_1.execOryTool)(args);
86
+ });
87
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerProjectTools(server: McpServer): void;
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerProjectTools = registerProjectTools;
4
+ const zod_1 = require("zod");
5
+ const executor_js_1 = require("../executor.js");
6
+ const workspaceParam = zod_1.z.string().optional().describe("Ory workspace ID or name");
7
+ const projectParam = zod_1.z.string().optional().describe("Ory project ID or slug");
8
+ function registerProjectTools(server) {
9
+ server.registerTool("ory_list_projects", {
10
+ title: "List Projects",
11
+ description: "List your Ory Network projects.",
12
+ inputSchema: {
13
+ workspace: workspaceParam,
14
+ },
15
+ }, async (params) => {
16
+ const args = ["list", "projects", ...(0, executor_js_1.buildCommonArgs)(params)];
17
+ return (0, executor_js_1.execOryTool)(args);
18
+ });
19
+ server.registerTool("ory_get_project", {
20
+ title: "Get Project",
21
+ description: "Get the complete configuration of an Ory Network project.",
22
+ inputSchema: {
23
+ id: zod_1.z
24
+ .string()
25
+ .optional()
26
+ .describe("Project ID or slug. If omitted, uses the current default project."),
27
+ workspace: workspaceParam,
28
+ },
29
+ }, async (params) => {
30
+ const args = ["get", "project"];
31
+ if (params.id)
32
+ args.push(params.id);
33
+ args.push(...(0, executor_js_1.buildCommonArgs)(params));
34
+ return (0, executor_js_1.execOryTool)(args);
35
+ });
36
+ server.registerTool("ory_create_project", {
37
+ title: "Create Project",
38
+ description: "Create a new Ory Network project.",
39
+ inputSchema: {
40
+ name: zod_1.z.string().describe("Human-readable project name"),
41
+ environment: zod_1.z
42
+ .enum(["prod", "stage", "dev"])
43
+ .optional()
44
+ .describe("Project environment (default: dev)"),
45
+ create_workspace: zod_1.z
46
+ .string()
47
+ .optional()
48
+ .describe("Create a new workspace with this name and use it for the project"),
49
+ workspace: workspaceParam,
50
+ use_project: zod_1.z
51
+ .boolean()
52
+ .optional()
53
+ .describe("Set the created project as the default"),
54
+ },
55
+ }, async (params) => {
56
+ const args = ["create", "project", "--name", params.name];
57
+ if (params.environment)
58
+ args.push("--environment", params.environment);
59
+ if (params.create_workspace) {
60
+ args.push("--create-workspace", params.create_workspace);
61
+ }
62
+ if (params.workspace)
63
+ args.push("--workspace", params.workspace);
64
+ if (params.use_project === true)
65
+ args.push("--use-project");
66
+ args.push("--format", "json");
67
+ return (0, executor_js_1.execOryTool)(args);
68
+ });
69
+ server.registerTool("ory_update_project", {
70
+ title: "Update Project",
71
+ description: "Replace an Ory Network project's service configuration. Provide the configuration as inline JSON or via file path. Unspecified fields are reset.",
72
+ inputSchema: {
73
+ id: zod_1.z
74
+ .string()
75
+ .optional()
76
+ .describe("Project ID or slug. Defaults to the current default project."),
77
+ name: zod_1.z
78
+ .string()
79
+ .optional()
80
+ .describe("New project name (leave unset to keep the existing name)"),
81
+ content: zod_1.z
82
+ .string()
83
+ .optional()
84
+ .describe("Configuration JSON. Used if 'file' is not provided."),
85
+ file: zod_1.z
86
+ .string()
87
+ .optional()
88
+ .describe("Path to a configuration file (takes precedence over content)."),
89
+ project: projectParam,
90
+ workspace: workspaceParam,
91
+ },
92
+ }, async (params) => {
93
+ const buildArgs = (filePath) => {
94
+ const args = ["update", "project"];
95
+ if (params.id)
96
+ args.push(params.id);
97
+ args.push("--file", filePath);
98
+ if (params.name)
99
+ args.push("--name", params.name);
100
+ args.push(...(0, executor_js_1.buildCommonArgs)(params));
101
+ return args;
102
+ };
103
+ if (!params.content && !params.file) {
104
+ if (!params.name) {
105
+ return {
106
+ content: [
107
+ {
108
+ type: "text",
109
+ text: "Provide 'content', 'file', or at least 'name' to update.",
110
+ },
111
+ ],
112
+ isError: true,
113
+ };
114
+ }
115
+ const args = ["update", "project"];
116
+ if (params.id)
117
+ args.push(params.id);
118
+ args.push("--name", params.name);
119
+ args.push(...(0, executor_js_1.buildCommonArgs)(params));
120
+ return (0, executor_js_1.execOryTool)(args);
121
+ }
122
+ return (0, executor_js_1.withFileOrContent)(params, ".json", (filePath) => (0, executor_js_1.execOryTool)(buildArgs(filePath)));
123
+ });
124
+ server.registerTool("ory_patch_project", {
125
+ title: "Patch Project",
126
+ description: "Apply a JSON-Patch document to a project's configuration. Use add/replace/remove operations to modify specific keys without overwriting the entire configuration.",
127
+ inputSchema: {
128
+ id: zod_1.z
129
+ .string()
130
+ .optional()
131
+ .describe("Project ID or slug. Defaults to the current default project."),
132
+ add: zod_1.z
133
+ .array(zod_1.z.string())
134
+ .optional()
135
+ .describe("Keys to add (e.g. '/services/identity/config/courier/smtp={...}')"),
136
+ replace: zod_1.z
137
+ .array(zod_1.z.string())
138
+ .optional()
139
+ .describe("Keys to replace (e.g. '/name=\"new name\"')"),
140
+ remove: zod_1.z
141
+ .array(zod_1.z.string())
142
+ .optional()
143
+ .describe("Keys to remove (e.g. '/services/identity/config/selfservice/methods/totp/enabled')"),
144
+ file: zod_1.z
145
+ .string()
146
+ .optional()
147
+ .describe("Optional path to a configuration file to merge in"),
148
+ project: projectParam,
149
+ workspace: workspaceParam,
150
+ },
151
+ }, async (params) => {
152
+ const args = ["patch", "project"];
153
+ if (params.id)
154
+ args.push(params.id);
155
+ args.push(...(0, executor_js_1.buildCommonArgs)(params));
156
+ for (const op of params.add ?? [])
157
+ args.push("--add", op);
158
+ for (const op of params.replace ?? [])
159
+ args.push("--replace", op);
160
+ for (const op of params.remove ?? [])
161
+ args.push("--remove", op);
162
+ if (params.file)
163
+ args.push("--file", params.file);
164
+ return (0, executor_js_1.execOryTool)(args);
165
+ });
166
+ server.registerTool("ory_use_project", {
167
+ title: "Use Project",
168
+ description: "Set the default Ory project for subsequent commands. If no ID given, prints the current default.",
169
+ inputSchema: {
170
+ id: zod_1.z
171
+ .string()
172
+ .optional()
173
+ .describe("Project ID to set as default"),
174
+ },
175
+ }, async (params) => {
176
+ const args = ["use", "project"];
177
+ if (params.id)
178
+ args.push(params.id);
179
+ args.push("--format", "json");
180
+ return (0, executor_js_1.execOryTool)(args);
181
+ });
182
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerRelationshipTools(server: McpServer): void;