@iris-mcp/admin 0.0.0-stage → 1.0.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/CHANGELOG.md +242 -0
- package/LICENSE +21 -0
- package/README.md +1030 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.js +33 -0
- package/dist/prompts/auditSecurityPosture.d.ts +12 -0
- package/dist/prompts/auditSecurityPosture.js +52 -0
- package/dist/prompts/index.d.ts +12 -0
- package/dist/prompts/index.js +16 -0
- package/dist/prompts/provisionProjectEnvironment.d.ts +11 -0
- package/dist/prompts/provisionProjectEnvironment.js +48 -0
- package/dist/tools/audit.d.ts +42 -0
- package/dist/tools/audit.js +394 -0
- package/dist/tools/database.d.ts +14 -0
- package/dist/tools/database.js +179 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/index.js +52 -0
- package/dist/tools/ldap.d.ts +33 -0
- package/dist/tools/ldap.js +252 -0
- package/dist/tools/mapping.d.ts +15 -0
- package/dist/tools/mapping.js +175 -0
- package/dist/tools/namespace.d.ts +14 -0
- package/dist/tools/namespace.js +145 -0
- package/dist/tools/oauth.d.ts +17 -0
- package/dist/tools/oauth.js +269 -0
- package/dist/tools/permission.d.ts +13 -0
- package/dist/tools/permission.js +70 -0
- package/dist/tools/presets.d.ts +20 -0
- package/dist/tools/presets.js +84 -0
- package/dist/tools/resource.d.ts +81 -0
- package/dist/tools/resource.js +402 -0
- package/dist/tools/role.d.ts +14 -0
- package/dist/tools/role.js +139 -0
- package/dist/tools/service.d.ts +19 -0
- package/dist/tools/service.js +199 -0
- package/dist/tools/ssl.d.ts +14 -0
- package/dist/tools/ssl.js +201 -0
- package/dist/tools/user.d.ts +20 -0
- package/dist/tools/user.js +326 -0
- package/dist/tools/webapp.d.ts +20 -0
- package/dist/tools/webapp.js +268 -0
- package/dist/tools/x509.d.ts +42 -0
- package/dist/tools/x509.js +224 -0
- package/package.json +58 -3
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespace mapping tools for the IRIS Administration MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Provides two tools for managing global, routine, and package mappings
|
|
5
|
+
* between IRIS namespaces via the custom REST endpoint:
|
|
6
|
+
* - {@link mappingManageTool} — Create or delete a mapping
|
|
7
|
+
* - {@link mappingListTool} — List all mappings of a given type for a namespace
|
|
8
|
+
*
|
|
9
|
+
* All tools call the custom REST service at `/api/executemcp/v2/config/mapping/:type`.
|
|
10
|
+
* Operations execute in %SYS namespace on the IRIS server.
|
|
11
|
+
*/
|
|
12
|
+
import { IrisApiError } from "@iris-mcp/shared";
|
|
13
|
+
import { z } from "zod";
|
|
14
|
+
/** Base URL for the custom ExecuteMCPv2 REST service. */
|
|
15
|
+
const BASE_URL = "/api/executemcp/v2";
|
|
16
|
+
// ── iris_mapping_manage ────────────────────────────────────────
|
|
17
|
+
export const mappingManageTool = {
|
|
18
|
+
name: "iris_mapping_manage",
|
|
19
|
+
title: "Manage Namespace Mapping",
|
|
20
|
+
description: "Create or delete a global, routine, or package mapping between namespaces. " +
|
|
21
|
+
"For 'create', database is required. For global mappings, optional collation, " +
|
|
22
|
+
"lockDatabase, and subscript parameters are supported. " +
|
|
23
|
+
"When 'subscript' is supplied, a subscript-level mapping is created for that node " +
|
|
24
|
+
"(e.g. name='%SYS' + subscript='(\"HealthShare\")' maps %SYS(\"HealthShare\") only, " +
|
|
25
|
+
"leaving the base %SYS mapping intact); the returned 'name' echoes the full mapped " +
|
|
26
|
+
"node (e.g. %SYS(\"HealthShare\")). Creating a BASE mapping (no subscript) for a " +
|
|
27
|
+
"%-prefixed system global is refused unless force=true, since it shadows the global's " +
|
|
28
|
+
"system default. Modification is done by delete + create.",
|
|
29
|
+
inputSchema: z.object({
|
|
30
|
+
action: z
|
|
31
|
+
.enum(["create", "delete"])
|
|
32
|
+
.describe("Action to perform on the mapping"),
|
|
33
|
+
type: z
|
|
34
|
+
.enum(["global", "routine", "package"])
|
|
35
|
+
.describe("Type of mapping to manage"),
|
|
36
|
+
namespace: z
|
|
37
|
+
.string()
|
|
38
|
+
.describe("Namespace to configure mappings for (e.g., 'USER')"),
|
|
39
|
+
name: z
|
|
40
|
+
.string()
|
|
41
|
+
.describe("Mapping name (global name, routine name, or package name)"),
|
|
42
|
+
database: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Target database name (required for create)"),
|
|
46
|
+
collation: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Collation setting (global mappings only)"),
|
|
50
|
+
lockDatabase: z
|
|
51
|
+
.string()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("Lock database name (global mappings only)"),
|
|
54
|
+
subscript: z
|
|
55
|
+
.string()
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("Subscript node/range for a subscript-level mapping (global mappings only), " +
|
|
58
|
+
"e.g. '(\"HealthShare\")' or '(1):(100)'. It is appended to 'name' to form the " +
|
|
59
|
+
"mapped global (name='%SYS' + subscript='(\"HealthShare\")' -> %SYS(\"HealthShare\")). " +
|
|
60
|
+
"Omit for a base-global mapping."),
|
|
61
|
+
force: z
|
|
62
|
+
.boolean()
|
|
63
|
+
.optional()
|
|
64
|
+
.describe("Override the safety guard that refuses to create a base mapping (no subscript) " +
|
|
65
|
+
"for a %-prefixed system global. Required to deliberately remap a base %-global."),
|
|
66
|
+
}),
|
|
67
|
+
annotations: {
|
|
68
|
+
destructiveHint: true,
|
|
69
|
+
readOnlyHint: false,
|
|
70
|
+
idempotentHint: false,
|
|
71
|
+
openWorldHint: false,
|
|
72
|
+
},
|
|
73
|
+
scope: "SYS",
|
|
74
|
+
handler: async (args, ctx) => {
|
|
75
|
+
const { action, type, namespace, name, database, collation, lockDatabase, subscript, force, } = args;
|
|
76
|
+
const body = { action, namespace, name };
|
|
77
|
+
if (database)
|
|
78
|
+
body.database = database;
|
|
79
|
+
if (collation)
|
|
80
|
+
body.collation = collation;
|
|
81
|
+
if (lockDatabase)
|
|
82
|
+
body.lockDatabase = lockDatabase;
|
|
83
|
+
if (subscript)
|
|
84
|
+
body.subscript = subscript;
|
|
85
|
+
if (force !== undefined)
|
|
86
|
+
body.force = force;
|
|
87
|
+
const path = `${BASE_URL}/config/mapping/${type}`;
|
|
88
|
+
try {
|
|
89
|
+
const response = await ctx.http.post(path, body);
|
|
90
|
+
const result = response.result;
|
|
91
|
+
return {
|
|
92
|
+
content: [
|
|
93
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
94
|
+
],
|
|
95
|
+
structuredContent: result,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error instanceof IrisApiError) {
|
|
100
|
+
return {
|
|
101
|
+
content: [
|
|
102
|
+
{
|
|
103
|
+
type: "text",
|
|
104
|
+
text: `Error managing ${type} mapping '${name}': ${error.message}`,
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
isError: true,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
// ── iris_mapping_list ──────────────────────────────────────────
|
|
115
|
+
export const mappingListTool = {
|
|
116
|
+
name: "iris_mapping_list",
|
|
117
|
+
title: "List Namespace Mappings",
|
|
118
|
+
description: "List all global, routine, or package mappings for a given namespace. " +
|
|
119
|
+
"Returns mapping name, type, namespace, database, and type-specific properties.",
|
|
120
|
+
inputSchema: z.object({
|
|
121
|
+
namespace: z
|
|
122
|
+
.string()
|
|
123
|
+
.describe("Namespace to list mappings for (e.g., 'USER')"),
|
|
124
|
+
type: z
|
|
125
|
+
.enum(["global", "routine", "package"])
|
|
126
|
+
.describe("Type of mappings to list"),
|
|
127
|
+
cursor: z
|
|
128
|
+
.string()
|
|
129
|
+
.optional()
|
|
130
|
+
.describe("Pagination cursor from a previous response's nextCursor field"),
|
|
131
|
+
}),
|
|
132
|
+
annotations: {
|
|
133
|
+
readOnlyHint: true,
|
|
134
|
+
destructiveHint: false,
|
|
135
|
+
idempotentHint: true,
|
|
136
|
+
openWorldHint: false,
|
|
137
|
+
},
|
|
138
|
+
scope: "SYS",
|
|
139
|
+
handler: async (args, ctx) => {
|
|
140
|
+
const { namespace, type, cursor } = args;
|
|
141
|
+
const path = `${BASE_URL}/config/mapping/${type}?namespace=${encodeURIComponent(namespace)}`;
|
|
142
|
+
try {
|
|
143
|
+
const response = await ctx.http.get(path);
|
|
144
|
+
const rawResult = response.result;
|
|
145
|
+
const allMappings = Array.isArray(rawResult) ? rawResult : [];
|
|
146
|
+
const { page, nextCursor } = ctx.paginate(allMappings, cursor);
|
|
147
|
+
const result = {
|
|
148
|
+
mappings: page,
|
|
149
|
+
count: page.length,
|
|
150
|
+
...(nextCursor ? { nextCursor } : {}),
|
|
151
|
+
};
|
|
152
|
+
return {
|
|
153
|
+
content: [
|
|
154
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
155
|
+
],
|
|
156
|
+
structuredContent: result,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
if (error instanceof IrisApiError) {
|
|
161
|
+
return {
|
|
162
|
+
content: [
|
|
163
|
+
{
|
|
164
|
+
type: "text",
|
|
165
|
+
text: `Error listing ${type} mappings: ${error.message}`,
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
isError: true,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
//# sourceMappingURL=mapping.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespace management tools for the IRIS Administration MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Provides two tools for managing IRIS namespaces via the custom REST endpoint:
|
|
5
|
+
* - {@link namespaceManageTool} — Create, modify, or delete a namespace
|
|
6
|
+
* - {@link namespaceListTool} — List all namespaces with DB associations
|
|
7
|
+
*
|
|
8
|
+
* All tools call the custom REST service at `/api/executemcp/v2/config/namespace`.
|
|
9
|
+
* Operations execute in %SYS namespace on the IRIS server.
|
|
10
|
+
*/
|
|
11
|
+
import { type ToolDefinition } from "@iris-mcp/shared";
|
|
12
|
+
export declare const namespaceManageTool: ToolDefinition;
|
|
13
|
+
export declare const namespaceListTool: ToolDefinition;
|
|
14
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespace management tools for the IRIS Administration MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Provides two tools for managing IRIS namespaces via the custom REST endpoint:
|
|
5
|
+
* - {@link namespaceManageTool} — Create, modify, or delete a namespace
|
|
6
|
+
* - {@link namespaceListTool} — List all namespaces with DB associations
|
|
7
|
+
*
|
|
8
|
+
* All tools call the custom REST service at `/api/executemcp/v2/config/namespace`.
|
|
9
|
+
* Operations execute in %SYS namespace on the IRIS server.
|
|
10
|
+
*/
|
|
11
|
+
import { IrisApiError } from "@iris-mcp/shared";
|
|
12
|
+
import { z } from "zod";
|
|
13
|
+
/** Base URL for the custom ExecuteMCPv2 REST service. */
|
|
14
|
+
const BASE_URL = "/api/executemcp/v2";
|
|
15
|
+
// ── iris_namespace_manage ───────────────────────────────────────
|
|
16
|
+
export const namespaceManageTool = {
|
|
17
|
+
name: "iris_namespace_manage",
|
|
18
|
+
title: "Manage Namespace",
|
|
19
|
+
description: "Create, modify, or delete an IRIS namespace. For 'create', codeDatabase and dataDatabase " +
|
|
20
|
+
"are required. For 'modify', only provided fields are updated. For 'delete', only the name is needed.",
|
|
21
|
+
inputSchema: z.object({
|
|
22
|
+
action: z
|
|
23
|
+
.enum(["create", "modify", "delete"])
|
|
24
|
+
.describe("Action to perform on the namespace"),
|
|
25
|
+
name: z
|
|
26
|
+
.string()
|
|
27
|
+
.describe("Namespace name (e.g., 'MYAPP', 'USER')"),
|
|
28
|
+
codeDatabase: z
|
|
29
|
+
.string()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Code/routine database name (required for create)"),
|
|
32
|
+
dataDatabase: z
|
|
33
|
+
.string()
|
|
34
|
+
.optional()
|
|
35
|
+
.describe("Data/globals database name (required for create)"),
|
|
36
|
+
library: z
|
|
37
|
+
.string()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("Library database name (default: IRISLIB)"),
|
|
40
|
+
tempGlobals: z
|
|
41
|
+
.string()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe("Temp globals database name (default: IRISTEMP)"),
|
|
44
|
+
}),
|
|
45
|
+
annotations: {
|
|
46
|
+
destructiveHint: true,
|
|
47
|
+
readOnlyHint: false,
|
|
48
|
+
idempotentHint: false,
|
|
49
|
+
openWorldHint: false,
|
|
50
|
+
},
|
|
51
|
+
scope: "SYS",
|
|
52
|
+
handler: async (args, ctx) => {
|
|
53
|
+
const { action, name, codeDatabase, dataDatabase, library, tempGlobals } = args;
|
|
54
|
+
const body = { action, name };
|
|
55
|
+
if (codeDatabase)
|
|
56
|
+
body.codeDatabase = codeDatabase;
|
|
57
|
+
if (dataDatabase)
|
|
58
|
+
body.dataDatabase = dataDatabase;
|
|
59
|
+
if (library)
|
|
60
|
+
body.library = library;
|
|
61
|
+
if (tempGlobals)
|
|
62
|
+
body.tempGlobals = tempGlobals;
|
|
63
|
+
const path = `${BASE_URL}/config/namespace`;
|
|
64
|
+
try {
|
|
65
|
+
const response = await ctx.http.post(path, body);
|
|
66
|
+
const result = response.result;
|
|
67
|
+
return {
|
|
68
|
+
content: [
|
|
69
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
70
|
+
],
|
|
71
|
+
structuredContent: result,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (error instanceof IrisApiError) {
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: `Error managing namespace '${name}': ${error.message}`,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
isError: true,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
throw error;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
// ── iris_namespace_list ─────────────────────────────────────────
|
|
91
|
+
export const namespaceListTool = {
|
|
92
|
+
name: "iris_namespace_list",
|
|
93
|
+
title: "List Namespaces",
|
|
94
|
+
description: "List all IRIS namespaces with their code and data database associations. " +
|
|
95
|
+
"Returns namespace name, globals database, routines database, library, and temp globals database.",
|
|
96
|
+
inputSchema: z.object({
|
|
97
|
+
cursor: z
|
|
98
|
+
.string()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe("Pagination cursor from a previous response's nextCursor field"),
|
|
101
|
+
}),
|
|
102
|
+
annotations: {
|
|
103
|
+
readOnlyHint: true,
|
|
104
|
+
destructiveHint: false,
|
|
105
|
+
idempotentHint: true,
|
|
106
|
+
openWorldHint: false,
|
|
107
|
+
},
|
|
108
|
+
scope: "SYS",
|
|
109
|
+
handler: async (args, ctx) => {
|
|
110
|
+
const { cursor } = args;
|
|
111
|
+
const path = `${BASE_URL}/config/namespace`;
|
|
112
|
+
try {
|
|
113
|
+
const response = await ctx.http.get(path);
|
|
114
|
+
const rawResult = response.result;
|
|
115
|
+
const allNamespaces = Array.isArray(rawResult) ? rawResult : [];
|
|
116
|
+
const { page, nextCursor } = ctx.paginate(allNamespaces, cursor);
|
|
117
|
+
const result = {
|
|
118
|
+
namespaces: page,
|
|
119
|
+
count: page.length,
|
|
120
|
+
...(nextCursor ? { nextCursor } : {}),
|
|
121
|
+
};
|
|
122
|
+
return {
|
|
123
|
+
content: [
|
|
124
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
125
|
+
],
|
|
126
|
+
structuredContent: result,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
if (error instanceof IrisApiError) {
|
|
131
|
+
return {
|
|
132
|
+
content: [
|
|
133
|
+
{
|
|
134
|
+
type: "text",
|
|
135
|
+
text: `Error listing namespaces: ${error.message}`,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
isError: true,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
throw error;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=namespace.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth2 configuration management tools for the IRIS Administration MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Provides two tools for managing IRIS OAuth2 configurations via the custom REST endpoint:
|
|
5
|
+
* - {@link oauthManageTool} — Create or delete OAuth2 server definitions and client
|
|
6
|
+
* registrations, or perform OpenID Connect discovery
|
|
7
|
+
* - {@link oauthListTool} — List all OAuth2 server definitions and registered clients
|
|
8
|
+
*
|
|
9
|
+
* All tools call the custom REST service at `/api/executemcp/v2/security/oauth`.
|
|
10
|
+
* Operations execute in %SYS namespace on the IRIS server.
|
|
11
|
+
*
|
|
12
|
+
* **CRITICAL**: Client secrets are NEVER included in any response (NFR6).
|
|
13
|
+
*/
|
|
14
|
+
import { type ToolDefinition } from "@iris-mcp/shared";
|
|
15
|
+
export declare const oauthManageTool: ToolDefinition;
|
|
16
|
+
export declare const oauthListTool: ToolDefinition;
|
|
17
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OAuth2 configuration management tools for the IRIS Administration MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Provides two tools for managing IRIS OAuth2 configurations via the custom REST endpoint:
|
|
5
|
+
* - {@link oauthManageTool} — Create or delete OAuth2 server definitions and client
|
|
6
|
+
* registrations, or perform OpenID Connect discovery
|
|
7
|
+
* - {@link oauthListTool} — List all OAuth2 server definitions and registered clients
|
|
8
|
+
*
|
|
9
|
+
* All tools call the custom REST service at `/api/executemcp/v2/security/oauth`.
|
|
10
|
+
* Operations execute in %SYS namespace on the IRIS server.
|
|
11
|
+
*
|
|
12
|
+
* **CRITICAL**: Client secrets are NEVER included in any response (NFR6).
|
|
13
|
+
*/
|
|
14
|
+
import { IrisApiError } from "@iris-mcp/shared";
|
|
15
|
+
import { z } from "zod";
|
|
16
|
+
/** Base URL for the custom ExecuteMCPv2 REST service. */
|
|
17
|
+
const BASE_URL = "/api/executemcp/v2";
|
|
18
|
+
// ── iris_oauth_manage ──────────────────────────────────────────
|
|
19
|
+
export const oauthManageTool = {
|
|
20
|
+
name: "iris_oauth_manage",
|
|
21
|
+
title: "Manage OAuth2 Configuration",
|
|
22
|
+
description: "Create or delete OAuth2 server definitions and client registrations, " +
|
|
23
|
+
"or perform OpenID Connect discovery from an issuer URL. " +
|
|
24
|
+
"For 'create' and 'delete', entity ('server' or 'client') is required. " +
|
|
25
|
+
"For 'discover', issuerURL is required and 'sslConfiguration' (the name of an " +
|
|
26
|
+
"IRIS SSL/TLS client configuration — inspect with iris_ssl_list, create with " +
|
|
27
|
+
"iris_ssl_manage) is REQUIRED for https issuers; discover SAVES a server " +
|
|
28
|
+
"definition keyed by the exact issuer URL. " +
|
|
29
|
+
"Client registration (create + entity 'client') requires a PRIOR successful " +
|
|
30
|
+
"discover for the issuer: serverName is the exact issuer URL of that discovered " +
|
|
31
|
+
"server definition. A failed remote registration (e.g. the issuer publishes no " +
|
|
32
|
+
"dynamic registration endpoint) leaves the local client record saved. " +
|
|
33
|
+
"Client secrets are never returned in responses.",
|
|
34
|
+
inputSchema: z.object({
|
|
35
|
+
action: z
|
|
36
|
+
.enum(["create", "delete", "discover"])
|
|
37
|
+
.describe("Action to perform: 'create' a server/client, 'delete' a server/client, or 'discover' OIDC endpoints"),
|
|
38
|
+
entity: z
|
|
39
|
+
.enum(["server", "client"])
|
|
40
|
+
.optional()
|
|
41
|
+
.describe("Entity type for create/delete actions: 'server' for OAuth2 server definition, 'client' for client registration"),
|
|
42
|
+
issuerURL: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Issuer URL for server creation or OIDC discovery (e.g., 'https://accounts.google.com')"),
|
|
46
|
+
name: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Name of the server or client to delete"),
|
|
50
|
+
serverName: z
|
|
51
|
+
.string()
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("Issuer URL of an existing, previously discovered OAuth2 server definition " +
|
|
54
|
+
"(required for client create) — the exact issuer URL string passed to a prior " +
|
|
55
|
+
"successful 'discover' (the match is exact; there is no user-chosen server name)"),
|
|
56
|
+
sslConfiguration: z
|
|
57
|
+
.string()
|
|
58
|
+
.optional()
|
|
59
|
+
.describe("Name of an IRIS SSL/TLS client configuration for discovery (e.g. " +
|
|
60
|
+
"'ISC.FeatureTracker.SSL.Config'; inspect with iris_ssl_list, create with " +
|
|
61
|
+
"iris_ssl_manage). REQUIRED by IRIS when the issuer URL is https."),
|
|
62
|
+
clientName: z
|
|
63
|
+
.string()
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("Application name for the client registration (required for client create)"),
|
|
66
|
+
redirectURIs: z
|
|
67
|
+
.string()
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("Redirect URI(s) for the client application"),
|
|
70
|
+
grantTypes: z
|
|
71
|
+
.string()
|
|
72
|
+
.optional()
|
|
73
|
+
.describe("Allowed grant types (e.g., 'authorization_code,refresh_token')"),
|
|
74
|
+
clientType: z
|
|
75
|
+
.string()
|
|
76
|
+
.optional()
|
|
77
|
+
.describe("Client type: 'public' or 'confidential'"),
|
|
78
|
+
description: z
|
|
79
|
+
.string()
|
|
80
|
+
.optional()
|
|
81
|
+
.describe("Description for the server or client"),
|
|
82
|
+
supportedScopes: z
|
|
83
|
+
.string()
|
|
84
|
+
.optional()
|
|
85
|
+
.describe("Supported scopes for server creation (e.g., 'openid profile email')"),
|
|
86
|
+
accessTokenInterval: z
|
|
87
|
+
.number()
|
|
88
|
+
.optional()
|
|
89
|
+
.describe("Access token lifetime in seconds (server create)"),
|
|
90
|
+
authorizationCodeInterval: z
|
|
91
|
+
.number()
|
|
92
|
+
.optional()
|
|
93
|
+
.describe("Authorization code lifetime in seconds (server create)"),
|
|
94
|
+
refreshTokenInterval: z
|
|
95
|
+
.number()
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("Refresh token lifetime in seconds (server create)"),
|
|
98
|
+
signingAlgorithm: z
|
|
99
|
+
.string()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe("Token signing algorithm (server create, e.g., 'RS256')"),
|
|
102
|
+
customizationNamespace: z
|
|
103
|
+
.string()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe("Namespace containing customization classes for the server (server create). " +
|
|
106
|
+
"Required by IRIS OAuth2.Server.Configuration; when omitted it defaults to the " +
|
|
107
|
+
"request's target namespace."),
|
|
108
|
+
customizationRoles: z
|
|
109
|
+
.string()
|
|
110
|
+
.optional()
|
|
111
|
+
.describe("Comma-separated roles granted to customization classes (server create). " +
|
|
112
|
+
"REQUIRED by IRIS OAuth2.Server.Configuration (min length 1) and has no safe default — " +
|
|
113
|
+
"omitting it makes server creation fail with a 'property required' error. " +
|
|
114
|
+
"Also note 'supportedScopes' is required for server creation."),
|
|
115
|
+
}),
|
|
116
|
+
annotations: {
|
|
117
|
+
destructiveHint: true,
|
|
118
|
+
readOnlyHint: false,
|
|
119
|
+
idempotentHint: false,
|
|
120
|
+
openWorldHint: false,
|
|
121
|
+
},
|
|
122
|
+
scope: "SYS",
|
|
123
|
+
handler: async (args, ctx) => {
|
|
124
|
+
const { action, entity, issuerURL, name, serverName, sslConfiguration, clientName, redirectURIs, grantTypes, clientType, description, supportedScopes, accessTokenInterval, authorizationCodeInterval, refreshTokenInterval, signingAlgorithm, customizationNamespace, customizationRoles, } = args;
|
|
125
|
+
const body = { action };
|
|
126
|
+
if (entity !== undefined)
|
|
127
|
+
body.entity = entity;
|
|
128
|
+
if (issuerURL !== undefined)
|
|
129
|
+
body.issuerURL = issuerURL;
|
|
130
|
+
if (name !== undefined)
|
|
131
|
+
body.name = name;
|
|
132
|
+
if (serverName !== undefined)
|
|
133
|
+
body.serverName = serverName;
|
|
134
|
+
if (sslConfiguration !== undefined)
|
|
135
|
+
body.sslConfiguration = sslConfiguration;
|
|
136
|
+
if (clientName !== undefined)
|
|
137
|
+
body.clientName = clientName;
|
|
138
|
+
if (redirectURIs !== undefined)
|
|
139
|
+
body.redirectURIs = redirectURIs;
|
|
140
|
+
if (grantTypes !== undefined)
|
|
141
|
+
body.grantTypes = grantTypes;
|
|
142
|
+
if (clientType !== undefined)
|
|
143
|
+
body.clientType = clientType;
|
|
144
|
+
if (description !== undefined)
|
|
145
|
+
body.description = description;
|
|
146
|
+
// FEAT-1: split supportedScopes string into a JSON array by whitespace or comma
|
|
147
|
+
// so IRIS receives a proper collection for OAuth2.Server.Configuration
|
|
148
|
+
if (supportedScopes !== undefined) {
|
|
149
|
+
body.supportedScopes = supportedScopes
|
|
150
|
+
.split(/[\s,]+/)
|
|
151
|
+
.filter((s) => s.length > 0);
|
|
152
|
+
}
|
|
153
|
+
if (accessTokenInterval !== undefined)
|
|
154
|
+
body.accessTokenInterval = accessTokenInterval;
|
|
155
|
+
if (authorizationCodeInterval !== undefined)
|
|
156
|
+
body.authorizationCodeInterval = authorizationCodeInterval;
|
|
157
|
+
if (refreshTokenInterval !== undefined)
|
|
158
|
+
body.refreshTokenInterval = refreshTokenInterval;
|
|
159
|
+
if (signingAlgorithm !== undefined)
|
|
160
|
+
body.signingAlgorithm = signingAlgorithm;
|
|
161
|
+
// FEAT-1: forward customizationNamespace and customizationRoles, both Required
|
|
162
|
+
// by OAuth2.Server.Configuration. Send empty string when omitted: the handler
|
|
163
|
+
// defaults an empty customizationNamespace to the request namespace, while an
|
|
164
|
+
// empty customizationRoles is left unset and surfaces IRIS's clean "property
|
|
165
|
+
// required" error (it grants roles to customization code, so there is no safe
|
|
166
|
+
// default to invent here).
|
|
167
|
+
if (action === "create" && entity === "server") {
|
|
168
|
+
body.customizationNamespace = customizationNamespace ?? "";
|
|
169
|
+
body.customizationRoles = customizationRoles ?? "";
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
if (customizationNamespace !== undefined)
|
|
173
|
+
body.customizationNamespace = customizationNamespace;
|
|
174
|
+
if (customizationRoles !== undefined)
|
|
175
|
+
body.customizationRoles = customizationRoles;
|
|
176
|
+
}
|
|
177
|
+
const path = `${BASE_URL}/security/oauth`;
|
|
178
|
+
try {
|
|
179
|
+
const response = await ctx.http.post(path, body);
|
|
180
|
+
const result = response.result;
|
|
181
|
+
return {
|
|
182
|
+
content: [
|
|
183
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
184
|
+
],
|
|
185
|
+
structuredContent: result,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
if (error instanceof IrisApiError) {
|
|
190
|
+
return {
|
|
191
|
+
content: [
|
|
192
|
+
{
|
|
193
|
+
type: "text",
|
|
194
|
+
text: `Error managing OAuth2 configuration: ${error.message}`,
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
isError: true,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
// ── iris_oauth_list ───────────────────────────────────────────
|
|
205
|
+
export const oauthListTool = {
|
|
206
|
+
name: "iris_oauth_list",
|
|
207
|
+
title: "List OAuth2 Configurations",
|
|
208
|
+
description: "List all IRIS OAuth2 server definitions and registered client applications. " +
|
|
209
|
+
"Returns server definitions (issuer endpoint, scopes, token lifetimes, signing algorithm) " +
|
|
210
|
+
"and client registrations (application name, server, client ID, client type, redirect URL). " +
|
|
211
|
+
"Client secrets are never included in the response.",
|
|
212
|
+
inputSchema: z.object({
|
|
213
|
+
cursor: z
|
|
214
|
+
.string()
|
|
215
|
+
.optional()
|
|
216
|
+
.describe("Pagination cursor from a previous response's nextCursor field"),
|
|
217
|
+
}),
|
|
218
|
+
annotations: {
|
|
219
|
+
readOnlyHint: true,
|
|
220
|
+
destructiveHint: false,
|
|
221
|
+
idempotentHint: true,
|
|
222
|
+
openWorldHint: false,
|
|
223
|
+
},
|
|
224
|
+
scope: "SYS",
|
|
225
|
+
handler: async (_args, ctx) => {
|
|
226
|
+
const path = `${BASE_URL}/security/oauth`;
|
|
227
|
+
try {
|
|
228
|
+
const response = await ctx.http.get(path);
|
|
229
|
+
const rawResult = response.result;
|
|
230
|
+
// The IRIS handler returns {servers, clients, serverCount, clientCount}
|
|
231
|
+
const servers = Array.isArray(rawResult?.servers)
|
|
232
|
+
? rawResult.servers
|
|
233
|
+
: [];
|
|
234
|
+
const clients = Array.isArray(rawResult?.clients)
|
|
235
|
+
? rawResult.clients
|
|
236
|
+
: [];
|
|
237
|
+
// OAuth2 configs are returned as two separate collections (servers + clients).
|
|
238
|
+
// Combined pagination would mix entity types in a single page, so we return
|
|
239
|
+
// the full collections and omit cursor-based paging for this endpoint.
|
|
240
|
+
const result = {
|
|
241
|
+
servers: servers,
|
|
242
|
+
clients: clients,
|
|
243
|
+
serverCount: servers.length,
|
|
244
|
+
clientCount: clients.length,
|
|
245
|
+
};
|
|
246
|
+
return {
|
|
247
|
+
content: [
|
|
248
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
249
|
+
],
|
|
250
|
+
structuredContent: result,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
if (error instanceof IrisApiError) {
|
|
255
|
+
return {
|
|
256
|
+
content: [
|
|
257
|
+
{
|
|
258
|
+
type: "text",
|
|
259
|
+
text: `Error listing OAuth2 configurations: ${error.message}`,
|
|
260
|
+
},
|
|
261
|
+
],
|
|
262
|
+
isError: true,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
throw error;
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
//# sourceMappingURL=oauth.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Permission check tool for the IRIS Administration MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Provides a single tool for checking whether a user or role has specific
|
|
5
|
+
* permissions on a resource:
|
|
6
|
+
* - {@link permissionCheckTool} — Check permission for a user/role on a resource
|
|
7
|
+
*
|
|
8
|
+
* Calls the custom REST service at `/api/executemcp/v2/security/permission`.
|
|
9
|
+
* Operations execute in %SYS namespace on the IRIS server.
|
|
10
|
+
*/
|
|
11
|
+
import { type ToolDefinition } from "@iris-mcp/shared";
|
|
12
|
+
export declare const permissionCheckTool: ToolDefinition;
|
|
13
|
+
//# sourceMappingURL=permission.d.ts.map
|