@rad-security/mcp-server 0.0.2

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.
Files changed (47) hide show
  1. package/README.md +151 -0
  2. package/dist/client.d.ts +21 -0
  3. package/dist/client.js +102 -0
  4. package/dist/client.js.map +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +480 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/operations/audit.d.ts +31 -0
  9. package/dist/operations/audit.js +55 -0
  10. package/dist/operations/audit.js.map +1 -0
  11. package/dist/operations/cloud-inventory.d.ts +70 -0
  12. package/dist/operations/cloud-inventory.js +61 -0
  13. package/dist/operations/cloud-inventory.js.map +1 -0
  14. package/dist/operations/clusters.d.ts +21 -0
  15. package/dist/operations/clusters.js +20 -0
  16. package/dist/operations/clusters.js.map +1 -0
  17. package/dist/operations/containers.d.ts +27 -0
  18. package/dist/operations/containers.js +33 -0
  19. package/dist/operations/containers.js.map +1 -0
  20. package/dist/operations/findings.d.ts +52 -0
  21. package/dist/operations/findings.js +76 -0
  22. package/dist/operations/findings.js.map +1 -0
  23. package/dist/operations/identities.d.ts +33 -0
  24. package/dist/operations/identities.js +30 -0
  25. package/dist/operations/identities.js.map +1 -0
  26. package/dist/operations/images.d.ts +46 -0
  27. package/dist/operations/images.js +58 -0
  28. package/dist/operations/images.js.map +1 -0
  29. package/dist/operations/kubeobject.d.ts +33 -0
  30. package/dist/operations/kubeobject.js +38 -0
  31. package/dist/operations/kubeobject.js.map +1 -0
  32. package/dist/operations/misconfigs.d.ts +21 -0
  33. package/dist/operations/misconfigs.js +36 -0
  34. package/dist/operations/misconfigs.js.map +1 -0
  35. package/dist/operations/runtime.d.ts +26 -0
  36. package/dist/operations/runtime.js +68 -0
  37. package/dist/operations/runtime.js.map +1 -0
  38. package/dist/operations/runtime_network.d.ts +53 -0
  39. package/dist/operations/runtime_network.js +41 -0
  40. package/dist/operations/runtime_network.js.map +1 -0
  41. package/dist/operations/threats.d.ts +22 -0
  42. package/dist/operations/threats.js +24 -0
  43. package/dist/operations/threats.js.map +1 -0
  44. package/dist/version.d.ts +1 -0
  45. package/dist/version.js +2 -0
  46. package/dist/version.js.map +1 -0
  47. package/package.json +63 -0
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # RAD Security MCP Server
2
+
3
+ A Model Context Protocol (MCP) server for RAD Security, providing AI-powered security insights for Kubernetes and cloud environments.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @rad-security/mcp-server
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Environment Variables
14
+
15
+ The following environment variables are required:
16
+
17
+ ```bash
18
+ RAD_SECURITY_ACCESS_KEY_ID=your_access_key
19
+ RAD_SECURITY_SECRET_KEY=your_secret_key
20
+ RAD_SECURITY_ACCOUNT_ID=your_account_id
21
+ ```
22
+
23
+ ### In cursor IDE
24
+
25
+ It's quite problematic to set ENV variables in cursor IDE.
26
+
27
+ So, you can use the following start.sh script to start the server.
28
+
29
+ ```bash
30
+ ./start.sh
31
+ ```
32
+
33
+ Please set the ENV variables in the start.sh script first!
34
+
35
+ ### In Claude Desktop
36
+
37
+ You can use the following config to start the server in Claude Desktop.
38
+
39
+ ```json
40
+ {
41
+ "mcpServers": {
42
+ "rad-security": {
43
+ "command": "npx",
44
+ "args": ["@rad-security/mcp-server"],
45
+ "env": {
46
+ "RAD_SECURITY_ACCESS_KEY_ID": "<your-access-key-id>",
47
+ "RAD_SECURITY_SECRET_KEY": "<your-secret-key>",
48
+ "RAD_SECURITY_ACCOUNT_ID": "<your-account-id>"
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ### As a CLI Tool
55
+
56
+ ```bash
57
+ npx @rad-security/mcp-server
58
+ ```
59
+
60
+ ### As a Library
61
+
62
+ ```typescript
63
+ import { newServer } from '@rad-security/mcp-server';
64
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
65
+
66
+ async function main() {
67
+ const transport = new StdioServerTransport();
68
+ const server = await newServer();
69
+ await server.connect(transport);
70
+ }
71
+
72
+ main().catch(console.error);
73
+ ```
74
+
75
+ ### As a Docker Container - with SSE
76
+
77
+ ```bash
78
+ docker build -t rad-security/mcp-server .
79
+ docker run \
80
+ -e TRANSPORT_TYPE=sse \
81
+ -e RAD_SECURITY_ACCESS_KEY_ID=your_access_key \
82
+ -e RAD_SECURITY_SECRET_KEY=your_secret_key \
83
+ -e RAD_SECURITY_ACCOUNT_ID=your_account_id \
84
+ -p 3000:3000 \
85
+ rad-security/mcp-server
86
+ ```
87
+
88
+ ## Features
89
+
90
+ - Account Inventory
91
+ - List clusters and their details
92
+
93
+ - Containers Inventory
94
+ - List containers and their details
95
+
96
+ - Security Findings
97
+ - List and analyze security findings
98
+
99
+ - Runtime Security
100
+ - Get process trees of running containers
101
+ - Get runtime baselines of running containers
102
+ - Analyze process behavior of running containers
103
+
104
+ - Network Security
105
+ - Monitor HTTP requests
106
+ - Track network connections
107
+ - Analyze network patterns
108
+
109
+ - Identity and Access
110
+ - List identities
111
+ - Get identity details
112
+
113
+ - Audit
114
+ - List who shelled into a pod
115
+
116
+ - Cloud Security
117
+ - List and monitor cloud resources
118
+ - Get resource details and compliance status
119
+
120
+ - Images
121
+ - Get SBOMs
122
+ - List images and their vulnerabilities
123
+ - Get top vulnerable images
124
+
125
+ - Kubernetes Objects
126
+ - Get details of a specific Kubernetes resource
127
+ - List Kubernetes resources
128
+
129
+ - Threat Vector
130
+ - List threat vectors
131
+ - Get details of a specific threat vector
132
+
133
+ ## Development
134
+
135
+ ```bash
136
+ # Install dependencies
137
+ npm install
138
+
139
+ # Run type checking
140
+ npm run type-check
141
+
142
+ # Run linter
143
+ npm run lint
144
+
145
+ # Build
146
+ npm run build
147
+ ```
148
+
149
+ ## License
150
+
151
+ MIT License - see the [LICENSE](LICENSE) file for details
@@ -0,0 +1,21 @@
1
+ type RequestOptions = {
2
+ method?: string;
3
+ body?: unknown;
4
+ headers?: Record<string, string>;
5
+ };
6
+ export declare class RadSecurityClient {
7
+ private accessKeyId;
8
+ private secretKey;
9
+ private baseUrl;
10
+ private accountId;
11
+ private tokenCache;
12
+ constructor(accessKeyId: string, secretKey: string, baseUrl: string, accountId: string);
13
+ static fromEnv(): RadSecurityClient;
14
+ private isTokenValid;
15
+ getBaseUrl(): string;
16
+ getAccountId(): string;
17
+ private getToken;
18
+ makeRequest(endpoint: string, params?: Record<string, any>, options?: RequestOptions): Promise<any>;
19
+ private parseResponseBody;
20
+ }
21
+ export {};
package/dist/client.js ADDED
@@ -0,0 +1,102 @@
1
+ const USER_AGENT = `rad-security/mcp-server`;
2
+ export class RadSecurityClient {
3
+ accessKeyId;
4
+ secretKey;
5
+ baseUrl;
6
+ accountId;
7
+ tokenCache = null;
8
+ constructor(accessKeyId, secretKey, baseUrl, accountId) {
9
+ this.accessKeyId = accessKeyId;
10
+ this.secretKey = secretKey;
11
+ this.baseUrl = baseUrl;
12
+ this.accountId = accountId;
13
+ }
14
+ static fromEnv() {
15
+ const accessKeyId = process.env.RAD_SECURITY_ACCESS_KEY_ID;
16
+ const secretKey = process.env.RAD_SECURITY_SECRET_KEY;
17
+ const accountId = process.env.RAD_SECURITY_ACCOUNT_ID;
18
+ const baseUrl = process.env.RAD_SECURITY_API_URL || "https://api.rad.security";
19
+ if (!accessKeyId || !secretKey || !accountId) {
20
+ throw new Error("RAD_SECURITY_ACCESS_KEY_ID, RAD_SECURITY_SECRET_KEY, and RAD_SECURITY_ACCOUNT_ID must be set");
21
+ }
22
+ return new RadSecurityClient(accessKeyId, secretKey, baseUrl, accountId);
23
+ }
24
+ isTokenValid() {
25
+ if (!this.tokenCache) {
26
+ return false;
27
+ }
28
+ return new Date() < this.tokenCache.expiry;
29
+ }
30
+ getBaseUrl() {
31
+ return this.baseUrl;
32
+ }
33
+ getAccountId() {
34
+ return this.accountId;
35
+ }
36
+ async getToken() {
37
+ if (this.isTokenValid()) {
38
+ return this.tokenCache.token;
39
+ }
40
+ try {
41
+ const response = await fetch(`${this.baseUrl}/authentication/authenticate`, {
42
+ method: "POST",
43
+ headers: {
44
+ "Content-Type": "application/json",
45
+ },
46
+ body: JSON.stringify({
47
+ access_key_id: this.accessKeyId,
48
+ secret_key: this.secretKey,
49
+ }),
50
+ });
51
+ if (!response.ok) {
52
+ throw new Error(`HTTP error! status: ${response.status}`);
53
+ }
54
+ const tokenData = await response.json();
55
+ // Cache token with 5 min buffer before expiry (assuming 4 hour token validity)
56
+ const expiry = new Date();
57
+ expiry.setMinutes(expiry.getMinutes() + 235); // 3h 55m
58
+ this.tokenCache = {
59
+ token: tokenData.token,
60
+ expiry,
61
+ };
62
+ return this.tokenCache.token;
63
+ }
64
+ catch (error) {
65
+ throw new Error(`Error getting authentication token: ${error}`);
66
+ }
67
+ }
68
+ async makeRequest(endpoint, params = {}, options = {}) {
69
+ const headers = {
70
+ "Content-Type": "application/json",
71
+ "User-Agent": USER_AGENT,
72
+ Authorization: `Bearer ${await this.getToken()}`,
73
+ ...options.headers,
74
+ };
75
+ const url = new URL(`${this.getBaseUrl()}${endpoint}`);
76
+ if (params) {
77
+ Object.entries(params).forEach(([key, value]) => {
78
+ if (value !== undefined) {
79
+ url.searchParams.append(key, String(value));
80
+ }
81
+ });
82
+ }
83
+ const response = await fetch(url, {
84
+ method: options.method || "GET",
85
+ headers,
86
+ body: options.body ? JSON.stringify(options.body) : undefined,
87
+ });
88
+ const responseBody = await this.parseResponseBody(response);
89
+ if (!response.ok) {
90
+ throw new Error(`HTTP error! status: ${response.status} error: ${JSON.stringify(responseBody, null, 2)}`);
91
+ }
92
+ return responseBody;
93
+ }
94
+ async parseResponseBody(response) {
95
+ const contentType = response.headers.get("content-type");
96
+ if (contentType?.includes("application/json")) {
97
+ return response.json();
98
+ }
99
+ return response.text();
100
+ }
101
+ }
102
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,MAAM,UA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