fa-mcp-sdk 0.2.198 → 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 +9 -2
- package/package.json +1 -1
- package/src/template/_types_/custom-config.ts +16 -16
package/bin/fa-mcp.js
CHANGED
|
@@ -32,6 +32,13 @@ const pjContent = fss.readFileSync(path.join(PROJ_ROOT, 'package.json'));
|
|
|
32
32
|
|
|
33
33
|
const faMcpSdkVersion = JSON.parse(pjContent).version;
|
|
34
34
|
|
|
35
|
+
// Print version and exit on -V or --version
|
|
36
|
+
const argv = process.argv.slice(2);
|
|
37
|
+
if (argv.includes('-V') || argv.includes('--version')) {
|
|
38
|
+
console.log(faMcpSdkVersion);
|
|
39
|
+
process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
const ALLOWED_FILES = [
|
|
36
43
|
'.git',
|
|
37
44
|
'.idea',
|
|
@@ -135,12 +142,12 @@ const removeIfExists = async (targetPath, relPath, options = {}) => {
|
|
|
135
142
|
finalOptions = { ...finalOptions, recursive: true };
|
|
136
143
|
}
|
|
137
144
|
} catch {
|
|
138
|
-
// lstat
|
|
145
|
+
// lstat will crash if there is no file/folder – that's ok, just go to rm with the same options
|
|
139
146
|
}
|
|
140
147
|
|
|
141
148
|
await fs.rm(fullPath, finalOptions);
|
|
142
149
|
} catch {
|
|
143
|
-
//
|
|
150
|
+
// ignore any deletion errors
|
|
144
151
|
}
|
|
145
152
|
};
|
|
146
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 || [];
|