@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
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @iris-mcp/admin -- IRIS Administration Tools MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Entry point that creates an {@link McpServerBase} instance with
|
|
6
|
+
* the registered administration tool definitions and connects the
|
|
7
|
+
* stdio transport, the only supported transport; any other configured
|
|
8
|
+
* transport is a fatal configuration error.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @iris-mcp/admin -- IRIS Administration Tools MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Entry point that creates an {@link McpServerBase} instance with
|
|
6
|
+
* the registered administration tool definitions and connects the
|
|
7
|
+
* stdio transport, the only supported transport; any other configured
|
|
8
|
+
* transport is a fatal configuration error.
|
|
9
|
+
*/
|
|
10
|
+
import { createRequire } from "node:module";
|
|
11
|
+
import { McpServerBase, resolveTransport } from "@iris-mcp/shared";
|
|
12
|
+
import { tools } from "./tools/index.js";
|
|
13
|
+
import { toolPresets } from "./tools/presets.js";
|
|
14
|
+
import { prompts } from "./prompts/index.js";
|
|
15
|
+
// Read version from package.json using createRequire (ESM-safe)
|
|
16
|
+
const require = createRequire(import.meta.url);
|
|
17
|
+
const pkg = require("../package.json");
|
|
18
|
+
const server = new McpServerBase({
|
|
19
|
+
name: "@iris-mcp/admin",
|
|
20
|
+
version: pkg.version,
|
|
21
|
+
tools,
|
|
22
|
+
toolPresets,
|
|
23
|
+
prompts,
|
|
24
|
+
needsCustomRest: true,
|
|
25
|
+
});
|
|
26
|
+
try {
|
|
27
|
+
await server.start(resolveTransport());
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
console.error("Fatal:", err);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `audit-security-posture` prompt (Epic 25, Story 25.1 — spec
|
|
3
|
+
* `03-skills-prompts-pack.md` §3).
|
|
4
|
+
*
|
|
5
|
+
* Walks `iris_user_get` → `iris_role_list` → `iris_service_manage` (list) →
|
|
6
|
+
* `iris_ssl_list` → `iris_audit_manage` (status) and reports default
|
|
7
|
+
* passwords, `%All` holders, and insecure services. Read-only workflow.
|
|
8
|
+
* Server: iris-admin-mcp.
|
|
9
|
+
*/
|
|
10
|
+
import type { PromptDefinition } from "@iris-mcp/shared";
|
|
11
|
+
export declare const auditSecurityPosturePrompt: PromptDefinition;
|
|
12
|
+
//# sourceMappingURL=auditSecurityPosture.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `audit-security-posture` prompt (Epic 25, Story 25.1 — spec
|
|
3
|
+
* `03-skills-prompts-pack.md` §3).
|
|
4
|
+
*
|
|
5
|
+
* Walks `iris_user_get` → `iris_role_list` → `iris_service_manage` (list) →
|
|
6
|
+
* `iris_ssl_list` → `iris_audit_manage` (status) and reports default
|
|
7
|
+
* passwords, `%All` holders, and insecure services. Read-only workflow.
|
|
8
|
+
* Server: iris-admin-mcp.
|
|
9
|
+
*/
|
|
10
|
+
import { argOrPlaceholder as arg, isArgProvided } from "@iris-mcp/shared";
|
|
11
|
+
export const auditSecurityPosturePrompt = {
|
|
12
|
+
name: "audit-security-posture",
|
|
13
|
+
title: "Audit Security Posture",
|
|
14
|
+
description: "Audit the IRIS instance's security posture: users (default passwords, %All holders), " +
|
|
15
|
+
"roles, service authentication settings, SSL/TLS configs, and instance auditing status.",
|
|
16
|
+
skill: {
|
|
17
|
+
description: "A read-only audit of an IRIS instance's security: users whose password settings look stale or " +
|
|
18
|
+
"that may use a well-known default credential, every user and role that holds %All, services that " +
|
|
19
|
+
"are enabled without authentication or not needed, SSL/TLS configurations with a minimum TLS " +
|
|
20
|
+
"version below 1.2 or missing certificate paths, and whether auditing is on, ending in a report " +
|
|
21
|
+
"of recommended fixes; it changes nothing. Use when the user asks to audit, review or harden IRIS " +
|
|
22
|
+
"security, asks who holds %All, or asks whether services, SSL/TLS or auditing are set up safely.",
|
|
23
|
+
preset: "full",
|
|
24
|
+
},
|
|
25
|
+
arguments: [
|
|
26
|
+
{
|
|
27
|
+
name: "server",
|
|
28
|
+
description: "Optional named server profile (from IRIS_PROFILES) to target; omit to use the default server.",
|
|
29
|
+
required: false,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
build: (args) => {
|
|
33
|
+
const server = arg(args.server, "<server>");
|
|
34
|
+
const serverNote = isArgProvided(args.server)
|
|
35
|
+
? `Target server profile: "${server}" — pass \`server: "${server}"\` on every tool call below.`
|
|
36
|
+
: `No server profile specified — omit \`server\` (or pass "${server}") to use the default server on every tool call below.`;
|
|
37
|
+
return `# Audit Security Posture
|
|
38
|
+
|
|
39
|
+
${serverNote}
|
|
40
|
+
|
|
41
|
+
This is a READ-ONLY audit — every call below is a read action. Do not modify any user, role, service, or SSL configuration as part of this workflow.
|
|
42
|
+
|
|
43
|
+
1. Call \`iris_user_get\` with no \`name\` (lists all users). For each enabled user, check: does \`changePasswordOnNextLogin\`/expiration look stale or absent, and — for any account you suspect uses a well-known default credential (e.g. \`_SYSTEM\`, \`Admin\`, \`SuperUser\`) — flag it for the user to verify manually (never attempt to test a password via this workflow).
|
|
44
|
+
2. Call \`iris_role_list\` to enumerate all roles and their granted resources. Identify every role holding \`%All\` (or a resource with unrestricted \`RWU\`-style permission) — these are super-user-equivalent roles.
|
|
45
|
+
3. Cross-reference: for each user from step 1, check its \`roles\` field for \`%All\` (directly, or via a role from step 2 that grants it). Flag every account holding \`%All\` — this is the most security-sensitive finding.
|
|
46
|
+
4. Call \`iris_service_manage\` action 'list' to enumerate all IRIS services (e.g. %Service_Telnet, %Service_CallIn, %Service_SQL) and their enabled/authentication settings. Flag any service that is enabled but unauthenticated, or that is enabled and not needed (e.g. %Service_Telnet enabled on a production instance).
|
|
47
|
+
5. Call \`iris_ssl_list\` to enumerate SSL/TLS configurations. Flag any enabled config with a weak \`tlsMinVersion\` (below TLS1.2, bit 16) or missing certificate paths.
|
|
48
|
+
6. Call \`iris_audit_manage\` action 'status' to check whether instance auditing is enabled overall and per-event-type.
|
|
49
|
+
7. Produce a summary report with three sections: **Default/weak credentials** (accounts to verify manually), **%All holders** (users and roles), and **Insecure services/configs** (enabled-but-risky services, weak SSL configs, and whether auditing is on). Recommend fixes but do NOT apply them without the user's explicit approval.`;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=auditSecurityPosture.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt definitions for the IRIS Administration MCP server
|
|
3
|
+
* (Epic 25, Story 25.1 — spec `03-skills-prompts-pack.md` §3).
|
|
4
|
+
*
|
|
5
|
+
* Exports the array registered with {@link McpServerBase} via
|
|
6
|
+
* `McpServerBaseOptions.prompts`. Prompts carry no `mutates` classification
|
|
7
|
+
* and are not tools (Rule #31).
|
|
8
|
+
*/
|
|
9
|
+
import type { PromptDefinition } from "@iris-mcp/shared";
|
|
10
|
+
/** All prompt definitions registered by the iris-admin-mcp server. */
|
|
11
|
+
export declare const prompts: PromptDefinition[];
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt definitions for the IRIS Administration MCP server
|
|
3
|
+
* (Epic 25, Story 25.1 — spec `03-skills-prompts-pack.md` §3).
|
|
4
|
+
*
|
|
5
|
+
* Exports the array registered with {@link McpServerBase} via
|
|
6
|
+
* `McpServerBaseOptions.prompts`. Prompts carry no `mutates` classification
|
|
7
|
+
* and are not tools (Rule #31).
|
|
8
|
+
*/
|
|
9
|
+
import { provisionProjectEnvironmentPrompt } from "./provisionProjectEnvironment.js";
|
|
10
|
+
import { auditSecurityPosturePrompt } from "./auditSecurityPosture.js";
|
|
11
|
+
/** All prompt definitions registered by the iris-admin-mcp server. */
|
|
12
|
+
export const prompts = [
|
|
13
|
+
provisionProjectEnvironmentPrompt,
|
|
14
|
+
auditSecurityPosturePrompt,
|
|
15
|
+
];
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `provision-project-environment` prompt (Epic 25, Story 25.1 — spec
|
|
3
|
+
* `03-skills-prompts-pack.md` §3).
|
|
4
|
+
*
|
|
5
|
+
* Walks `iris_database_manage` (x2) → `iris_namespace_manage` →
|
|
6
|
+
* `iris_user_manage` → `iris_webapp_manage`, verifying each step before
|
|
7
|
+
* moving to the next, with rollback notes. Server: iris-admin-mcp.
|
|
8
|
+
*/
|
|
9
|
+
import type { PromptDefinition } from "@iris-mcp/shared";
|
|
10
|
+
export declare const provisionProjectEnvironmentPrompt: PromptDefinition;
|
|
11
|
+
//# sourceMappingURL=provisionProjectEnvironment.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `provision-project-environment` prompt (Epic 25, Story 25.1 — spec
|
|
3
|
+
* `03-skills-prompts-pack.md` §3).
|
|
4
|
+
*
|
|
5
|
+
* Walks `iris_database_manage` (x2) → `iris_namespace_manage` →
|
|
6
|
+
* `iris_user_manage` → `iris_webapp_manage`, verifying each step before
|
|
7
|
+
* moving to the next, with rollback notes. Server: iris-admin-mcp.
|
|
8
|
+
*/
|
|
9
|
+
import { argOrPlaceholder as arg } from "@iris-mcp/shared";
|
|
10
|
+
export const provisionProjectEnvironmentPrompt = {
|
|
11
|
+
name: "provision-project-environment",
|
|
12
|
+
title: "Provision Project Environment",
|
|
13
|
+
description: "Provision a new IRIS project environment: two databases, a namespace, a user, and a " +
|
|
14
|
+
"web application — verifying each step before the next, with rollback notes.",
|
|
15
|
+
skill: {
|
|
16
|
+
description: "Provisions a new IRIS project environment in order: a DATA and a CODE database, a namespace over " +
|
|
17
|
+
"them, a user whose default namespace it is, and a web application, checking each step before the " +
|
|
18
|
+
"next, rolling back the completed steps when one fails, and naming the manual follow-up a new web " +
|
|
19
|
+
"application needs. Use when the user wants to set up or create a new IRIS project, namespace or " +
|
|
20
|
+
"application environment.",
|
|
21
|
+
preset: "core",
|
|
22
|
+
},
|
|
23
|
+
arguments: [
|
|
24
|
+
{
|
|
25
|
+
name: "projectName",
|
|
26
|
+
description: "Short project name used to derive database, namespace, and web-app names (e.g. 'MyApp').",
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
build: (args) => {
|
|
31
|
+
const project = arg(args.projectName, "<projectName>");
|
|
32
|
+
const dataDb = `${project}DATA`;
|
|
33
|
+
const codeDb = `${project}CODE`;
|
|
34
|
+
return `# Provision Project Environment
|
|
35
|
+
|
|
36
|
+
Project: \`${project}\`
|
|
37
|
+
|
|
38
|
+
Verify EACH step succeeded (inspect the tool result) before proceeding to the next. If any step fails partway through, roll back the steps already completed (see the rollback note after each step) rather than leaving a half-provisioned environment.
|
|
39
|
+
|
|
40
|
+
1. Call \`iris_database_manage\` action 'create' with \`name: "${dataDb}"\` and a \`directory\` for the DATA database. *Rollback: \`iris_database_manage\` action 'delete' with \`name: "${dataDb}"\`.*
|
|
41
|
+
2. Call \`iris_database_manage\` action 'create' with \`name: "${codeDb}"\` and a \`directory\` for the CODE database. *Rollback: \`iris_database_manage\` action 'delete' with \`name: "${codeDb}"\`.*
|
|
42
|
+
3. Call \`iris_namespace_manage\` action 'create' with \`name: "${project}"\`, \`dataDatabase: "${dataDb}"\`, \`codeDatabase: "${codeDb}"\`. *Rollback: \`iris_namespace_manage\` action 'delete' with \`name: "${project}"\`, then undo steps 1-2.*
|
|
43
|
+
4. Call \`iris_user_manage\` action 'create' with a \`name\` and \`password\` for the project's service/developer account, and \`namespace: "${project}"\` as its default namespace. *Rollback: \`iris_user_manage\` action 'delete' with the same \`name\`.*
|
|
44
|
+
5. Call \`iris_webapp_manage\` action 'create' with a \`name\` starting with '/' (e.g. '/api/${project.toLowerCase()}'), \`namespace: "${project}"\`, and (if applicable) a \`dispatchClass\`. Note: creating a web app does NOT notify the CSP gateway — it requires saving through the Management Portal or a gateway restart to become active. *Rollback: \`iris_webapp_manage\` action 'delete' with the same \`name\`.*
|
|
45
|
+
6. Summarize what was created (database names, namespace, user, web app path) and any manual follow-up needed (CSP gateway activation for the new web app).`;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=provisionProjectEnvironment.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IRIS audit configuration & log management tool for the IRIS Administration
|
|
3
|
+
* MCP server.
|
|
4
|
+
*
|
|
5
|
+
* Provides {@link auditManageTool} — a single multi-action tool to inspect and
|
|
6
|
+
* configure instance auditing and manage the audit log via the custom REST
|
|
7
|
+
* endpoint `/api/executemcp/v2/security/audit`. Operations execute in the
|
|
8
|
+
* `%SYS` namespace on the IRIS server.
|
|
9
|
+
*
|
|
10
|
+
* **Governed write tool (Epic 15, Story 15.4) — the BROADEST Epic-15 tool**
|
|
11
|
+
* (7 actions across two IRIS subsystems: `Security.System` /
|
|
12
|
+
* `Security.Events` instance audit config, and `%SYS.Audit` for the audit
|
|
13
|
+
* log). The `mutates` classification map classifies every action: `status`
|
|
14
|
+
* and `view` are reads (enabled by default), while `enable`/`disable`/
|
|
15
|
+
* `configureEvent`/`purge`/`export` are writes that the governance layer
|
|
16
|
+
* default-DISABLES until an operator opts in via `IRIS_GOVERNANCE`. The tool
|
|
17
|
+
* does NOT declare a `server` field — the framework injects it (architecture
|
|
18
|
+
* decision D2).
|
|
19
|
+
*
|
|
20
|
+
* **Relationship to the read-only `iris_audit_events` tool (AC 15.4.2):**
|
|
21
|
+
* the existing read-only `iris_audit_events` tool (in `@iris-mcp/ops`) is a
|
|
22
|
+
* thin convenience reader of recent audit-log records. This tool COMPLEMENTS
|
|
23
|
+
* it: `view` here is the same audit-log read (with richer filters), while the
|
|
24
|
+
* write actions add audit CONFIGURATION (turn instance auditing on/off,
|
|
25
|
+
* enable/disable individual audit events) and audit-log LIFECYCLE management
|
|
26
|
+
* (purge bounded ranges, export to a server-side file). `iris_audit_events`
|
|
27
|
+
* remains UNCHANGED — this tool is strictly additive.
|
|
28
|
+
*
|
|
29
|
+
* **`purge` is destructive (AC 15.4.5):** `purge` deletes audit-log records.
|
|
30
|
+
* It is gated behind an explicit `confirm: true` parameter AND a bounded scope
|
|
31
|
+
* (at least one of begin/end/user/event/source/type) so an unbounded silent
|
|
32
|
+
* wipe is impossible from this tool; it returns the count deleted. The
|
|
33
|
+
* tool-level `annotations.destructiveHint` is `true`.
|
|
34
|
+
*
|
|
35
|
+
* **`export` path control (AC 15.4.5):** `export` writes a server-side file.
|
|
36
|
+
* The caller supplies a bare file NAME (not a path); the server writes it into
|
|
37
|
+
* a fixed audit-export directory and rejects any path-separator / traversal
|
|
38
|
+
* characters, then returns the resolved location + count.
|
|
39
|
+
*/
|
|
40
|
+
import { type ToolDefinition } from "@iris-mcp/shared";
|
|
41
|
+
export declare const auditManageTool: ToolDefinition;
|
|
42
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IRIS audit configuration & log management tool for the IRIS Administration
|
|
3
|
+
* MCP server.
|
|
4
|
+
*
|
|
5
|
+
* Provides {@link auditManageTool} — a single multi-action tool to inspect and
|
|
6
|
+
* configure instance auditing and manage the audit log via the custom REST
|
|
7
|
+
* endpoint `/api/executemcp/v2/security/audit`. Operations execute in the
|
|
8
|
+
* `%SYS` namespace on the IRIS server.
|
|
9
|
+
*
|
|
10
|
+
* **Governed write tool (Epic 15, Story 15.4) — the BROADEST Epic-15 tool**
|
|
11
|
+
* (7 actions across two IRIS subsystems: `Security.System` /
|
|
12
|
+
* `Security.Events` instance audit config, and `%SYS.Audit` for the audit
|
|
13
|
+
* log). The `mutates` classification map classifies every action: `status`
|
|
14
|
+
* and `view` are reads (enabled by default), while `enable`/`disable`/
|
|
15
|
+
* `configureEvent`/`purge`/`export` are writes that the governance layer
|
|
16
|
+
* default-DISABLES until an operator opts in via `IRIS_GOVERNANCE`. The tool
|
|
17
|
+
* does NOT declare a `server` field — the framework injects it (architecture
|
|
18
|
+
* decision D2).
|
|
19
|
+
*
|
|
20
|
+
* **Relationship to the read-only `iris_audit_events` tool (AC 15.4.2):**
|
|
21
|
+
* the existing read-only `iris_audit_events` tool (in `@iris-mcp/ops`) is a
|
|
22
|
+
* thin convenience reader of recent audit-log records. This tool COMPLEMENTS
|
|
23
|
+
* it: `view` here is the same audit-log read (with richer filters), while the
|
|
24
|
+
* write actions add audit CONFIGURATION (turn instance auditing on/off,
|
|
25
|
+
* enable/disable individual audit events) and audit-log LIFECYCLE management
|
|
26
|
+
* (purge bounded ranges, export to a server-side file). `iris_audit_events`
|
|
27
|
+
* remains UNCHANGED — this tool is strictly additive.
|
|
28
|
+
*
|
|
29
|
+
* **`purge` is destructive (AC 15.4.5):** `purge` deletes audit-log records.
|
|
30
|
+
* It is gated behind an explicit `confirm: true` parameter AND a bounded scope
|
|
31
|
+
* (at least one of begin/end/user/event/source/type) so an unbounded silent
|
|
32
|
+
* wipe is impossible from this tool; it returns the count deleted. The
|
|
33
|
+
* tool-level `annotations.destructiveHint` is `true`.
|
|
34
|
+
*
|
|
35
|
+
* **`export` path control (AC 15.4.5):** `export` writes a server-side file.
|
|
36
|
+
* The caller supplies a bare file NAME (not a path); the server writes it into
|
|
37
|
+
* a fixed audit-export directory and rejects any path-separator / traversal
|
|
38
|
+
* characters, then returns the resolved location + count.
|
|
39
|
+
*/
|
|
40
|
+
import { IrisApiError } from "@iris-mcp/shared";
|
|
41
|
+
import { z } from "zod";
|
|
42
|
+
/** Base URL for the custom ExecuteMCPv2 REST service. */
|
|
43
|
+
const BASE_URL = "/api/executemcp/v2";
|
|
44
|
+
// ── iris_audit_manage ───────────────────────────────────────────
|
|
45
|
+
export const auditManageTool = {
|
|
46
|
+
name: "iris_audit_manage",
|
|
47
|
+
title: "Manage IRIS Auditing & Audit Log",
|
|
48
|
+
description: "Configure IRIS instance auditing and manage the audit log (backed by " +
|
|
49
|
+
"Security.System / Security.Events + %SYS.Audit in %SYS). Actions: " +
|
|
50
|
+
"'status' (instance auditing on/off + per-event-type summary), 'view' " +
|
|
51
|
+
"(recent audit-log records with filters: begin/end datetime, user, event, " +
|
|
52
|
+
"source, type, maxRows), 'enable'/'disable' (turn instance auditing " +
|
|
53
|
+
"on/off), 'configureEvent' (enable/disable one audit event — requires " +
|
|
54
|
+
"source+type+name+enabled), 'purge' (delete a BOUNDED range of audit-log " +
|
|
55
|
+
"records — DESTRUCTIVE; requires confirm:true AND at least one bound), " +
|
|
56
|
+
"'export' (write matching audit-log records to a server-side file — " +
|
|
57
|
+
"requires fileName, a bare name with no path separators). The mutating " +
|
|
58
|
+
"actions (enable/disable/configureEvent/purge/export) are opt-in under " +
|
|
59
|
+
"tool governance and are disabled by default until enabled via " +
|
|
60
|
+
"IRIS_GOVERNANCE; status/view are reads and enabled by default. " +
|
|
61
|
+
"COMPLEMENTS the read-only iris_audit_events tool (a thin audit-log " +
|
|
62
|
+
"reader): 'view' here is the same log read with richer filters, plus this " +
|
|
63
|
+
"tool adds audit configuration and log lifecycle management. " +
|
|
64
|
+
"HUMAN CONFIRMATION: when the MCP client supports form elicitation, 'purge' " +
|
|
65
|
+
"also asks the person in a confirmation dialog, after every check above and " +
|
|
66
|
+
"right before any record is deleted; only an accept with Confirm ticked " +
|
|
67
|
+
"proceeds, and a decline or a dismissal returns CONFIRMATION_DECLINED with " +
|
|
68
|
+
"nothing changed (do not repeat the call unless the person asks). A client " +
|
|
69
|
+
"without elicitation is not asked, and the call works as described above.",
|
|
70
|
+
inputSchema: z.object({
|
|
71
|
+
action: z
|
|
72
|
+
.enum([
|
|
73
|
+
"status",
|
|
74
|
+
"enable",
|
|
75
|
+
"disable",
|
|
76
|
+
"configureEvent",
|
|
77
|
+
"view",
|
|
78
|
+
"purge",
|
|
79
|
+
"export",
|
|
80
|
+
])
|
|
81
|
+
.describe("Action to perform on auditing / the audit log"),
|
|
82
|
+
// configureEvent params
|
|
83
|
+
source: z
|
|
84
|
+
.string()
|
|
85
|
+
.optional()
|
|
86
|
+
.describe("Audit event source (e.g. '%System') — required for configureEvent; " +
|
|
87
|
+
"also an optional filter for view/purge/export"),
|
|
88
|
+
type: z
|
|
89
|
+
.string()
|
|
90
|
+
.optional()
|
|
91
|
+
.describe("Audit event type (e.g. '%Login') — required for configureEvent; " +
|
|
92
|
+
"also an optional filter for view/purge/export"),
|
|
93
|
+
name: z
|
|
94
|
+
.string()
|
|
95
|
+
.optional()
|
|
96
|
+
.describe("Audit event name — required for configureEvent"),
|
|
97
|
+
enabled: z
|
|
98
|
+
.boolean()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe("Whether to enable (true) or disable (false) the event — required " +
|
|
101
|
+
"for configureEvent"),
|
|
102
|
+
// view / purge / export filters
|
|
103
|
+
begin: z
|
|
104
|
+
.string()
|
|
105
|
+
.optional()
|
|
106
|
+
.describe("Begin datetime filter (YYYY-MM-DD HH:MM:SS) for view/purge/export"),
|
|
107
|
+
end: z
|
|
108
|
+
.string()
|
|
109
|
+
.optional()
|
|
110
|
+
.describe("End datetime filter (YYYY-MM-DD HH:MM:SS) for view/purge/export"),
|
|
111
|
+
user: z
|
|
112
|
+
.string()
|
|
113
|
+
.optional()
|
|
114
|
+
.describe("Username filter for view/purge/export"),
|
|
115
|
+
event: z
|
|
116
|
+
.string()
|
|
117
|
+
.optional()
|
|
118
|
+
.describe("Event name filter for view/purge/export"),
|
|
119
|
+
maxRows: z
|
|
120
|
+
.number()
|
|
121
|
+
.int()
|
|
122
|
+
.positive()
|
|
123
|
+
.optional()
|
|
124
|
+
.describe("Max audit records to return for view (default 100, max 1000)"),
|
|
125
|
+
// purge safety
|
|
126
|
+
confirm: z
|
|
127
|
+
.boolean()
|
|
128
|
+
.optional()
|
|
129
|
+
.describe("REQUIRED true for 'purge' — explicit confirmation that audit-log " +
|
|
130
|
+
"records will be permanently deleted"),
|
|
131
|
+
// export
|
|
132
|
+
fileName: z
|
|
133
|
+
.string()
|
|
134
|
+
.optional()
|
|
135
|
+
.describe("Bare output file name (no path separators) for 'export'; the server " +
|
|
136
|
+
"writes it into a fixed audit-export directory and returns the " +
|
|
137
|
+
"resolved location"),
|
|
138
|
+
namespace: z
|
|
139
|
+
.string()
|
|
140
|
+
.optional()
|
|
141
|
+
.describe("Namespace override (auditing is %SYS-scoped; usually omit)"),
|
|
142
|
+
cursor: z
|
|
143
|
+
.string()
|
|
144
|
+
.optional()
|
|
145
|
+
.describe("Pagination cursor from a previous 'view' response's nextCursor field"),
|
|
146
|
+
}),
|
|
147
|
+
annotations: {
|
|
148
|
+
// The tool can mutate AND includes the destructive `purge` action. MCP
|
|
149
|
+
// annotations are tool-scoped; the per-action read/write distinction is
|
|
150
|
+
// realized through `mutates` below.
|
|
151
|
+
readOnlyHint: false,
|
|
152
|
+
destructiveHint: true,
|
|
153
|
+
idempotentHint: false,
|
|
154
|
+
openWorldHint: false,
|
|
155
|
+
},
|
|
156
|
+
scope: "SYS",
|
|
157
|
+
// Governance classification (Story 15.0 strict contract): EVERY action key is
|
|
158
|
+
// classified because none are in the frozen Epic-14 baseline. Reads default
|
|
159
|
+
// enabled; writes default DISABLED (opt-in via IRIS_GOVERNANCE).
|
|
160
|
+
mutates: {
|
|
161
|
+
status: "read",
|
|
162
|
+
view: "read",
|
|
163
|
+
enable: "write",
|
|
164
|
+
disable: "write",
|
|
165
|
+
configureEvent: "write",
|
|
166
|
+
purge: "write",
|
|
167
|
+
export: "write",
|
|
168
|
+
},
|
|
169
|
+
handler: async (args, ctx) => {
|
|
170
|
+
const { action, source, type, name, enabled, begin, end, user, event, maxRows, confirm, fileName, cursor, } = args;
|
|
171
|
+
const path = `${BASE_URL}/security/audit`;
|
|
172
|
+
try {
|
|
173
|
+
// ── status (GET) ───────────────────────────────────────────
|
|
174
|
+
if (action === "status") {
|
|
175
|
+
const response = await ctx.http.get(path);
|
|
176
|
+
const result = response.result;
|
|
177
|
+
return {
|
|
178
|
+
content: [
|
|
179
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
180
|
+
],
|
|
181
|
+
structuredContent: result,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
// ── view (GET, filtered + paginated) ───────────────────────
|
|
185
|
+
if (action === "view") {
|
|
186
|
+
const qs = new URLSearchParams();
|
|
187
|
+
qs.set("action", "view");
|
|
188
|
+
if (begin !== undefined && begin !== "")
|
|
189
|
+
qs.set("begin", begin);
|
|
190
|
+
if (end !== undefined && end !== "")
|
|
191
|
+
qs.set("end", end);
|
|
192
|
+
if (user !== undefined && user !== "")
|
|
193
|
+
qs.set("user", user);
|
|
194
|
+
if (event !== undefined && event !== "")
|
|
195
|
+
qs.set("event", event);
|
|
196
|
+
if (source !== undefined && source !== "")
|
|
197
|
+
qs.set("source", source);
|
|
198
|
+
if (type !== undefined && type !== "")
|
|
199
|
+
qs.set("type", type);
|
|
200
|
+
if (maxRows !== undefined)
|
|
201
|
+
qs.set("maxRows", String(maxRows));
|
|
202
|
+
const response = await ctx.http.get(`${path}?${qs.toString()}`);
|
|
203
|
+
const rawResult = response.result;
|
|
204
|
+
const allEvents = Array.isArray(rawResult?.events)
|
|
205
|
+
? rawResult.events
|
|
206
|
+
: [];
|
|
207
|
+
const { page, nextCursor } = ctx.paginate(allEvents, cursor);
|
|
208
|
+
const result = {
|
|
209
|
+
events: page,
|
|
210
|
+
count: page.length,
|
|
211
|
+
...(nextCursor ? { nextCursor } : {}),
|
|
212
|
+
};
|
|
213
|
+
return {
|
|
214
|
+
content: [
|
|
215
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
216
|
+
],
|
|
217
|
+
structuredContent: result,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
// ── configureEvent guard (write) ───────────────────────────
|
|
221
|
+
if (action === "configureEvent") {
|
|
222
|
+
if (source === undefined ||
|
|
223
|
+
source === "" ||
|
|
224
|
+
type === undefined ||
|
|
225
|
+
type === "" ||
|
|
226
|
+
name === undefined ||
|
|
227
|
+
name === "" ||
|
|
228
|
+
enabled === undefined) {
|
|
229
|
+
return {
|
|
230
|
+
content: [
|
|
231
|
+
{
|
|
232
|
+
type: "text",
|
|
233
|
+
text: "Error: the 'configureEvent' action requires 'source', " +
|
|
234
|
+
"'type', 'name', and 'enabled'.",
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
isError: true,
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
// ── purge guard (destructive, write) ───────────────────────
|
|
242
|
+
if (action === "purge") {
|
|
243
|
+
if (confirm !== true) {
|
|
244
|
+
return {
|
|
245
|
+
content: [
|
|
246
|
+
{
|
|
247
|
+
type: "text",
|
|
248
|
+
text: "Error: 'purge' is destructive and requires confirm:true to " +
|
|
249
|
+
"proceed.",
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
isError: true,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
// Bounded scope: require at least one MEANINGFUL filter so an unbounded
|
|
256
|
+
// wipe is impossible from this tool. A "*" value is the match-all
|
|
257
|
+
// wildcard, NOT a bound — {confirm:true, source:"*"} (or any
|
|
258
|
+
// wildcard-only scope) must be rejected, otherwise it would purge the
|
|
259
|
+
// entire audit log. begin/end are real (date) bounds when non-empty.
|
|
260
|
+
const isBound = (v) => v !== undefined && v !== "" && v !== "*";
|
|
261
|
+
const hasBound = (begin !== undefined && begin !== "") ||
|
|
262
|
+
(end !== undefined && end !== "") ||
|
|
263
|
+
isBound(user) ||
|
|
264
|
+
isBound(event) ||
|
|
265
|
+
isBound(source) ||
|
|
266
|
+
isBound(type);
|
|
267
|
+
if (!hasBound) {
|
|
268
|
+
return {
|
|
269
|
+
content: [
|
|
270
|
+
{
|
|
271
|
+
type: "text",
|
|
272
|
+
text: "Error: 'purge' requires a bounded scope — supply at least " +
|
|
273
|
+
"one of begin, end, or a non-wildcard user, event, source, " +
|
|
274
|
+
"or type.",
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
isError: true,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
// ── export guard (write) ───────────────────────────────────
|
|
282
|
+
if (action === "export") {
|
|
283
|
+
if (fileName === undefined || fileName === "") {
|
|
284
|
+
return {
|
|
285
|
+
content: [
|
|
286
|
+
{
|
|
287
|
+
type: "text",
|
|
288
|
+
text: "Error: the 'export' action requires a 'fileName'.",
|
|
289
|
+
},
|
|
290
|
+
],
|
|
291
|
+
isError: true,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
// Defense in depth (the server is authoritative): reject obvious path
|
|
295
|
+
// traversal / separators up front so the caller gets a clear message.
|
|
296
|
+
if (/[\\/]|\.\./.test(fileName)) {
|
|
297
|
+
return {
|
|
298
|
+
content: [
|
|
299
|
+
{
|
|
300
|
+
type: "text",
|
|
301
|
+
text: "Error: 'fileName' must be a bare file name with no path " +
|
|
302
|
+
"separators or '..' traversal.",
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
isError: true,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
// ── purge: after every check above, the person is asked (AD-34) ──
|
|
310
|
+
if (action === "purge") {
|
|
311
|
+
const supplied = [
|
|
312
|
+
["begin", begin],
|
|
313
|
+
["end", end],
|
|
314
|
+
["user", user],
|
|
315
|
+
["event", event],
|
|
316
|
+
["source", source],
|
|
317
|
+
["type", type],
|
|
318
|
+
];
|
|
319
|
+
const outcome = await ctx.confirm?.({
|
|
320
|
+
operation: "permanently delete audit-log records",
|
|
321
|
+
target: "the IRIS audit log",
|
|
322
|
+
scope: "records matching " +
|
|
323
|
+
supplied
|
|
324
|
+
.filter(([, value]) => value !== undefined && value !== "")
|
|
325
|
+
.map(([filter, value]) => `${filter}=${value}`)
|
|
326
|
+
.join(", "),
|
|
327
|
+
});
|
|
328
|
+
if (outcome !== undefined && !outcome.proceed)
|
|
329
|
+
return outcome.result;
|
|
330
|
+
}
|
|
331
|
+
// ── enable / disable / configureEvent / purge / export (POST) ──
|
|
332
|
+
const body = { action };
|
|
333
|
+
if (action === "configureEvent") {
|
|
334
|
+
body.source = source;
|
|
335
|
+
body.type = type;
|
|
336
|
+
body.name = name;
|
|
337
|
+
body.enabled = enabled;
|
|
338
|
+
}
|
|
339
|
+
else if (action === "purge") {
|
|
340
|
+
body.confirm = true;
|
|
341
|
+
if (begin !== undefined && begin !== "")
|
|
342
|
+
body.begin = begin;
|
|
343
|
+
if (end !== undefined && end !== "")
|
|
344
|
+
body.end = end;
|
|
345
|
+
if (user !== undefined && user !== "")
|
|
346
|
+
body.user = user;
|
|
347
|
+
if (event !== undefined && event !== "")
|
|
348
|
+
body.event = event;
|
|
349
|
+
if (source !== undefined && source !== "")
|
|
350
|
+
body.source = source;
|
|
351
|
+
if (type !== undefined && type !== "")
|
|
352
|
+
body.type = type;
|
|
353
|
+
}
|
|
354
|
+
else if (action === "export") {
|
|
355
|
+
body.fileName = fileName;
|
|
356
|
+
if (begin !== undefined && begin !== "")
|
|
357
|
+
body.begin = begin;
|
|
358
|
+
if (end !== undefined && end !== "")
|
|
359
|
+
body.end = end;
|
|
360
|
+
if (user !== undefined && user !== "")
|
|
361
|
+
body.user = user;
|
|
362
|
+
if (event !== undefined && event !== "")
|
|
363
|
+
body.event = event;
|
|
364
|
+
if (source !== undefined && source !== "")
|
|
365
|
+
body.source = source;
|
|
366
|
+
if (type !== undefined && type !== "")
|
|
367
|
+
body.type = type;
|
|
368
|
+
}
|
|
369
|
+
const response = await ctx.http.post(path, body);
|
|
370
|
+
const result = response.result;
|
|
371
|
+
return {
|
|
372
|
+
content: [
|
|
373
|
+
{ type: "text", text: JSON.stringify(result, null, 2) },
|
|
374
|
+
],
|
|
375
|
+
structuredContent: result,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
catch (error) {
|
|
379
|
+
if (error instanceof IrisApiError) {
|
|
380
|
+
return {
|
|
381
|
+
content: [
|
|
382
|
+
{
|
|
383
|
+
type: "text",
|
|
384
|
+
text: `Error performing '${action}' on auditing: ${error.message}`,
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
isError: true,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
throw error;
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
};
|
|
394
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database management tools for the IRIS Administration MCP server.
|
|
3
|
+
*
|
|
4
|
+
* Provides two tools for managing IRIS databases via the custom REST endpoint:
|
|
5
|
+
* - {@link databaseManageTool} — Create, modify, or delete a database
|
|
6
|
+
* - {@link databaseListTool} — List all databases with size, free space, and mount status
|
|
7
|
+
*
|
|
8
|
+
* All tools call the custom REST service at `/api/executemcp/v2/config/database`.
|
|
9
|
+
* Operations execute in %SYS namespace on the IRIS server.
|
|
10
|
+
*/
|
|
11
|
+
import { type ToolDefinition } from "@iris-mcp/shared";
|
|
12
|
+
export declare const databaseManageTool: ToolDefinition;
|
|
13
|
+
export declare const databaseListTool: ToolDefinition;
|
|
14
|
+
//# sourceMappingURL=database.d.ts.map
|