@access-mcp/xdmod 0.6.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/README.md +113 -0
- package/dist/__tests__/server.integration.test.d.ts +1 -0
- package/dist/__tests__/server.integration.test.js +91 -0
- package/dist/__tests__/server.test.d.ts +1 -0
- package/dist/__tests__/server.test.js +507 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +1029 -0
- package/dist/user-specific.d.ts +18 -0
- package/dist/user-specific.js +58 -0
- package/package.json +46 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface UserSpecificParams {
|
|
2
|
+
realm: string;
|
|
3
|
+
statistic: string;
|
|
4
|
+
start_date: string;
|
|
5
|
+
end_date: string;
|
|
6
|
+
username_filter?: string;
|
|
7
|
+
person_id?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class XDMoDUserSpecific {
|
|
10
|
+
private baseURL;
|
|
11
|
+
private apiToken;
|
|
12
|
+
constructor(baseURL: string, apiToken: string);
|
|
13
|
+
private getAuthHeaders;
|
|
14
|
+
getUserGroupBys(realm?: string): Promise<{
|
|
15
|
+
allGroupBys: any;
|
|
16
|
+
userRelatedGroupBys: any;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// User-specific functionality for XDMoD Metrics Server
|
|
2
|
+
// This module contains the getUserGroupBys method for authenticated users
|
|
3
|
+
export class XDMoDUserSpecific {
|
|
4
|
+
baseURL;
|
|
5
|
+
apiToken;
|
|
6
|
+
constructor(baseURL, apiToken) {
|
|
7
|
+
this.baseURL = baseURL;
|
|
8
|
+
this.apiToken = apiToken;
|
|
9
|
+
}
|
|
10
|
+
getAuthHeaders() {
|
|
11
|
+
return {
|
|
12
|
+
Token: this.apiToken,
|
|
13
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
async getUserGroupBys(realm = "Jobs") {
|
|
17
|
+
try {
|
|
18
|
+
// First get all available group_bys for the realm
|
|
19
|
+
const response = await fetch(`${this.baseURL}/controllers/user_interface.php`, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
headers: this.getAuthHeaders(),
|
|
22
|
+
body: new URLSearchParams({
|
|
23
|
+
operation: "get_menus",
|
|
24
|
+
public_user: "false", // Authenticated to see all options
|
|
25
|
+
category: realm,
|
|
26
|
+
node: `${realm}_`,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
31
|
+
}
|
|
32
|
+
const data = await response.json();
|
|
33
|
+
// Filter for user-related group_bys
|
|
34
|
+
const allGroupBys = data.data || [];
|
|
35
|
+
const userGroupBys = allGroupBys.filter((item) => {
|
|
36
|
+
const groupBy = item.group_by || item.id || "";
|
|
37
|
+
// Look for person/PI/user related group_bys
|
|
38
|
+
return (groupBy.includes("person") ||
|
|
39
|
+
groupBy.includes("pi") ||
|
|
40
|
+
groupBy.includes("user") ||
|
|
41
|
+
item.text?.toLowerCase().includes("person") ||
|
|
42
|
+
item.text?.toLowerCase().includes("user") ||
|
|
43
|
+
item.text?.toLowerCase().includes("pi"));
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
allGroupBys,
|
|
47
|
+
userRelatedGroupBys: userGroupBys.map((item) => ({
|
|
48
|
+
id: item.id,
|
|
49
|
+
text: item.text,
|
|
50
|
+
group_by: item.group_by,
|
|
51
|
+
})),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
throw new Error(`Failed to enumerate user group_bys: ${error instanceof Error ? error.message : String(error)}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@access-mcp/xdmod",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "MCP server for XDMoD public data: charts, visualizations, and metadata discovery",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"access-xdmod": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"start": "node dist/index.js",
|
|
13
|
+
"dev": "tsc --watch"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"mcp",
|
|
17
|
+
"server",
|
|
18
|
+
"access-ci",
|
|
19
|
+
"xdmod",
|
|
20
|
+
"charts",
|
|
21
|
+
"visualizations",
|
|
22
|
+
"analytics"
|
|
23
|
+
],
|
|
24
|
+
"author": "ACCESS-CI",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/necyberteam/access-mcp.git",
|
|
29
|
+
"directory": "packages/xdmod"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/necyberteam/access-mcp/tree/main/packages/xdmod",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/necyberteam/access-mcp/issues"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@access-mcp/shared": "*"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^20.0.0",
|
|
40
|
+
"typescript": "^5.0.0"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist/**/*",
|
|
44
|
+
"README.md"
|
|
45
|
+
]
|
|
46
|
+
}
|