@sfdxy/anypoint-connect 0.1.0 → 0.2.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/dist/api/AccessManagementApi.js.map +1 -1
- package/dist/api/DesignCenterApi.d.ts.map +1 -1
- package/dist/api/DesignCenterApi.js +4 -4
- package/dist/api/DesignCenterApi.js.map +1 -1
- package/dist/api/LogsApi.d.ts +1 -3
- package/dist/api/LogsApi.d.ts.map +1 -1
- package/dist/api/LogsApi.js +17 -23
- package/dist/api/LogsApi.js.map +1 -1
- package/dist/api/MonitoringApi.d.ts +1 -0
- package/dist/api/MonitoringApi.d.ts.map +1 -1
- package/dist/api/MonitoringApi.js +7 -5
- package/dist/api/MonitoringApi.js.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/client/AnypointClient.js +1 -1
- package/dist/client/AnypointClient.js.map +1 -1
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/api.js +5 -14
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/apps.d.ts.map +1 -1
- package/dist/commands/apps.js +6 -15
- package/dist/commands/apps.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +8 -26
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +2 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/deploy.d.ts +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +28 -15
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/design-center.d.ts.map +1 -1
- package/dist/commands/design-center.js +7 -16
- package/dist/commands/design-center.js.map +1 -1
- package/dist/commands/exchange.d.ts.map +1 -1
- package/dist/commands/exchange.js +5 -14
- package/dist/commands/exchange.js.map +1 -1
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +5 -35
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/monitor.d.ts.map +1 -1
- package/dist/commands/monitor.js +5 -33
- package/dist/commands/monitor.js.map +1 -1
- package/dist/commands/shared.d.ts +11 -0
- package/dist/commands/shared.d.ts.map +1 -0
- package/dist/commands/shared.js +20 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/mcp/prompts.d.ts +7 -0
- package/dist/mcp/prompts.d.ts.map +1 -0
- package/dist/mcp/prompts.js +169 -0
- package/dist/mcp/prompts.js.map +1 -0
- package/dist/mcp/resources.d.ts +8 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +28 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/tools/api-manager.d.ts +8 -0
- package/dist/mcp/tools/api-manager.d.ts.map +1 -0
- package/dist/mcp/tools/api-manager.js +113 -0
- package/dist/mcp/tools/api-manager.js.map +1 -0
- package/dist/mcp/tools/applications.d.ts +8 -0
- package/dist/mcp/tools/applications.d.ts.map +1 -0
- package/dist/mcp/tools/applications.js +167 -0
- package/dist/mcp/tools/applications.js.map +1 -0
- package/dist/mcp/tools/design-center.d.ts +9 -0
- package/dist/mcp/tools/design-center.d.ts.map +1 -0
- package/dist/mcp/tools/design-center.js +178 -0
- package/dist/mcp/tools/design-center.js.map +1 -0
- package/dist/mcp/tools/exchange.d.ts +8 -0
- package/dist/mcp/tools/exchange.d.ts.map +1 -0
- package/dist/mcp/tools/exchange.js +146 -0
- package/dist/mcp/tools/exchange.js.map +1 -0
- package/dist/mcp/tools/identity.d.ts +8 -0
- package/dist/mcp/tools/identity.d.ts.map +1 -0
- package/dist/mcp/tools/identity.js +71 -0
- package/dist/mcp/tools/identity.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +11 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +11 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/logs.d.ts +8 -0
- package/dist/mcp/tools/logs.d.ts.map +1 -0
- package/dist/mcp/tools/logs.js +95 -0
- package/dist/mcp/tools/logs.js.map +1 -0
- package/dist/mcp/tools/monitoring.d.ts +8 -0
- package/dist/mcp/tools/monitoring.d.ts.map +1 -0
- package/dist/mcp/tools/monitoring.js +51 -0
- package/dist/mcp/tools/monitoring.js.map +1 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +19 -960
- package/dist/mcp.js.map +1 -1
- package/dist/utils/dates.d.ts +16 -0
- package/dist/utils/dates.d.ts.map +1 -0
- package/dist/utils/dates.js +36 -0
- package/dist/utils/dates.js.map +1 -0
- package/dist/utils/errors.d.ts +10 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +12 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +9 -0
- package/dist/version.js.map +1 -0
- package/package.json +1 -1
package/dist/commands/monitor.js
CHANGED
|
@@ -6,39 +6,11 @@
|
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import * as fs from 'fs';
|
|
8
8
|
import chalk from 'chalk';
|
|
9
|
-
import { getConfig } from '../utils/config.js';
|
|
10
9
|
import { log } from '../utils/logger.js';
|
|
10
|
+
import { errorMessage } from '../utils/errors.js';
|
|
11
|
+
import { parseDate } from '../utils/dates.js';
|
|
11
12
|
import { printTable, formatMs } from '../utils/formatter.js';
|
|
12
|
-
import {
|
|
13
|
-
function createClient() {
|
|
14
|
-
const config = getConfig();
|
|
15
|
-
return new AnypointClient({
|
|
16
|
-
clientId: config.clientId,
|
|
17
|
-
clientSecret: config.clientSecret,
|
|
18
|
-
redirectUri: config.callbackUrl,
|
|
19
|
-
baseUrl: config.baseUrl,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
function parseDate(dateStr) {
|
|
23
|
-
const relativeMatch = dateStr.match(/^(\d+)(m|h|d)$/);
|
|
24
|
-
if (relativeMatch) {
|
|
25
|
-
const amount = parseInt(relativeMatch[1]);
|
|
26
|
-
const unit = relativeMatch[2];
|
|
27
|
-
const now = Date.now();
|
|
28
|
-
switch (unit) {
|
|
29
|
-
case 'm':
|
|
30
|
-
return now - amount * 60 * 1000;
|
|
31
|
-
case 'h':
|
|
32
|
-
return now - amount * 60 * 60 * 1000;
|
|
33
|
-
case 'd':
|
|
34
|
-
return now - amount * 24 * 60 * 60 * 1000;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const ts = Date.parse(dateStr);
|
|
38
|
-
if (isNaN(ts))
|
|
39
|
-
throw new Error(`Invalid date: "${dateStr}"`);
|
|
40
|
-
return ts;
|
|
41
|
-
}
|
|
13
|
+
import { createClient } from './shared.js';
|
|
42
14
|
function metricsToCSV(metrics) {
|
|
43
15
|
const header = 'App Name,Requests,Avg Response Time (ms),Errors,Error Rate (%),Outbound Requests,Outbound Avg Response Time (ms)';
|
|
44
16
|
const rows = metrics.map((m) => `${m.appName},${m.requestCount},${m.avgResponseTime.toFixed(1)},${m.errorCount},${m.errorRate.toFixed(2)},${m.outboundCount},${m.outboundAvgResponseTime.toFixed(1)}`);
|
|
@@ -83,7 +55,7 @@ export function createMonitorCommand() {
|
|
|
83
55
|
log.kv('Apps', metrics.length);
|
|
84
56
|
}
|
|
85
57
|
catch (error) {
|
|
86
|
-
log.error(`Metrics failed: ${error
|
|
58
|
+
log.error(`Metrics failed: ${errorMessage(error)}`);
|
|
87
59
|
process.exit(1);
|
|
88
60
|
}
|
|
89
61
|
});
|
|
@@ -120,7 +92,7 @@ export function createMonitorCommand() {
|
|
|
120
92
|
log.success(`Exported ${exported.apps.length} apps metrics → ${chalk.bold(output)}`);
|
|
121
93
|
}
|
|
122
94
|
catch (error) {
|
|
123
|
-
log.error(`Export failed: ${error
|
|
95
|
+
log.error(`Export failed: ${errorMessage(error)}`);
|
|
124
96
|
process.exit(1);
|
|
125
97
|
}
|
|
126
98
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/commands/monitor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/commands/monitor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,SAAS,YAAY,CAAC,OAA4B;IAC9C,MAAM,MAAM,GACR,kHAAkH,CAAC;IACvH,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CACpB,CAAC,CAAC,EAAE,EAAE,CACF,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAC5K,CAAC;IACF,OA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C;AACnB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared command utilities
|
|
3
|
+
* Common helpers used across all CLI command modules
|
|
4
|
+
*/
|
|
5
|
+
import { AnypointClient } from '../client/AnypointClient.js';
|
|
6
|
+
/**
|
|
7
|
+
* Creates an authenticated AnypointClient from the saved configuration.
|
|
8
|
+
* Used by all CLI commands that need to interact with the Anypoint Platform.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createClient(): AnypointClient;
|
|
11
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,YAAY,IAAI,cAAc,CAQ7C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared command utilities
|
|
3
|
+
* Common helpers used across all CLI command modules
|
|
4
|
+
*/
|
|
5
|
+
import { getConfig } from '../utils/config.js';
|
|
6
|
+
import { AnypointClient } from '../client/AnypointClient.js';
|
|
7
|
+
/**
|
|
8
|
+
* Creates an authenticated AnypointClient from the saved configuration.
|
|
9
|
+
* Used by all CLI commands that need to interact with the Anypoint Platform.
|
|
10
|
+
*/
|
|
11
|
+
export function createClient() {
|
|
12
|
+
const config = getConfig();
|
|
13
|
+
return new AnypointClient({
|
|
14
|
+
clientId: config.clientId,
|
|
15
|
+
clientSecret: config.clientSecret,
|
|
16
|
+
redirectUri: config.callbackUrl,
|
|
17
|
+
baseUrl: config.baseUrl,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/commands/shared.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,YAAY;IACxB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,OAAO,IAAI,cAAc,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,MAAM,CAAC,OAAO;KAC1B,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Prompt Registrar
|
|
3
|
+
* Registers guided workflow prompts for common Anypoint operations
|
|
4
|
+
*/
|
|
5
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
export declare function registerPrompts(server: McpServer): void;
|
|
7
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/mcp/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QAsMhD"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Prompt Registrar
|
|
3
|
+
* Registers guided workflow prompts for common Anypoint operations
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export function registerPrompts(server) {
|
|
7
|
+
// ── Pre-Deployment Readiness Check ──────────────────
|
|
8
|
+
server.registerPrompt('pre-deploy-check', {
|
|
9
|
+
title: 'Pre-Deployment Readiness Check',
|
|
10
|
+
description: 'Runs a comprehensive readiness check before deploying or promoting a Mule application. Validates the current state of the target environment, checks for version drift, reviews recent error rates, and compares source and target configurations.',
|
|
11
|
+
argsSchema: {
|
|
12
|
+
appName: z.string().describe('Application name to deploy'),
|
|
13
|
+
sourceEnv: z.string().describe('Source environment (e.g. "Development")'),
|
|
14
|
+
targetEnv: z.string().describe('Target environment for deployment (e.g. "Production")'),
|
|
15
|
+
},
|
|
16
|
+
}, async ({ appName, sourceEnv, targetEnv }) => ({
|
|
17
|
+
messages: [
|
|
18
|
+
{
|
|
19
|
+
role: 'user',
|
|
20
|
+
content: {
|
|
21
|
+
type: 'text',
|
|
22
|
+
text: `I'm about to promote "${appName}" from ${sourceEnv} to ${targetEnv}. Run a pre-deployment readiness check:
|
|
23
|
+
|
|
24
|
+
1. **Source status**: Use get_app_status to check "${appName}" in ${sourceEnv} — confirm it's APPLIED/RUNNING and healthy.
|
|
25
|
+
2. **Target status**: Use get_app_status to check if "${appName}" exists in ${targetEnv} — note the current version and replica count.
|
|
26
|
+
3. **Version comparison**: Use compare_environments to compare ${sourceEnv} vs ${targetEnv} and highlight the version difference for this app.
|
|
27
|
+
4. **Error check**: Use get_logs to fetch the last 50 ERROR-level logs from ${sourceEnv} — flag any recent errors that might indicate instability.
|
|
28
|
+
5. **Metrics baseline**: Use get_metrics for "${appName}" in ${sourceEnv} with the last 24 hours — report error rate and average response time.
|
|
29
|
+
|
|
30
|
+
Produce a GO / NO-GO recommendation with rationale. If there are concerns, list them as action items before proceeding.`,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}));
|
|
35
|
+
// ── Troubleshoot Application ────────────────────────
|
|
36
|
+
server.registerPrompt('troubleshoot-app', {
|
|
37
|
+
title: 'Troubleshoot Application',
|
|
38
|
+
description: 'Systematically diagnoses issues with a Mule application by checking deployment health, analyzing error logs, reviewing metrics for anomalies, and suggesting MuleSoft-specific root causes and remediations.',
|
|
39
|
+
argsSchema: {
|
|
40
|
+
appName: z.string().describe('Application name that is having issues'),
|
|
41
|
+
environment: z.string().describe('Environment where the issue is occurring'),
|
|
42
|
+
symptom: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('Description of the issue (e.g. "high latency", "502 errors", "not processing messages")'),
|
|
46
|
+
},
|
|
47
|
+
}, async ({ appName, environment, symptom }) => ({
|
|
48
|
+
messages: [
|
|
49
|
+
{
|
|
50
|
+
role: 'user',
|
|
51
|
+
content: {
|
|
52
|
+
type: 'text',
|
|
53
|
+
text: `The application "${appName}" in ${environment} is experiencing issues${symptom ? `: "${symptom}"` : ''}. Please diagnose:
|
|
54
|
+
|
|
55
|
+
1. **Deployment health**: Use get_app_status to check replica states — look for FAILED or PARTIAL_STARTED replicas, recent restarts, or version mismatches.
|
|
56
|
+
2. **Error analysis**: Use get_logs with level=ERROR and 200 lines to identify error patterns. Group errors by type (e.g. MULE:CONNECTIVITY, MULE:EXPRESSION, HTTP:TIMEOUT, java.lang.OutOfMemoryError).
|
|
57
|
+
3. **Performance check**: Use get_metrics for the last 4 hours — look for spikes in error count, elevated response times, or sudden drops in request volume.
|
|
58
|
+
4. **Root cause analysis**: Based on the evidence, identify the most likely root cause from common MuleSoft issues:
|
|
59
|
+
- DataWeave transformation errors (MULE:EXPRESSION)
|
|
60
|
+
- Downstream service timeouts (HTTP:TIMEOUT, HTTP:CONNECTIVITY)
|
|
61
|
+
- Memory pressure / ObjectStore issues
|
|
62
|
+
- Configuration property errors (missing secure properties, wrong endpoint URLs)
|
|
63
|
+
- Database connection pool exhaustion
|
|
64
|
+
- API autodiscovery or policy enforcement failures
|
|
65
|
+
5. **Remediation**: Suggest specific fixes. If a restart would help, use restart_app. If scaling is needed, recommend scale_app with a replica count.`,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
}));
|
|
70
|
+
// ── API Governance Audit ────────────────────────────
|
|
71
|
+
server.registerPrompt('api-governance-audit', {
|
|
72
|
+
title: 'API Governance Audit',
|
|
73
|
+
description: 'Reviews the API governance posture for an environment: checks which APIs have policies applied, validates that security policies (client-id-enforcement, OAuth, JWT) are present, reviews SLA tier configurations, and identifies gaps.',
|
|
74
|
+
argsSchema: {
|
|
75
|
+
environment: z.string().describe('Environment to audit (e.g. "Production")'),
|
|
76
|
+
},
|
|
77
|
+
}, async ({ environment }) => ({
|
|
78
|
+
messages: [
|
|
79
|
+
{
|
|
80
|
+
role: 'user',
|
|
81
|
+
content: {
|
|
82
|
+
type: 'text',
|
|
83
|
+
text: `Run an API governance audit on the ${environment} environment:
|
|
84
|
+
|
|
85
|
+
1. **Inventory**: Use list_api_instances to get all managed APIs. Note any with status "inactive" or that are deprecated.
|
|
86
|
+
2. **Policy review**: For each active API, use get_api_policies to check its policy chain. Flag APIs that are MISSING:
|
|
87
|
+
- Authentication policy (client-id-enforcement, oauth2, jwt-validation)
|
|
88
|
+
- Rate limiting or spike control
|
|
89
|
+
3. **SLA compliance**: Check which APIs have SLA tiers configured. Note any with auto-approve enabled in a production environment (potential security concern).
|
|
90
|
+
4. **Contract count**: Identify APIs with zero active contracts (may indicate unused/orphaned APIs).
|
|
91
|
+
5. **Governance scorecard**: Produce a summary table with columns: API Name | Auth Policy | Rate Limit | SLA Tiers | Contracts | Status
|
|
92
|
+
Mark each cell with ✅ (compliant) or ❌ (gap found).
|
|
93
|
+
|
|
94
|
+
End with prioritized recommendations for improving governance posture.`,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
}));
|
|
99
|
+
// ── Environment Health Overview ─────────────────────
|
|
100
|
+
server.registerPrompt('environment-overview', {
|
|
101
|
+
title: 'Environment Health Overview',
|
|
102
|
+
description: 'Generates a comprehensive health report for an Anypoint environment covering all deployed apps, error rates, performance metrics, and deployment status — ideal for daily standups, handoffs, or executive summaries.',
|
|
103
|
+
argsSchema: {
|
|
104
|
+
environment: z.string().describe('Environment to report on (e.g. "Production")'),
|
|
105
|
+
},
|
|
106
|
+
}, async ({ environment }) => ({
|
|
107
|
+
messages: [
|
|
108
|
+
{
|
|
109
|
+
role: 'user',
|
|
110
|
+
content: {
|
|
111
|
+
type: 'text',
|
|
112
|
+
text: `Generate a health overview report for the ${environment} environment:
|
|
113
|
+
|
|
114
|
+
1. **App inventory**: Use list_apps to get all deployed applications. Count total apps, how many are APPLIED/RUNNING vs FAILED/DEPLOYING.
|
|
115
|
+
2. **Error landscape**: Use get_metrics for all apps over the last 24 hours. Rank apps by error count (highest first). Flag any app with error rate above 1%.
|
|
116
|
+
3. **Performance**: From the same metrics, identify the 3 slowest apps by average response time. Note any above 1000ms.
|
|
117
|
+
4. **Top errors**: For the app with the most errors, use get_logs with level=ERROR and 50 lines to identify the dominant error pattern.
|
|
118
|
+
5. **Version audit**: Note any apps running on different Mule runtime versions — inconsistent runtimes can indicate missed upgrades.
|
|
119
|
+
|
|
120
|
+
Format the report with clear sections and emojis for quick scanning:
|
|
121
|
+
- 🟢 Healthy (no errors, good response times)
|
|
122
|
+
- 🟡 Warning (elevated errors or latency)
|
|
123
|
+
- 🔴 Critical (failures, high error rate)`,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
}));
|
|
128
|
+
// ── Improve API Spec ────────────────────────────────
|
|
129
|
+
server.registerPrompt('improve-api-spec', {
|
|
130
|
+
title: 'Improve API Specification',
|
|
131
|
+
description: 'Reads an API specification from Design Center, analyzes its quality (descriptions, types, examples), suggests improvements, and pushes the updated spec back. Automates the full pull → analyze → improve → push workflow.',
|
|
132
|
+
argsSchema: {
|
|
133
|
+
project: z.string().describe('Design Center project name (e.g. "order-api")'),
|
|
134
|
+
},
|
|
135
|
+
}, async ({ project }) => ({
|
|
136
|
+
messages: [
|
|
137
|
+
{
|
|
138
|
+
role: 'user',
|
|
139
|
+
content: {
|
|
140
|
+
type: 'text',
|
|
141
|
+
text: `Improve the API specification for the Design Center project "${project}". Follow this workflow:
|
|
142
|
+
|
|
143
|
+
1. **Discover**: Use get_design_center_files to list all files in the "${project}" project. Identify the main spec file (usually the .raml or .yaml file matching the project name).
|
|
144
|
+
|
|
145
|
+
2. **Read**: Use read_design_center_file to read the main spec file. Also read any referenced data type files, examples, or fragments.
|
|
146
|
+
|
|
147
|
+
3. **Analyze**: Evaluate the spec quality against these criteria:
|
|
148
|
+
- **Descriptions**: Are all endpoints, parameters, and types described? Are descriptions detailed enough (purpose, return data, use cases)?
|
|
149
|
+
- **Types**: Are response/request types defined, or are they using "any"?
|
|
150
|
+
- **Examples**: Are there inline examples or !include references?
|
|
151
|
+
- **Parameters**: Do query parameters have descriptions, types, and display names?
|
|
152
|
+
- **Security**: Are endpoints secured appropriately?
|
|
153
|
+
- **Consistency**: Are naming conventions consistent across endpoints?
|
|
154
|
+
|
|
155
|
+
4. **Improve**: Rewrite the spec with:
|
|
156
|
+
- Multi-line descriptions using YAML block scalar (|) that explain purpose, return data, and common use cases
|
|
157
|
+
- Specific parameter descriptions mentioning format (e.g., "18-character Salesforce record ID")
|
|
158
|
+
- Consistent naming and formatting
|
|
159
|
+
- Keep all !include references, examples, and types unchanged
|
|
160
|
+
|
|
161
|
+
5. **Push**: Use update_design_center_file to save the improved spec back to Design Center. Use a commit message like "Improved API descriptions and documentation".
|
|
162
|
+
|
|
163
|
+
6. **Report**: Summarize what was changed — how many descriptions were improved, what patterns were fixed, and any remaining gaps.`,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/mcp/prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC7C,uDAAuD;IAEvD,MAAM,CAAC,cAAc,CACjB,kBAAkB,EAClB;QACI,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACP,oPAAoP;QAC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YACR,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;SAChF;KACJ,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QACpB,QAAQ,EAAE;YACN;gBACI,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACL,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,gEAAgE,OAAO;;yEAE5B,OAAO;;;;;;;;;;;;;;;;;;;;mIAoBmD;iBAC9G;aACJ;SACJ;KACJ,CAAC,CACL,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource Registrar
|
|
3
|
+
* Registers read-only data resources exposed via anypoint:// URIs
|
|
4
|
+
*/
|
|
5
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
import type { AnypointClient } from '../client/AnypointClient.js';
|
|
7
|
+
export declare function registerResources(server: McpServer, client: AnypointClient): void;
|
|
8
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/mcp/resources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,QA0B1E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource Registrar
|
|
3
|
+
* Registers read-only data resources exposed via anypoint:// URIs
|
|
4
|
+
*/
|
|
5
|
+
export function registerResources(server, client) {
|
|
6
|
+
server.registerResource('environments', 'anypoint://environments', {
|
|
7
|
+
description: 'List of all Anypoint environments with their IDs, names, types, and production flags',
|
|
8
|
+
mimeType: 'application/json',
|
|
9
|
+
}, async (uri) => {
|
|
10
|
+
try {
|
|
11
|
+
const orgId = await client.getDefaultOrgId();
|
|
12
|
+
const envs = await client.accessManagement.getEnvironments(orgId);
|
|
13
|
+
return {
|
|
14
|
+
contents: [
|
|
15
|
+
{
|
|
16
|
+
uri: uri.href,
|
|
17
|
+
text: JSON.stringify(envs, null, 2),
|
|
18
|
+
mimeType: 'application/json',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return { contents: [{ uri: uri.href, text: '[]', mimeType: 'application/json' }] };
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/mcp/resources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,MAAsB;IACvE,MAAM,CAAC,gBAAgB,CACnB,cAAc,EACd,yBAAyB,EACzB;QACI,WAAW,EAAE,sFAAsF;QACnG,QAAQ,EAAE,kBAAkB;KAC/B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE;QACV,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;YAC7C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAClE,OAAO;gBACH,QAAQ,EAAE;oBACN;wBACI,GAAG,EAAE,GAAG,CAAC,IAAI;wBACb,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;wBACnC,QAAQ,EAAE,kBAAkB;qBAC/B;iBACJ;aACJ,CAAC;QACN,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;QACvF,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Registrar — API Manager tools
|
|
3
|
+
* list_api_instances, get_api_policies
|
|
4
|
+
*/
|
|
5
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
import type { AnypointClient } from '../../client/AnypointClient.js';
|
|
7
|
+
export declare function registerApiManagerTools(server: McpServer, client: AnypointClient): void;
|
|
8
|
+
//# sourceMappingURL=api-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-manager.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/api-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,QA4HhF"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Registrar — API Manager tools
|
|
3
|
+
* list_api_instances, get_api_policies
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { errorMessage } from '../../utils/errors.js';
|
|
7
|
+
export function registerApiManagerTools(server, client) {
|
|
8
|
+
server.registerTool('list_api_instances', {
|
|
9
|
+
title: 'List API Instances',
|
|
10
|
+
description: "Lists all managed API instances registered in API Manager for an environment. Returns each API's name, instance ID, status (active/inactive), asset version, technology (Mule 3 or 4), endpoint URI, deprecation flag, and active contract count. Use this to review API governance posture or find the API instance ID needed for get_api_policies.",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
environment: z.string().describe('Environment name or ID'),
|
|
13
|
+
},
|
|
14
|
+
annotations: { readOnlyHint: true },
|
|
15
|
+
}, async ({ environment }) => {
|
|
16
|
+
try {
|
|
17
|
+
const orgId = await client.getDefaultOrgId();
|
|
18
|
+
const env = await client.accessManagement.resolveEnvironment(orgId, environment);
|
|
19
|
+
const assets = await client.apiManager.getApis(orgId, env.id);
|
|
20
|
+
const instances = assets.flatMap((asset) => asset.apis.map((api) => ({
|
|
21
|
+
apiName: asset.exchangeAssetName,
|
|
22
|
+
apiId: api.id,
|
|
23
|
+
status: api.status,
|
|
24
|
+
version: api.assetVersion,
|
|
25
|
+
technology: api.technology,
|
|
26
|
+
endpoint: api.endpointUri,
|
|
27
|
+
deprecated: api.deprecated,
|
|
28
|
+
contracts: api.activeContractsCount,
|
|
29
|
+
})));
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: JSON.stringify({ environment: env.name, instances }, null, 2),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: 'text', text: `Error: ${errorMessage(error)}` }],
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
server.registerTool('get_api_policies', {
|
|
47
|
+
title: 'Get API Policies & SLA Tiers',
|
|
48
|
+
description: 'Returns the full policy chain and SLA tier configuration for a managed API instance. For each policy, shows the template name (e.g. "client-id-enforcement", "rate-limiting"), version, execution order, whether it is disabled, and its configuration. For each SLA tier, shows the name, rate limits, auto-approve setting, and how many client apps have contracted it. Use this to audit API security and rate-limiting configuration.',
|
|
49
|
+
inputSchema: {
|
|
50
|
+
apiName: z
|
|
51
|
+
.string()
|
|
52
|
+
.describe('API name (partial match) or numeric API instance ID from list_api_instances'),
|
|
53
|
+
environment: z.string().describe('Environment name or ID'),
|
|
54
|
+
},
|
|
55
|
+
annotations: { readOnlyHint: true },
|
|
56
|
+
}, async ({ apiName, environment }) => {
|
|
57
|
+
try {
|
|
58
|
+
const orgId = await client.getDefaultOrgId();
|
|
59
|
+
const env = await client.accessManagement.resolveEnvironment(orgId, environment);
|
|
60
|
+
let apiId;
|
|
61
|
+
const numId = parseInt(apiName);
|
|
62
|
+
if (!isNaN(numId)) {
|
|
63
|
+
apiId = numId;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const found = await client.apiManager.findByName(orgId, env.id, apiName);
|
|
67
|
+
if (!found) {
|
|
68
|
+
return {
|
|
69
|
+
content: [{ type: 'text', text: `API "${apiName}" not found in ${env.name}` }],
|
|
70
|
+
isError: true,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
apiId = found.instance.id;
|
|
74
|
+
}
|
|
75
|
+
const [policies, tiers] = await Promise.all([
|
|
76
|
+
client.apiManager.getPolicies(orgId, env.id, apiId),
|
|
77
|
+
client.apiManager.getSlaTiers(orgId, env.id, apiId),
|
|
78
|
+
]);
|
|
79
|
+
return {
|
|
80
|
+
content: [
|
|
81
|
+
{
|
|
82
|
+
type: 'text',
|
|
83
|
+
text: JSON.stringify({
|
|
84
|
+
apiId,
|
|
85
|
+
policies: policies.map((p) => ({
|
|
86
|
+
id: p.id,
|
|
87
|
+
template: p.template?.assetId || p.policyTemplateId,
|
|
88
|
+
version: p.template?.assetVersion,
|
|
89
|
+
order: p.order,
|
|
90
|
+
disabled: p.disabled,
|
|
91
|
+
config: p.configurationData,
|
|
92
|
+
})),
|
|
93
|
+
slaTiers: tiers.map((t) => ({
|
|
94
|
+
name: t.name,
|
|
95
|
+
status: t.status,
|
|
96
|
+
autoApprove: t.autoApprove,
|
|
97
|
+
limits: t.limits,
|
|
98
|
+
appCount: t.applicationCount,
|
|
99
|
+
})),
|
|
100
|
+
}, null, 2),
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
return {
|
|
107
|
+
content: [{ type: 'text', text: `Error: ${errorMessage(error)}` }],
|
|
108
|
+
isError: true,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=api-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-manager.js","sourceRoot":"","sources":["../../../src/mcp/tools/api-manager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,MAAM,UAAU,uBAAuB,CAAC,MAAiB,EAAE,MAAsB;IAC7E,MAAM,CAAC,YAAY,CACf,oBAAoB,EACpB;QACI,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACP,sVAAsV;QAC1V,WAAW,EAAE;YACT,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;SAC7D;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;KACtC,EACD,KAAK,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;QACtB,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC;YAC7C,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YACjF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;YAE9D,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACvC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAA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,EAAE;gCACR,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,OAAO,IAAI,CAAC,CAAC,gBAAgB;gCACnD,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,YAAY;gCACjC,KAAK,EAAE,CAAC,CAAC,KAAK;gCACd,QAAQ,EAAE,CAAC,CAAC,QAAQ;gCACpB,MAAM,EAAE,CAAC,CAAC,iBAAiB;6BAC9B,CAAC,CAAC;4BACH,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gCACxB,IAAI,EAAE,CAAC,CAAC,IAAI;gCACZ,MAAM,EAAE,CAAC,CAAC,MAAM;gCAChB,WAAW,EAAE,CAAC,CAAC,WAAW;gCAC1B,MAAM,EAAE,CAAC,CAAC,MAAM;gCAChB,QAAQ,EAAE,CAAC,CAAC,gBAAgB;6BAC/B,CAAC,CAAC;yBACN,EACD,IAAI,EACJ,CAAC,CACJ;qBACJ;iBACJ;aACJ,CAAC;QACN,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO;gBACH,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,YAAY,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;gBAClE,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;IACL,CAAC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Registrar — Application tools
|
|
3
|
+
* list_apps, get_app_status, restart_app, scale_app
|
|
4
|
+
*/
|
|
5
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
+
import type { AnypointClient } from '../../client/AnypointClient.js';
|
|
7
|
+
export declare function registerApplicationTools(server: McpServer, client: AnypointClient): void;
|
|
8
|
+
//# sourceMappingURL=applications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applications.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/applications.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,QAiMjF"}
|