@nightsquawktech/tacticalrmm-mcp-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMMERCIAL.md +35 -0
- package/LICENSE +661 -0
- package/README.md +79 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +10 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/agents.d.ts +39 -0
- package/dist/schemas/agents.d.ts.map +1 -0
- package/dist/schemas/agents.js +37 -0
- package/dist/schemas/agents.js.map +1 -0
- package/dist/schemas/clients.d.ts +16 -0
- package/dist/schemas/clients.d.ts.map +1 -0
- package/dist/schemas/clients.js +10 -0
- package/dist/schemas/clients.js.map +1 -0
- package/dist/schemas/common.d.ts +5 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +19 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/schemas/resources.d.ts +76 -0
- package/dist/schemas/resources.d.ts.map +1 -0
- package/dist/schemas/resources.js +37 -0
- package/dist/schemas/resources.js.map +1 -0
- package/dist/schemas/server.d.ts +10 -0
- package/dist/schemas/server.d.ts.map +1 -0
- package/dist/schemas/server.js +8 -0
- package/dist/schemas/server.js.map +1 -0
- package/dist/services/config.d.ts +3 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +22 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/errors.d.ts +2 -0
- package/dist/services/errors.d.ts.map +1 -0
- package/dist/services/errors.js +41 -0
- package/dist/services/errors.js.map +1 -0
- package/dist/services/tacticalrmm-client.d.ts +10 -0
- package/dist/services/tacticalrmm-client.d.ts.map +1 -0
- package/dist/services/tacticalrmm-client.js +37 -0
- package/dist/services/tacticalrmm-client.js.map +1 -0
- package/dist/tools/agents.d.ts +4 -0
- package/dist/tools/agents.d.ts.map +1 -0
- package/dist/tools/agents.js +97 -0
- package/dist/tools/agents.js.map +1 -0
- package/dist/tools/automation.d.ts +4 -0
- package/dist/tools/automation.d.ts.map +1 -0
- package/dist/tools/automation.js +41 -0
- package/dist/tools/automation.js.map +1 -0
- package/dist/tools/clients.d.ts +4 -0
- package/dist/tools/clients.d.ts.map +1 -0
- package/dist/tools/clients.js +34 -0
- package/dist/tools/clients.js.map +1 -0
- package/dist/tools/format.d.ts +6 -0
- package/dist/tools/format.d.ts.map +1 -0
- package/dist/tools/format.js +37 -0
- package/dist/tools/format.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +17 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/inventory.d.ts +4 -0
- package/dist/tools/inventory.d.ts.map +1 -0
- package/dist/tools/inventory.js +32 -0
- package/dist/tools/inventory.js.map +1 -0
- package/dist/tools/logs.d.ts +4 -0
- package/dist/tools/logs.d.ts.map +1 -0
- package/dist/tools/logs.js +91 -0
- package/dist/tools/logs.js.map +1 -0
- package/dist/tools/monitoring.d.ts +4 -0
- package/dist/tools/monitoring.d.ts.map +1 -0
- package/dist/tools/monitoring.js +70 -0
- package/dist/tools/monitoring.js.map +1 -0
- package/dist/tools/read-tools.d.ts +20 -0
- package/dist/tools/read-tools.d.ts.map +1 -0
- package/dist/tools/read-tools.js +51 -0
- package/dist/tools/read-tools.js.map +1 -0
- package/dist/tools/server.d.ts +4 -0
- package/dist/tools/server.d.ts.map +1 -0
- package/dist/tools/server.js +42 -0
- package/dist/tools/server.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @nightsquawktech/tacticalrmm-mcp-server
|
|
2
|
+
|
|
3
|
+
[](https://scorecard.dev/viewer/?uri=github.com/NightSquawk/tacticalrmm-mcp-server)
|
|
4
|
+
|
|
5
|
+
Simple Model Context Protocol server for self-hosted TacticalRMM instances.
|
|
6
|
+
|
|
7
|
+
## Feasibility
|
|
8
|
+
|
|
9
|
+
TacticalRMM exposes a Django REST Framework API used by its Vue frontend. API keys are sent with the `X-API-KEY` header, and TacticalRMM endpoints require trailing slashes. API keys bypass 2FA and inherit the permissions of the TacticalRMM user selected when the key is created.
|
|
10
|
+
|
|
11
|
+
This first pass is intentionally read-only. Command and script endpoints such as `/agents/<agent_id>/cmd/` and `/agents/<agent_id>/runscript/` are not exposed yet because they execute code on managed endpoints.
|
|
12
|
+
|
|
13
|
+
## Tools
|
|
14
|
+
|
|
15
|
+
- `tacticalrmm_get_server_info` reads `/core/version/` and `/core/dashinfo/`.
|
|
16
|
+
- `tacticalrmm_list_clients` reads `/clients/`.
|
|
17
|
+
- `tacticalrmm_list_agents` reads `/agents/` with optional filters.
|
|
18
|
+
- `tacticalrmm_get_agent` reads `/agents/<agent_id>/`.
|
|
19
|
+
- `tacticalrmm_list_agent_software` reads `/software/<agent_id>/`.
|
|
20
|
+
- `tacticalrmm_list_sites` reads `/clients/sites/`.
|
|
21
|
+
- `tacticalrmm_list_agent_services` reads `/services/<agent_id>/`.
|
|
22
|
+
- `tacticalrmm_list_win_updates` reads `/winupdate/<agent_id>/`.
|
|
23
|
+
- `tacticalrmm_list_alerts` queries `/alerts/` using TacticalRMM's alert filter payload.
|
|
24
|
+
- `tacticalrmm_list_checks` reads `/checks/`.
|
|
25
|
+
- `tacticalrmm_list_agent_checks` reads `/agents/<agent_id>/checks/`.
|
|
26
|
+
- `tacticalrmm_get_check_history` queries `/checks/<check_id>/history/` using TacticalRMM's history filter payload.
|
|
27
|
+
- `tacticalrmm_list_tasks` reads `/tasks/`.
|
|
28
|
+
- `tacticalrmm_list_agent_tasks` reads `/agents/<agent_id>/tasks/`.
|
|
29
|
+
- `tacticalrmm_list_scripts` reads `/scripts/`.
|
|
30
|
+
- `tacticalrmm_list_policies` reads `/automation/policies/`.
|
|
31
|
+
- `tacticalrmm_list_agent_history` reads `/agents/<agent_id>/history/`.
|
|
32
|
+
- `tacticalrmm_list_agent_notes` reads `/agents/<agent_id>/notes/`.
|
|
33
|
+
- `tacticalrmm_list_pending_actions` reads `/logs/pendingactions/`.
|
|
34
|
+
- `tacticalrmm_list_agent_pending_actions` reads `/agents/<agent_id>/pendingactions/`.
|
|
35
|
+
- `tacticalrmm_get_custom_fields` reads `/core/customfields/`.
|
|
36
|
+
- `tacticalrmm_get_audit_logs` queries `/logs/audit/` using TacticalRMM's audit-log filter payload.
|
|
37
|
+
|
|
38
|
+
## Setup
|
|
39
|
+
|
|
40
|
+
Configure your MCP client to run the server with `npx`:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"tacticalrmm": {
|
|
46
|
+
"command": "npx",
|
|
47
|
+
"args": ["-y", "@nightsquawktech/tacticalrmm-mcp-server"],
|
|
48
|
+
"env": {
|
|
49
|
+
"TACTICALRMM_BASE_URL": "https://api.your-instance.example.com",
|
|
50
|
+
"TACTICALRMM_API_KEY": "your-api-key"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Environment variables
|
|
58
|
+
|
|
59
|
+
| Variable | Required | Description |
|
|
60
|
+
|----------|----------|-------------|
|
|
61
|
+
| `TACTICALRMM_BASE_URL` | Yes | Base URL of your TacticalRMM API host, e.g. `https://api.your-instance.example.com` |
|
|
62
|
+
| `TACTICALRMM_API_KEY` | Yes | TacticalRMM API key, sent as `X-API-KEY` |
|
|
63
|
+
| `TACTICALRMM_TIMEOUT_MS` | No | HTTP request timeout in milliseconds, default `30000` |
|
|
64
|
+
|
|
65
|
+
## Development
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
npm install
|
|
69
|
+
npm run dev
|
|
70
|
+
npm run build
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The server uses `stdio` by default for local MCP clients. Use stderr for logs so stdout remains reserved for MCP protocol messages.
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
Licensed under the [GNU AGPL v3.0](./LICENSE). Free for personal and open-source use.
|
|
78
|
+
|
|
79
|
+
Organizations that cannot comply with the AGPL can purchase a commercial license. See [COMMERCIAL.md](./COMMERCIAL.md) or contact hello@nightsquawk.tech.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const SERVER_NAME = "tacticalrmm-mcp-server";
|
|
2
|
+
export declare const SERVER_VERSION = "0.1.0";
|
|
3
|
+
export declare const ENV: {
|
|
4
|
+
readonly baseUrl: "TACTICALRMM_BASE_URL";
|
|
5
|
+
readonly apiKey: "TACTICALRMM_API_KEY";
|
|
6
|
+
readonly timeoutMs: "TACTICALRMM_TIMEOUT_MS";
|
|
7
|
+
};
|
|
8
|
+
export declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
9
|
+
export declare const RESPONSE_CHARACTER_LIMIT = 25000;
|
|
10
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,2BAA2B,CAAC;AACpD,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,GAAG;;;;CAIN,CAAC;AAEX,eAAO,MAAM,kBAAkB,QAAS,CAAC;AACzC,eAAO,MAAM,wBAAwB,QAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const SERVER_NAME = "tacticalrmm-mcp-server";
|
|
2
|
+
export const SERVER_VERSION = "0.1.0";
|
|
3
|
+
export const ENV = {
|
|
4
|
+
baseUrl: "TACTICALRMM_BASE_URL",
|
|
5
|
+
apiKey: "TACTICALRMM_API_KEY",
|
|
6
|
+
timeoutMs: "TACTICALRMM_TIMEOUT_MS"
|
|
7
|
+
};
|
|
8
|
+
export const DEFAULT_TIMEOUT_MS = 30_000;
|
|
9
|
+
export const RESPONSE_CHARACTER_LIMIT = 25_000;
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,wBAAwB,CAAC;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,OAAO,EAAE,sBAAsB;IAC/B,MAAM,EAAE,qBAAqB;IAC7B,SAAS,EAAE,wBAAwB;CAC3B,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACzC,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { SERVER_NAME, SERVER_VERSION } from "./constants.js";
|
|
5
|
+
import { loadConfig } from "./services/config.js";
|
|
6
|
+
import { TacticalRmmClient } from "./services/tacticalrmm-client.js";
|
|
7
|
+
import { registerTools } from "./tools/index.js";
|
|
8
|
+
async function main() {
|
|
9
|
+
const config = loadConfig();
|
|
10
|
+
const client = new TacticalRmmClient(config);
|
|
11
|
+
const server = new McpServer({
|
|
12
|
+
name: SERVER_NAME,
|
|
13
|
+
version: SERVER_VERSION
|
|
14
|
+
});
|
|
15
|
+
registerTools(server, client);
|
|
16
|
+
const transport = new StdioServerTransport();
|
|
17
|
+
await server.connect(transport);
|
|
18
|
+
console.error(`${SERVER_NAME} ${SERVER_VERSION} running on stdio`);
|
|
19
|
+
}
|
|
20
|
+
main().catch((error) => {
|
|
21
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IAEH,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,cAAc,mBAAmB,CAAC,CAAC;AACrE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ListAgentsSchema: z.ZodObject<{
|
|
3
|
+
detail: z.ZodDefault<z.ZodBoolean>;
|
|
4
|
+
client: z.ZodOptional<z.ZodNumber>;
|
|
5
|
+
site: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
monitoring_type: z.ZodOptional<z.ZodString>;
|
|
7
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
10
|
+
}, "strict", z.ZodTypeAny, {
|
|
11
|
+
offset: number;
|
|
12
|
+
detail: boolean;
|
|
13
|
+
limit: number;
|
|
14
|
+
response_format: "markdown" | "json";
|
|
15
|
+
client?: number | undefined;
|
|
16
|
+
site?: number | undefined;
|
|
17
|
+
monitoring_type?: string | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
offset?: number | undefined;
|
|
20
|
+
detail?: boolean | undefined;
|
|
21
|
+
client?: number | undefined;
|
|
22
|
+
site?: number | undefined;
|
|
23
|
+
monitoring_type?: string | undefined;
|
|
24
|
+
limit?: number | undefined;
|
|
25
|
+
response_format?: "markdown" | "json" | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const AgentIdSchema: z.ZodObject<{
|
|
28
|
+
agent_id: z.ZodString;
|
|
29
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
30
|
+
}, "strict", z.ZodTypeAny, {
|
|
31
|
+
response_format: "markdown" | "json";
|
|
32
|
+
agent_id: string;
|
|
33
|
+
}, {
|
|
34
|
+
agent_id: string;
|
|
35
|
+
response_format?: "markdown" | "json" | undefined;
|
|
36
|
+
}>;
|
|
37
|
+
export type ListAgentsInput = z.infer<typeof ListAgentsSchema>;
|
|
38
|
+
export type AgentIdInput = z.infer<typeof AgentIdSchema>;
|
|
39
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/schemas/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;EA2BlB,CAAC;AAEZ,eAAO,MAAM,aAAa;;;;;;;;;EAKf,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { LimitSchema, OffsetSchema, ResponseFormatSchema } from "./common.js";
|
|
3
|
+
export const ListAgentsSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
detail: z
|
|
6
|
+
.boolean()
|
|
7
|
+
.default(false)
|
|
8
|
+
.describe("Whether TacticalRMM should return detailed agent records."),
|
|
9
|
+
client: z
|
|
10
|
+
.number()
|
|
11
|
+
.int()
|
|
12
|
+
.positive()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("Optional TacticalRMM client numeric ID filter."),
|
|
15
|
+
site: z
|
|
16
|
+
.number()
|
|
17
|
+
.int()
|
|
18
|
+
.positive()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("Optional TacticalRMM site numeric ID filter."),
|
|
21
|
+
monitoring_type: z
|
|
22
|
+
.string()
|
|
23
|
+
.min(1)
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("Optional TacticalRMM monitoring type filter."),
|
|
26
|
+
limit: LimitSchema,
|
|
27
|
+
offset: OffsetSchema,
|
|
28
|
+
response_format: ResponseFormatSchema
|
|
29
|
+
})
|
|
30
|
+
.strict();
|
|
31
|
+
export const AgentIdSchema = z
|
|
32
|
+
.object({
|
|
33
|
+
agent_id: z.string().min(8).describe("TacticalRMM agent_id value."),
|
|
34
|
+
response_format: ResponseFormatSchema
|
|
35
|
+
})
|
|
36
|
+
.strict();
|
|
37
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/schemas/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,MAAM,EAAE,CAAC;SACN,OAAO,EAAE;SACT,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,2DAA2D,CAAC;IACxE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,8CAA8C,CAAC;IAC3D,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,8CAA8C,CAAC;IAC3D,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACnE,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ListClientsSchema: z.ZodObject<{
|
|
3
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
4
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
offset: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
response_format: "markdown" | "json";
|
|
10
|
+
}, {
|
|
11
|
+
offset?: number | undefined;
|
|
12
|
+
limit?: number | undefined;
|
|
13
|
+
response_format?: "markdown" | "json" | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export type ListClientsInput = z.infer<typeof ListClientsSchema>;
|
|
16
|
+
//# sourceMappingURL=clients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../src/schemas/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;EAMnB,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { LimitSchema, OffsetSchema, ResponseFormatSchema } from "./common.js";
|
|
3
|
+
export const ListClientsSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
limit: LimitSchema,
|
|
6
|
+
offset: OffsetSchema,
|
|
7
|
+
response_format: ResponseFormatSchema
|
|
8
|
+
})
|
|
9
|
+
.strict();
|
|
10
|
+
//# sourceMappingURL=clients.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients.js","sourceRoot":"","sources":["../../src/schemas/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,CAAC;IACN,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ResponseFormatSchema: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
3
|
+
export declare const LimitSchema: z.ZodDefault<z.ZodNumber>;
|
|
4
|
+
export declare const OffsetSchema: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,oBAAoB,+CAG+D,CAAC;AAEjG,eAAO,MAAM,WAAW,2BAMyB,CAAC;AAElD,eAAO,MAAM,YAAY,2BAKuD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ResponseFormatSchema = z
|
|
3
|
+
.enum(["markdown", "json"])
|
|
4
|
+
.default("markdown")
|
|
5
|
+
.describe("Output format: markdown for human-readable summaries, json for structured output.");
|
|
6
|
+
export const LimitSchema = z
|
|
7
|
+
.number()
|
|
8
|
+
.int()
|
|
9
|
+
.min(1)
|
|
10
|
+
.max(100)
|
|
11
|
+
.default(25)
|
|
12
|
+
.describe("Maximum number of items to return.");
|
|
13
|
+
export const OffsetSchema = z
|
|
14
|
+
.number()
|
|
15
|
+
.int()
|
|
16
|
+
.min(0)
|
|
17
|
+
.default(0)
|
|
18
|
+
.describe("Number of items to skip locally after receiving the API response.");
|
|
19
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;KAC1B,OAAO,CAAC,UAAU,CAAC;KACnB,QAAQ,CAAC,mFAAmF,CAAC,CAAC;AAEjG,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,OAAO,CAAC,EAAE,CAAC;KACX,QAAQ,CAAC,oCAAoC,CAAC,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,OAAO,CAAC,CAAC,CAAC;KACV,QAAQ,CAAC,mEAAmE,CAAC,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ListResourcesSchema: z.ZodObject<{
|
|
3
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
4
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
offset: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
response_format: "markdown" | "json";
|
|
10
|
+
}, {
|
|
11
|
+
offset?: number | undefined;
|
|
12
|
+
limit?: number | undefined;
|
|
13
|
+
response_format?: "markdown" | "json" | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const AgentResourceSchema: z.ZodObject<{
|
|
16
|
+
agent_id: z.ZodString;
|
|
17
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
18
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
19
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
offset: number;
|
|
22
|
+
limit: number;
|
|
23
|
+
response_format: "markdown" | "json";
|
|
24
|
+
agent_id: string;
|
|
25
|
+
}, {
|
|
26
|
+
agent_id: string;
|
|
27
|
+
offset?: number | undefined;
|
|
28
|
+
limit?: number | undefined;
|
|
29
|
+
response_format?: "markdown" | "json" | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const CheckHistorySchema: z.ZodObject<{
|
|
32
|
+
check_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
33
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
34
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
35
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
36
|
+
}, "strict", z.ZodTypeAny, {
|
|
37
|
+
offset: number;
|
|
38
|
+
limit: number;
|
|
39
|
+
response_format: "markdown" | "json";
|
|
40
|
+
check_id: string | number;
|
|
41
|
+
}, {
|
|
42
|
+
check_id: string | number;
|
|
43
|
+
offset?: number | undefined;
|
|
44
|
+
limit?: number | undefined;
|
|
45
|
+
response_format?: "markdown" | "json" | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const AuditLogsSchema: z.ZodObject<{
|
|
48
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
49
|
+
rows_per_page: z.ZodDefault<z.ZodNumber>;
|
|
50
|
+
sort_by: z.ZodDefault<z.ZodString>;
|
|
51
|
+
descending: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
agent_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
53
|
+
actions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
54
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
55
|
+
}, "strict", z.ZodTypeAny, {
|
|
56
|
+
response_format: "markdown" | "json";
|
|
57
|
+
page: number;
|
|
58
|
+
rows_per_page: number;
|
|
59
|
+
sort_by: string;
|
|
60
|
+
descending: boolean;
|
|
61
|
+
agent_ids: string[];
|
|
62
|
+
actions: string[];
|
|
63
|
+
}, {
|
|
64
|
+
response_format?: "markdown" | "json" | undefined;
|
|
65
|
+
page?: number | undefined;
|
|
66
|
+
rows_per_page?: number | undefined;
|
|
67
|
+
sort_by?: string | undefined;
|
|
68
|
+
descending?: boolean | undefined;
|
|
69
|
+
agent_ids?: string[] | undefined;
|
|
70
|
+
actions?: string[] | undefined;
|
|
71
|
+
}>;
|
|
72
|
+
export type ListResourcesInput = z.infer<typeof ListResourcesSchema>;
|
|
73
|
+
export type AgentResourceInput = z.infer<typeof AgentResourceSchema>;
|
|
74
|
+
export type CheckHistoryInput = z.infer<typeof CheckHistorySchema>;
|
|
75
|
+
export type AuditLogsInput = z.infer<typeof AuditLogsSchema>;
|
|
76
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/schemas/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;EAMrB,CAAC;AAEZ,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;EAOrB,CAAC;AAEZ,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;EAOpB,CAAC;AAEZ,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;EAUjB,CAAC;AAEZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACrE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACnE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { LimitSchema, OffsetSchema, ResponseFormatSchema } from "./common.js";
|
|
3
|
+
export const ListResourcesSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
limit: LimitSchema,
|
|
6
|
+
offset: OffsetSchema,
|
|
7
|
+
response_format: ResponseFormatSchema
|
|
8
|
+
})
|
|
9
|
+
.strict();
|
|
10
|
+
export const AgentResourceSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
agent_id: z.string().min(8).describe("TacticalRMM agent_id value."),
|
|
13
|
+
limit: LimitSchema,
|
|
14
|
+
offset: OffsetSchema,
|
|
15
|
+
response_format: ResponseFormatSchema
|
|
16
|
+
})
|
|
17
|
+
.strict();
|
|
18
|
+
export const CheckHistorySchema = z
|
|
19
|
+
.object({
|
|
20
|
+
check_id: z.union([z.string().min(1), z.number().int().positive()]).describe("TacticalRMM check ID."),
|
|
21
|
+
limit: LimitSchema,
|
|
22
|
+
offset: OffsetSchema,
|
|
23
|
+
response_format: ResponseFormatSchema
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
export const AuditLogsSchema = z
|
|
27
|
+
.object({
|
|
28
|
+
page: z.number().int().min(1).default(1).describe("TacticalRMM audit log page number."),
|
|
29
|
+
rows_per_page: z.number().int().min(1).max(1000).default(100).describe("Audit log rows per page."),
|
|
30
|
+
sort_by: z.string().min(1).default("entry_time").describe("Audit log sort field."),
|
|
31
|
+
descending: z.boolean().default(true).describe("Whether to sort descending."),
|
|
32
|
+
agent_ids: z.array(z.string().min(1)).default([]).describe("Optional TacticalRMM agent IDs to filter."),
|
|
33
|
+
actions: z.array(z.string().min(1)).default([]).describe("Optional audit action names to filter."),
|
|
34
|
+
response_format: ResponseFormatSchema
|
|
35
|
+
})
|
|
36
|
+
.strict();
|
|
37
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/schemas/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACnE,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACrG,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACvF,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IAClG,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IAClF,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IAC7E,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACvG,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC;IAClG,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ServerInfoSchema: z.ZodObject<{
|
|
3
|
+
response_format: z.ZodDefault<z.ZodEnum<["markdown", "json"]>>;
|
|
4
|
+
}, "strict", z.ZodTypeAny, {
|
|
5
|
+
response_format: "markdown" | "json";
|
|
6
|
+
}, {
|
|
7
|
+
response_format?: "markdown" | "json" | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export type ServerInfoInput = z.infer<typeof ServerInfoSchema>;
|
|
10
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/schemas/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;;;;;EAIlB,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/schemas/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,eAAe,EAAE,oBAAoB;CACtC,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,wBAAgB,UAAU,IAAI,iBAAiB,CAuB9C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DEFAULT_TIMEOUT_MS, ENV } from "../constants.js";
|
|
2
|
+
export function loadConfig() {
|
|
3
|
+
const baseUrl = process.env[ENV.baseUrl]?.trim();
|
|
4
|
+
const apiKey = process.env[ENV.apiKey]?.trim();
|
|
5
|
+
const timeoutRaw = process.env[ENV.timeoutMs]?.trim();
|
|
6
|
+
if (!baseUrl) {
|
|
7
|
+
throw new Error(`${ENV.baseUrl} is required, for example https://api.example.com`);
|
|
8
|
+
}
|
|
9
|
+
if (!apiKey) {
|
|
10
|
+
throw new Error(`${ENV.apiKey} is required. Create an API key in TacticalRMM Settings > Global Settings > API Keys.`);
|
|
11
|
+
}
|
|
12
|
+
const timeoutMs = timeoutRaw ? Number.parseInt(timeoutRaw, 10) : DEFAULT_TIMEOUT_MS;
|
|
13
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs < 1_000) {
|
|
14
|
+
throw new Error(`${ENV.timeoutMs} must be an integer of at least 1000 milliseconds.`);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
baseUrl: baseUrl.replace(/\/+$/, ""),
|
|
18
|
+
apiKey,
|
|
19
|
+
timeoutMs
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG1D,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC;IAC/C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC;IAEtD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,OAAO,mDAAmD,CAAC,CAAC;IACrF,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,uFAAuF,CAAC,CAAC;IACxH,CAAC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC;IACpF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,KAAK,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,SAAS,oDAAoD,CAAC,CAAC;IACxF,CAAC;IAED,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;QACpC,MAAM;QACN,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/services/errors.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA+BrD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export function formatApiError(error) {
|
|
3
|
+
if (axios.isAxiosError(error)) {
|
|
4
|
+
if (error.response) {
|
|
5
|
+
const status = error.response.status;
|
|
6
|
+
const detail = formatErrorData(error.response.data);
|
|
7
|
+
if (status === 401 || status === 403) {
|
|
8
|
+
return `TacticalRMM denied the request (${status}). Check the API key and the selected user's role permissions.${detail}`;
|
|
9
|
+
}
|
|
10
|
+
if (status === 404) {
|
|
11
|
+
return `TacticalRMM resource not found (404). Check IDs and confirm the endpoint keeps its trailing slash.${detail}`;
|
|
12
|
+
}
|
|
13
|
+
if (status === 429) {
|
|
14
|
+
return `TacticalRMM rate limited the request (429). Retry later or reduce request volume.${detail}`;
|
|
15
|
+
}
|
|
16
|
+
return `TacticalRMM API request failed (${status}).${detail}`;
|
|
17
|
+
}
|
|
18
|
+
if (error.code === "ECONNABORTED") {
|
|
19
|
+
return "TacticalRMM API request timed out. Increase TACTICALRMM_TIMEOUT_MS or narrow the query.";
|
|
20
|
+
}
|
|
21
|
+
if (error.code) {
|
|
22
|
+
return `TacticalRMM API connection failed (${error.code}). Check TACTICALRMM_BASE_URL and network access.`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return `Unexpected TacticalRMM error: ${error instanceof Error ? error.message : String(error)}`;
|
|
26
|
+
}
|
|
27
|
+
function formatErrorData(data) {
|
|
28
|
+
if (data === undefined || data === null) {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
if (typeof data === "string") {
|
|
32
|
+
return ` Response: ${data}`;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
return ` Response: ${JSON.stringify(data)}`;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return "";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/services/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;YACrC,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAEpD,IAAI,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;gBACrC,OAAO,mCAAmC,MAAM,iEAAiE,MAAM,EAAE,CAAC;YAC5H,CAAC;YAED,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;gBACnB,OAAO,qGAAqG,MAAM,EAAE,CAAC;YACvH,CAAC;YAED,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;gBACnB,OAAO,oFAAoF,MAAM,EAAE,CAAC;YACtG,CAAC;YAED,OAAO,mCAAmC,MAAM,KAAK,MAAM,EAAE,CAAC;QAChE,CAAC;QAED,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAClC,OAAO,yFAAyF,CAAC;QACnG,CAAC;QAED,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,OAAO,sCAAsC,KAAK,CAAC,IAAI,mDAAmD,CAAC;QAC7G,CAAC;IACH,CAAC;IAED,OAAO,iCAAiC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACnG,CAAC;AAED,SAAS,eAAe,CAAC,IAAa;IACpC,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,cAAc,IAAI,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,CAAC;QACH,OAAO,cAAc,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type AxiosRequestConfig } from "axios";
|
|
2
|
+
import type { TacticalRmmConfig, TacticalRmmMethod } from "../types.js";
|
|
3
|
+
export declare class TacticalRmmClient {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(config: TacticalRmmConfig);
|
|
6
|
+
request<T>(method: TacticalRmmMethod, path: string, options?: Pick<AxiosRequestConfig, "data" | "params">): Promise<T>;
|
|
7
|
+
get<T>(path: string, params?: Record<string, unknown>): Promise<T>;
|
|
8
|
+
query<T>(path: string, data?: Record<string, unknown>): Promise<T>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=tacticalrmm-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tacticalrmm-client.d.ts","sourceRoot":"","sources":["../../src/services/tacticalrmm-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAsB,KAAK,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgB;gBAEzB,MAAM,EAAE,iBAAiB;IAY/B,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,QAAQ,CAAM,GACxD,OAAO,CAAC,CAAC,CAAC;IAUb,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAIlE,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAGnE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export class TacticalRmmClient {
|
|
3
|
+
http;
|
|
4
|
+
constructor(config) {
|
|
5
|
+
this.http = axios.create({
|
|
6
|
+
baseURL: config.baseUrl,
|
|
7
|
+
timeout: config.timeoutMs,
|
|
8
|
+
headers: {
|
|
9
|
+
Accept: "application/json",
|
|
10
|
+
"Content-Type": "application/json",
|
|
11
|
+
"X-API-KEY": config.apiKey
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async request(method, path, options = {}) {
|
|
16
|
+
const response = await this.http.request({
|
|
17
|
+
method,
|
|
18
|
+
url: normalizePath(path),
|
|
19
|
+
...options
|
|
20
|
+
});
|
|
21
|
+
return response.data;
|
|
22
|
+
}
|
|
23
|
+
get(path, params) {
|
|
24
|
+
return this.request("GET", path, { params });
|
|
25
|
+
}
|
|
26
|
+
query(path, data) {
|
|
27
|
+
return this.request("PATCH", path, { data });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function normalizePath(path) {
|
|
31
|
+
const cleanPath = path.startsWith("/") ? path : `/${path}`;
|
|
32
|
+
if (cleanPath.includes("?") || cleanPath.endsWith("/")) {
|
|
33
|
+
return cleanPath;
|
|
34
|
+
}
|
|
35
|
+
return `${cleanPath}/`;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=tacticalrmm-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tacticalrmm-client.js","sourceRoot":"","sources":["../../src/services/tacticalrmm-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAG3E,MAAM,OAAO,iBAAiB;IACX,IAAI,CAAgB;IAErC,YAAY,MAAyB;QACnC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,OAAO,EAAE,MAAM,CAAC,SAAS;YACzB,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;gBAClC,WAAW,EAAE,MAAM,CAAC,MAAM;aAC3B;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CACX,MAAyB,EACzB,IAAY,EACZ,UAAuD,EAAE;QAEzD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAI;YAC1C,MAAM;YACN,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC;YACxB,GAAG,OAAO;SACX,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,GAAG,CAAI,IAAY,EAAE,MAAgC;QACnD,OAAO,IAAI,CAAC,OAAO,CAAI,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,KAAK,CAAI,IAAY,EAAE,IAA8B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAI,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;CACF;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;IAE3D,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,GAAG,SAAS,GAAG,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { TacticalRmmClient } from "../services/tacticalrmm-client.js";
|
|
3
|
+
export declare function registerAgentTools(server: McpServer, client: TacticalRmmClient): void;
|
|
4
|
+
//# sourceMappingURL=agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/tools/agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAK3E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI,CA4GrF"}
|