fa-mcp-sdk 0.2.203 → 0.2.204
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/bin/fa-mcp.js +2 -2
- package/package.json +1 -1
- package/src/template/_types_/custom-config.ts +16 -16
package/bin/fa-mcp.js
CHANGED
|
@@ -142,12 +142,12 @@ const removeIfExists = async (targetPath, relPath, options = {}) => {
|
|
|
142
142
|
finalOptions = { ...finalOptions, recursive: true };
|
|
143
143
|
}
|
|
144
144
|
} catch {
|
|
145
|
-
// lstat
|
|
145
|
+
// lstat will crash if there is no file/folder – that's ok, just go to rm with the same options
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
await fs.rm(fullPath, finalOptions);
|
|
149
149
|
} catch {
|
|
150
|
-
//
|
|
150
|
+
// ignore any deletion errors
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fa-mcp-sdk",
|
|
3
3
|
"productName": "FA MCP SDK",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.204",
|
|
5
5
|
"description": "Core infrastructure and templates for building Model Context Protocol (MCP) servers with TypeScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/core/index.js",
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* An example of extending the fa-mcp-sdk configuration with a custom settings block.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* (
|
|
4
|
+
* This file demonstrates how to add your own settings
|
|
5
|
+
* (for example, to check the user's membership in an AEC group).
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { AppConfig } from '../../core/index.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* AD Group Membership Verification Settings
|
|
12
12
|
*/
|
|
13
13
|
export interface IGroupAccessConfig {
|
|
14
14
|
groupAccess: {
|
|
15
|
-
/** AD
|
|
15
|
+
/** AD Group whose membership is required for access */
|
|
16
16
|
requiredGroup: string;
|
|
17
17
|
|
|
18
|
-
/**
|
|
18
|
+
/** Optional: Allow access without checking the group (for debugging) */
|
|
19
19
|
bypassGroupCheck?: boolean;
|
|
20
20
|
|
|
21
|
-
/**
|
|
21
|
+
/** Optional: cache the result of the check (seconds) */
|
|
22
22
|
cacheTtlSeconds?: number;
|
|
23
23
|
|
|
24
|
-
/**
|
|
24
|
+
/** Optional: List of groups with different access levels */
|
|
25
25
|
accessLevels?: {
|
|
26
|
-
/**
|
|
26
|
+
/** Full access group (read/write) */
|
|
27
27
|
fullAccess?: string;
|
|
28
|
-
/**
|
|
28
|
+
/** Read-only group */
|
|
29
29
|
readOnly?: string;
|
|
30
|
-
/**
|
|
30
|
+
/** Administrators group */
|
|
31
31
|
admin?: string;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Extended app config with group checking settings
|
|
38
38
|
*/
|
|
39
39
|
export interface CustomAppConfig extends AppConfig, IGroupAccessConfig {}
|
|
40
40
|
|
|
41
41
|
// ========================================================================
|
|
42
|
-
//
|
|
42
|
+
// YAML CONFIGURATION EXAMPLE (config/default.yaml)
|
|
43
43
|
// ========================================================================
|
|
44
44
|
/*
|
|
45
45
|
groupAccess:
|
|
@@ -53,18 +53,18 @@ groupAccess:
|
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
55
|
// ========================================================================
|
|
56
|
-
//
|
|
56
|
+
// EXAMPLE OF USE IN CODE
|
|
57
57
|
// ========================================================================
|
|
58
58
|
/*
|
|
59
59
|
import { appConfig } from '../core/index.js';
|
|
60
60
|
|
|
61
|
-
//
|
|
61
|
+
// TYPED ACCESS TO CUSTOM SETTINGS
|
|
62
62
|
const config = appConfig as CustomAppConfig;
|
|
63
63
|
|
|
64
64
|
const requiredGroup = config.groupAccess.requiredGroup;
|
|
65
65
|
const shouldBypass = config.groupAccess.bypassGroupCheck;
|
|
66
66
|
|
|
67
|
-
//
|
|
67
|
+
// Checking the Access Level from Payload
|
|
68
68
|
function getUserAccessLevel(payload: { user: string; groups?: string[] }): 'admin' | 'full' | 'readonly' | 'none' {
|
|
69
69
|
const { accessLevels } = config.groupAccess;
|
|
70
70
|
const userGroups = payload.groups || [];
|