feat: new MCP tools #14
@@ -1201,6 +1201,88 @@ server.tool(
|
||||
},
|
||||
);
|
||||
|
||||
// ── Health & Monitoring ─────────────────────────────────────────────────
|
||||
|
||||
server.tool(
|
||||
'joomla_health_check',
|
||||
'Call the MokoWaaS health endpoint (/?mokowaas=health) on a connected site',
|
||||
{
|
||||
token: z.string().describe('Health API bearer token'),
|
||||
...ConnectionParam,
|
||||
},
|
||||
async ({ token, connection }) => {
|
||||
const conn = getConnection(config, connection);
|
||||
const url = conn.baseUrl.replace(/\/+$/, '') + '/?mokowaas=health';
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
headers: { 'Authorization': `Bearer ${token}` },
|
||||
signal: AbortSignal.timeout(15000),
|
||||
});
|
||||
const data = await res.json();
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: `Health check failed: ${e}` }],
|
||||
};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
server.tool(
|
||||
'joomla_heartbeat_status',
|
||||
'Check if a site is registered with the MokoWaaS heartbeat receiver',
|
||||
{
|
||||
site_url: z.string().describe('Site URL to check'),
|
||||
...ConnectionParam,
|
||||
},
|
||||
async ({ site_url }) => {
|
||||
const receiverUrl = 'https://bench.mokoconsulting.tech/api/waas-heartbeat/heartbeat';
|
||||
try {
|
||||
const res = await fetch(receiverUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-MokoWaaS-Key': 'moko-waas-hb-2026-x9k4m',
|
||||
},
|
||||
body: JSON.stringify({ site_url }),
|
||||
signal: AbortSignal.timeout(10000),
|
||||
});
|
||||
const data = await res.json();
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
|
||||
};
|
||||
} catch (e) {
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: `Heartbeat check failed: ${e}` }],
|
||||
};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
server.tool(
|
||||
'joomla_extensions_list',
|
||||
'List installed extensions with version and status',
|
||||
{
|
||||
search: z.string().optional().describe('Filter by name'),
|
||||
...ConnectionParam,
|
||||
},
|
||||
async ({ search, connection }) => {
|
||||
const params: Record<string, string> = {};
|
||||
if (search) params['filter[search]'] = search;
|
||||
return formatResponse(await clientFor(connection).get('/extensions', params));
|
||||
},
|
||||
);
|
||||
|
||||
server.tool(
|
||||
'joomla_system_info',
|
||||
'Get Joomla system configuration (application config)',
|
||||
{ ...ConnectionParam },
|
||||
async ({ connection }) =>
|
||||
formatResponse(await clientFor(connection).get('/config/application')),
|
||||
);
|
||||
|
||||
// ── Connections Management ──────────────────────────────────────────────
|
||||
|
||||
server.tool(
|
||||
|
||||
Reference in New Issue
Block a user