@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,146 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerConfigTools = registerConfigTools;
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 registerUpdateConfig(server, toolName, title, description, kind) {
9
+ server.registerTool(toolName, {
10
+ title,
11
+ description,
12
+ inputSchema: {
13
+ content: zod_1.z
14
+ .string()
15
+ .optional()
16
+ .describe("Configuration JSON content. Used if 'file' is not provided."),
17
+ file: zod_1.z
18
+ .string()
19
+ .optional()
20
+ .describe("Path to a configuration file on disk (takes precedence over content)."),
21
+ project: projectParam,
22
+ workspace: workspaceParam,
23
+ },
24
+ }, async (params) => (0, executor_js_1.withFileOrContent)(params, ".json", (filePath) => {
25
+ const args = ["update", kind, "--file", filePath, ...(0, executor_js_1.buildCommonArgs)(params)];
26
+ return (0, executor_js_1.execOryTool)(args);
27
+ }));
28
+ }
29
+ function registerPatchConfig(server, toolName, title, description, kind) {
30
+ server.registerTool(toolName, {
31
+ title,
32
+ description,
33
+ inputSchema: {
34
+ add: zod_1.z
35
+ .array(zod_1.z.string())
36
+ .optional()
37
+ .describe("Keys to add (JSON-Patch add operations)"),
38
+ replace: zod_1.z
39
+ .array(zod_1.z.string())
40
+ .optional()
41
+ .describe("Keys to replace (JSON-Patch replace operations)"),
42
+ remove: zod_1.z
43
+ .array(zod_1.z.string())
44
+ .optional()
45
+ .describe("Keys to remove (JSON-Patch remove operations)"),
46
+ file: zod_1.z
47
+ .string()
48
+ .optional()
49
+ .describe("Optional configuration file to merge in"),
50
+ project: projectParam,
51
+ workspace: workspaceParam,
52
+ },
53
+ }, async (params) => {
54
+ const args = ["patch", kind, ...(0, executor_js_1.buildCommonArgs)(params)];
55
+ for (const op of params.add ?? [])
56
+ args.push("--add", op);
57
+ for (const op of params.replace ?? [])
58
+ args.push("--replace", op);
59
+ for (const op of params.remove ?? [])
60
+ args.push("--remove", op);
61
+ if (params.file)
62
+ args.push("--file", params.file);
63
+ return (0, executor_js_1.execOryTool)(args);
64
+ });
65
+ }
66
+ function registerConfigTools(server) {
67
+ server.registerTool("ory_get_identity_config", {
68
+ title: "Get Identity Config",
69
+ description: "Get the Ory Identities (Kratos) configuration for an Ory Network project.",
70
+ inputSchema: {
71
+ project: projectParam,
72
+ workspace: workspaceParam,
73
+ },
74
+ }, async (params) => {
75
+ const args = ["get", "identity-config", ...(0, executor_js_1.buildCommonArgs)(params)];
76
+ return (0, executor_js_1.execOryTool)(args);
77
+ });
78
+ server.registerTool("ory_get_oauth2_config", {
79
+ title: "Get OAuth2 Config",
80
+ description: "Get the Ory OAuth2 & OpenID Connect (Hydra) configuration for an Ory Network project.",
81
+ inputSchema: {
82
+ project: projectParam,
83
+ workspace: workspaceParam,
84
+ },
85
+ }, async (params) => {
86
+ const args = ["get", "oauth2-config", ...(0, executor_js_1.buildCommonArgs)(params)];
87
+ return (0, executor_js_1.execOryTool)(args);
88
+ });
89
+ server.registerTool("ory_get_permission_config", {
90
+ title: "Get Permission Config",
91
+ description: "Get the Ory Permissions (Keto) configuration for an Ory Network project.",
92
+ inputSchema: {
93
+ project: projectParam,
94
+ workspace: workspaceParam,
95
+ },
96
+ }, async (params) => {
97
+ const args = ["get", "permission-config", ...(0, executor_js_1.buildCommonArgs)(params)];
98
+ return (0, executor_js_1.execOryTool)(args);
99
+ });
100
+ registerUpdateConfig(server, "ory_update_identity_config", "Update Identity Config", "Replace the Ory Identities (Kratos) configuration. WARNING: this overwrites the entire identity-config service block.", "identity-config");
101
+ registerPatchConfig(server, "ory_patch_identity_config", "Patch Identity Config", "Apply a JSON-Patch document to the Ory Identities (Kratos) configuration.", "identity-config");
102
+ registerUpdateConfig(server, "ory_update_oauth2_config", "Update OAuth2 Config", "Replace the Ory OAuth2 & OpenID Connect (Hydra) configuration. WARNING: this overwrites the entire oauth2-config service block.", "oauth2-config");
103
+ registerPatchConfig(server, "ory_patch_oauth2_config", "Patch OAuth2 Config", "Apply a JSON-Patch document to the Ory OAuth2 & OpenID Connect (Hydra) configuration.", "oauth2-config");
104
+ registerUpdateConfig(server, "ory_update_permission_config", "Update Permission Config", "Replace the Ory Permissions (Keto) configuration. WARNING: this overwrites the entire permission-config service block.", "permission-config");
105
+ registerPatchConfig(server, "ory_patch_permission_config", "Patch Permission Config", "Apply a JSON-Patch document to the Ory Permissions (Keto) configuration.", "permission-config");
106
+ server.registerTool("ory_update_opl", {
107
+ title: "Update OPL",
108
+ description: "Update the Ory Permission Language file in Ory Network. " +
109
+ "Provide OPL content as a string or a file path. " +
110
+ "WARNING: This overwrites existing namespace definitions.",
111
+ inputSchema: {
112
+ content: zod_1.z
113
+ .string()
114
+ .optional()
115
+ .describe("OPL file content as a string (used if file is not provided)"),
116
+ file: zod_1.z
117
+ .string()
118
+ .optional()
119
+ .describe("Path to OPL file on disk (takes precedence over content)"),
120
+ project: projectParam,
121
+ workspace: workspaceParam,
122
+ },
123
+ }, async (params) => (0, executor_js_1.withFileOrContent)(params, ".ts", (filePath) => {
124
+ const args = ["update", "opl", "--file", filePath, ...(0, executor_js_1.buildCommonArgs)(params)];
125
+ return (0, executor_js_1.execOryTool)(args);
126
+ }));
127
+ server.registerTool("ory_patch_opl", {
128
+ title: "Patch OPL",
129
+ description: "Patch the Ory Permission Language file in Ory Network. Provide OPL content as a string or a file path.",
130
+ inputSchema: {
131
+ content: zod_1.z
132
+ .string()
133
+ .optional()
134
+ .describe("OPL file content as a string (used if file is not provided)"),
135
+ file: zod_1.z
136
+ .string()
137
+ .optional()
138
+ .describe("Path to OPL file on disk (takes precedence over content)"),
139
+ project: projectParam,
140
+ workspace: workspaceParam,
141
+ },
142
+ }, async (params) => (0, executor_js_1.withFileOrContent)(params, ".ts", (filePath) => {
143
+ const args = ["patch", "opl", "--file", filePath, ...(0, executor_js_1.buildCommonArgs)(params)];
144
+ return (0, executor_js_1.execOryTool)(args);
145
+ }));
146
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerEventStreamTools(server: McpServer): void;
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerEventStreamTools = registerEventStreamTools;
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 eventStreamFlags = {
9
+ type: zod_1.z
10
+ .enum(["sns", "https"])
11
+ .describe("Event stream destination type. 'sns' for AWS SNS topics, 'https' for generic HTTPS endpoints."),
12
+ aws_iam_role_arn: zod_1.z
13
+ .string()
14
+ .optional()
15
+ .describe("AWS IAM role ARN to assume when publishing to SNS (required for type=sns)"),
16
+ aws_sns_topic_arn: zod_1.z
17
+ .string()
18
+ .optional()
19
+ .describe("AWS SNS topic ARN (required for type=sns)"),
20
+ https_endpoint: zod_1.z
21
+ .string()
22
+ .optional()
23
+ .describe("HTTPS endpoint URL (required for type=https)"),
24
+ };
25
+ function appendEventStreamFlags(args, params) {
26
+ args.push("--type", params.type);
27
+ if (typeof params.aws_iam_role_arn === "string") {
28
+ args.push("--aws-iam-role-arn", params.aws_iam_role_arn);
29
+ }
30
+ if (typeof params.aws_sns_topic_arn === "string") {
31
+ args.push("--aws-sns-topic-arn", params.aws_sns_topic_arn);
32
+ }
33
+ if (typeof params.https_endpoint === "string") {
34
+ args.push("--https-endpoint", params.https_endpoint);
35
+ }
36
+ }
37
+ function registerEventStreamTools(server) {
38
+ server.registerTool("ory_list_event_streams", {
39
+ title: "List Event Streams",
40
+ description: "List event streams configured for an Ory Network project.",
41
+ inputSchema: {
42
+ project: projectParam,
43
+ workspace: workspaceParam,
44
+ },
45
+ }, async (params) => {
46
+ const args = ["list", "event-streams", ...(0, executor_js_1.buildCommonArgs)(params)];
47
+ return (0, executor_js_1.execOryTool)(args);
48
+ });
49
+ server.registerTool("ory_create_event_stream", {
50
+ title: "Create Event Stream",
51
+ description: "Create a new event stream that publishes Ory Network events to AWS SNS or an HTTPS endpoint.",
52
+ inputSchema: {
53
+ ...eventStreamFlags,
54
+ project: projectParam,
55
+ workspace: workspaceParam,
56
+ },
57
+ }, async (params) => {
58
+ const args = ["create", "event-stream", ...(0, executor_js_1.buildCommonArgs)(params)];
59
+ appendEventStreamFlags(args, params);
60
+ return (0, executor_js_1.execOryTool)(args);
61
+ });
62
+ server.registerTool("ory_update_event_stream", {
63
+ title: "Update Event Stream",
64
+ description: "Update the destination configuration for an existing event stream.",
65
+ inputSchema: {
66
+ id: zod_1.z.string().describe("Event stream ID"),
67
+ ...eventStreamFlags,
68
+ project: projectParam,
69
+ },
70
+ }, async (params) => {
71
+ const args = [
72
+ "update",
73
+ "event-stream",
74
+ params.id,
75
+ ...(0, executor_js_1.buildCommonArgs)(params),
76
+ ];
77
+ appendEventStreamFlags(args, params);
78
+ return (0, executor_js_1.execOryTool)(args);
79
+ });
80
+ server.registerTool("ory_delete_event_stream", {
81
+ title: "Delete Event Stream",
82
+ description: "Delete an event stream by ID. This action is irreversible.",
83
+ inputSchema: {
84
+ id: zod_1.z.string().describe("Event stream ID"),
85
+ project: projectParam,
86
+ workspace: workspaceParam,
87
+ },
88
+ }, async (params) => {
89
+ const args = [
90
+ "delete",
91
+ "event-stream",
92
+ params.id,
93
+ ...(0, executor_js_1.buildCommonArgs)(params),
94
+ ];
95
+ return (0, executor_js_1.execOryTool)(args);
96
+ });
97
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerIdentityTools(server: McpServer): void;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerIdentityTools = registerIdentityTools;
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 registerIdentityTools(server) {
9
+ server.registerTool("ory_list_identities", {
10
+ title: "List Identities",
11
+ description: "List identities in the Ory project. Returns paginated JSON array of identity objects.",
12
+ inputSchema: {
13
+ project: projectParam,
14
+ workspace: workspaceParam,
15
+ page_size: zod_1.z
16
+ .number()
17
+ .int()
18
+ .positive()
19
+ .optional()
20
+ .describe("Maximum items per page (default 100)"),
21
+ page_token: zod_1.z
22
+ .string()
23
+ .optional()
24
+ .describe("Pagination token from previous response"),
25
+ consistency: zod_1.z
26
+ .enum(["strong", "eventual"])
27
+ .optional()
28
+ .describe("Read consistency. Defaults to eventual."),
29
+ },
30
+ }, async (params) => {
31
+ const args = ["list", "identities", ...(0, executor_js_1.buildCommonArgs)(params)];
32
+ if (params.page_size)
33
+ args.push("--page-size", String(params.page_size));
34
+ if (params.page_token)
35
+ args.push("--page-token", params.page_token);
36
+ if (params.consistency)
37
+ args.push("--consistency", params.consistency);
38
+ return (0, executor_js_1.execOryTool)(args);
39
+ });
40
+ server.registerTool("ory_get_identity", {
41
+ title: "Get Identity",
42
+ description: "Get full details about one or more identities by their ID(s).",
43
+ inputSchema: {
44
+ ids: zod_1.z
45
+ .array(zod_1.z.string())
46
+ .min(1)
47
+ .describe("One or more identity IDs to retrieve"),
48
+ project: projectParam,
49
+ workspace: workspaceParam,
50
+ },
51
+ }, async (params) => {
52
+ const args = [
53
+ "get",
54
+ "identity",
55
+ ...params.ids,
56
+ ...(0, executor_js_1.buildCommonArgs)(params),
57
+ ];
58
+ return (0, executor_js_1.execOryTool)(args);
59
+ });
60
+ server.registerTool("ory_delete_identity", {
61
+ title: "Delete Identity",
62
+ description: "Delete one or more identities by their ID(s). This action is irreversible.",
63
+ inputSchema: {
64
+ ids: zod_1.z
65
+ .array(zod_1.z.string())
66
+ .min(1)
67
+ .describe("One or more identity IDs to delete"),
68
+ project: projectParam,
69
+ workspace: workspaceParam,
70
+ },
71
+ }, async (params) => {
72
+ const args = [
73
+ "delete",
74
+ "identity",
75
+ ...params.ids,
76
+ ...(0, executor_js_1.buildCommonArgs)(params),
77
+ ];
78
+ return (0, executor_js_1.execOryTool)(args);
79
+ });
80
+ server.registerTool("ory_import_identities", {
81
+ title: "Import Identities",
82
+ description: "Import one or more identities from a JSON file or inline JSON content. The payload may be a single identity object or an array of identity objects.",
83
+ inputSchema: {
84
+ content: zod_1.z
85
+ .string()
86
+ .optional()
87
+ .describe("Identity JSON (single object or array). Used if 'file' is not provided."),
88
+ file: zod_1.z
89
+ .string()
90
+ .optional()
91
+ .describe("Path to JSON file on disk (takes precedence over content)."),
92
+ project: projectParam,
93
+ workspace: workspaceParam,
94
+ },
95
+ }, async (params) => (0, executor_js_1.withFileOrContent)(params, ".json", (filePath) => {
96
+ const args = ["import", "identities", filePath, ...(0, executor_js_1.buildCommonArgs)(params)];
97
+ return (0, executor_js_1.execOryTool)(args);
98
+ }));
99
+ server.registerTool("ory_validate_identity", {
100
+ title: "Validate Identity",
101
+ description: "Validate one or more local identity definitions against the project's identity schema.",
102
+ inputSchema: {
103
+ content: zod_1.z
104
+ .string()
105
+ .optional()
106
+ .describe("Identity JSON (single object or array). Used if 'file' is not provided."),
107
+ file: zod_1.z
108
+ .string()
109
+ .optional()
110
+ .describe("Path to JSON file on disk (takes precedence over content)."),
111
+ project: projectParam,
112
+ workspace: workspaceParam,
113
+ },
114
+ }, async (params) => (0, executor_js_1.withFileOrContent)(params, ".json", (filePath) => {
115
+ const args = ["validate", "identity", filePath, ...(0, executor_js_1.buildCommonArgs)(params)];
116
+ return (0, executor_js_1.execOryTool)(args);
117
+ }));
118
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerJwkTools(server: McpServer): void;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerJwkTools = registerJwkTools;
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 registerJwkTools(server) {
9
+ server.registerTool("ory_create_jwk", {
10
+ title: "Create JSON Web Key Set",
11
+ description: "Create a new JSON Web Key Set with a single JSON Web Key.",
12
+ inputSchema: {
13
+ set_id: zod_1.z.string().describe("Set ID for the JSON Web Key Set"),
14
+ algorithm: zod_1.z
15
+ .enum(["RS256", "RS512", "ES256", "ES512", "EdDSA"])
16
+ .optional()
17
+ .describe("Algorithm used to generate the key (default RS256)"),
18
+ use: zod_1.z
19
+ .enum(["sig", "enc"])
20
+ .optional()
21
+ .describe("Intended key use (default sig)"),
22
+ public_only: zod_1.z
23
+ .boolean()
24
+ .optional()
25
+ .describe("Only return public keys"),
26
+ project: projectParam,
27
+ workspace: workspaceParam,
28
+ },
29
+ }, async (params) => {
30
+ const args = ["create", "jwk", params.set_id, ...(0, executor_js_1.buildCommonArgs)(params)];
31
+ if (params.algorithm)
32
+ args.push("--alg", params.algorithm);
33
+ if (params.use)
34
+ args.push("--use", params.use);
35
+ if (params.public_only === true)
36
+ args.push("--public");
37
+ return (0, executor_js_1.execOryTool)(args);
38
+ });
39
+ server.registerTool("ory_get_jwk", {
40
+ title: "Get JSON Web Key Set",
41
+ description: "Get one or more JSON Web Key Sets by their set IDs.",
42
+ inputSchema: {
43
+ ids: zod_1.z.array(zod_1.z.string()).min(1).describe("One or more JSON Web Key Set IDs"),
44
+ public_only: zod_1.z
45
+ .boolean()
46
+ .optional()
47
+ .describe("Only return public keys"),
48
+ project: projectParam,
49
+ workspace: workspaceParam,
50
+ },
51
+ }, async (params) => {
52
+ const args = ["get", "jwk", ...params.ids, ...(0, executor_js_1.buildCommonArgs)(params)];
53
+ if (params.public_only === true)
54
+ args.push("--public");
55
+ return (0, executor_js_1.execOryTool)(args);
56
+ });
57
+ server.registerTool("ory_delete_jwk", {
58
+ title: "Delete JSON Web Key Set",
59
+ description: "Delete one or more JSON Web Key Sets by their IDs. This action is irreversible.",
60
+ inputSchema: {
61
+ ids: zod_1.z
62
+ .array(zod_1.z.string())
63
+ .min(1)
64
+ .describe("One or more JSON Web Key Set IDs to delete"),
65
+ project: projectParam,
66
+ workspace: workspaceParam,
67
+ },
68
+ }, async (params) => {
69
+ const args = ["delete", "jwk", ...params.ids, ...(0, executor_js_1.buildCommonArgs)(params)];
70
+ return (0, executor_js_1.execOryTool)(args);
71
+ });
72
+ server.registerTool("ory_import_jwk", {
73
+ title: "Import JSON Web Keys",
74
+ description: "Import JSON Web Keys into a key set from a JSON file or inline JSON content. Supports raw JWK or PEM/DER encoded data; if the set does not exist it will be created.",
75
+ inputSchema: {
76
+ set_id: zod_1.z.string().describe("Target JSON Web Key Set ID"),
77
+ content: zod_1.z
78
+ .string()
79
+ .optional()
80
+ .describe("JWK JSON content. Used if 'file' is not provided."),
81
+ file: zod_1.z
82
+ .string()
83
+ .optional()
84
+ .describe("Path to a JWK JSON file (takes precedence over content)."),
85
+ algorithm: zod_1.z
86
+ .string()
87
+ .optional()
88
+ .describe("Sets the 'alg' value if the imported key has none (required for PEM/DER)"),
89
+ use: zod_1.z
90
+ .enum(["sig", "enc"])
91
+ .optional()
92
+ .describe("Sets the 'use' value if the imported key has none (default sig)"),
93
+ project: projectParam,
94
+ workspace: workspaceParam,
95
+ },
96
+ }, async (params) => (0, executor_js_1.withFileOrContent)(params, ".json", (filePath) => {
97
+ const args = [
98
+ "import",
99
+ "jwk",
100
+ params.set_id,
101
+ filePath,
102
+ ...(0, executor_js_1.buildCommonArgs)(params),
103
+ ];
104
+ if (params.algorithm)
105
+ args.push("--alg", params.algorithm);
106
+ if (params.use)
107
+ args.push("--use", params.use);
108
+ return (0, executor_js_1.execOryTool)(args);
109
+ }));
110
+ }
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerOAuth2Tools(server: McpServer): void;