fa-mcp-sdk 0.2.146 → 0.2.182
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 +1 -1
- package/bin/fa-mcp.js +66 -54
- package/cli-template/.env.example +2 -2
- package/cli-template/{fa-mcp-sdk-spec.md → FA-MCP-SDK.md} +699 -42
- package/cli-template/README.md +2 -2
- package/cli-template/package.json +1 -1
- package/cli-template/r/TEST HTTP.xml +9 -0
- package/cli-template/{run/TEST SSE.run.xml → r/TEST SSE.xml } +2 -2
- package/cli-template/{run/TEST STDIO.run.xml → r/TEST STDIO.xml } +2 -2
- package/cli-template/r/generate-token.xml +14 -0
- package/cli-template/{run/kill-server.run.xml → r/kill-server.xml} +2 -2
- package/cli-template/{run/kill-token-gen-server.xml → r/remove-nul.xml} +4 -5
- package/{cli-template/config → config}/_local.yaml +28 -14
- package/{cli-template/config → config}/custom-environment-variables.yaml +3 -0
- package/{cli-template/config → config}/default.yaml +50 -10
- package/{cli-template/config → config}/development.yaml +4 -4
- package/config/local.yaml +89 -0
- package/{cli-template/config → config}/production.yaml +4 -4
- package/dist/core/_types_/active-directory-config.d.ts +3 -0
- package/dist/core/_types_/active-directory-config.d.ts.map +1 -1
- package/dist/core/_types_/config.d.ts +5 -1
- package/dist/core/_types_/config.d.ts.map +1 -1
- package/dist/core/_types_/types.d.ts +40 -1
- package/dist/core/_types_/types.d.ts.map +1 -1
- package/dist/core/ad/group-checker.d.ts +13 -0
- package/dist/core/ad/group-checker.d.ts.map +1 -0
- package/dist/core/ad/group-checker.js +86 -0
- package/dist/core/ad/group-checker.js.map +1 -0
- package/dist/core/auth/admin-auth.d.ts +16 -0
- package/dist/core/auth/admin-auth.d.ts.map +1 -0
- package/dist/core/auth/admin-auth.js +159 -0
- package/dist/core/auth/admin-auth.js.map +1 -0
- package/dist/core/auth/basic.d.ts +6 -0
- package/dist/core/auth/basic.d.ts.map +1 -0
- package/dist/core/auth/basic.js +26 -0
- package/dist/core/auth/basic.js.map +1 -0
- package/dist/core/auth/{jwt-validation.d.ts → jwt.d.ts} +4 -3
- package/dist/core/auth/jwt.d.ts.map +1 -0
- package/dist/core/auth/{jwt-validation.js → jwt.js} +9 -19
- package/dist/core/auth/jwt.js.map +1 -0
- package/dist/core/auth/middleware.d.ts.map +1 -1
- package/dist/core/auth/middleware.js +3 -3
- package/dist/core/auth/middleware.js.map +1 -1
- package/dist/core/auth/multi-auth.d.ts +14 -6
- package/dist/core/auth/multi-auth.d.ts.map +1 -1
- package/dist/core/auth/multi-auth.js +151 -141
- package/dist/core/auth/multi-auth.js.map +1 -1
- package/dist/core/auth/permanent.d.ts +6 -0
- package/dist/core/auth/permanent.d.ts.map +1 -0
- package/dist/core/auth/permanent.js +15 -0
- package/dist/core/auth/permanent.js.map +1 -0
- package/dist/core/auth/token-generator/ntlm/ntlm-domain-config.d.ts +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-domain-config.d.ts.map +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-domain-config.js +8 -10
- package/dist/core/auth/token-generator/ntlm/ntlm-domain-config.js.map +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-integration.d.ts.map +1 -1
- package/dist/core/auth/token-generator/ntlm/ntlm-integration.js +9 -2
- package/dist/core/auth/token-generator/ntlm/ntlm-integration.js.map +1 -1
- package/dist/core/auth/token-generator/server.d.ts.map +1 -1
- package/dist/core/auth/token-generator/server.js +59 -25
- package/dist/core/auth/token-generator/server.js.map +1 -1
- package/dist/core/auth/types.d.ts +4 -3
- package/dist/core/auth/types.d.ts.map +1 -1
- package/dist/core/bootstrap/startup-info.d.ts.map +1 -1
- package/dist/core/bootstrap/startup-info.js +19 -0
- package/dist/core/bootstrap/startup-info.js.map +1 -1
- package/dist/core/consul/access-points-updater.js +1 -1
- package/dist/core/consul/access-points-updater.js.map +1 -1
- package/dist/core/consul/get-consul-api.d.ts +1 -1
- package/dist/core/consul/get-consul-api.d.ts.map +1 -1
- package/dist/core/consul/get-consul-api.js +1 -1
- package/dist/core/consul/get-consul-api.js.map +1 -1
- package/dist/core/consul/register.d.ts +1 -1
- package/dist/core/consul/register.d.ts.map +1 -1
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/init-mcp-server.d.ts.map +1 -1
- package/dist/core/init-mcp-server.js +1 -1
- package/dist/core/init-mcp-server.js.map +1 -1
- package/dist/core/utils/testing/McpSseClient.js.map +1 -1
- package/dist/core/web/admin-router.d.ts +10 -0
- package/dist/core/web/admin-router.d.ts.map +1 -0
- package/dist/core/web/admin-router.js +309 -0
- package/dist/core/web/admin-router.js.map +1 -0
- package/dist/core/web/favicon-svg.d.ts +1 -1
- package/dist/core/web/favicon-svg.d.ts.map +1 -1
- package/dist/core/web/favicon-svg.js +21 -3
- package/dist/core/web/favicon-svg.js.map +1 -1
- package/dist/core/web/home-api.d.ts +7 -0
- package/dist/core/web/home-api.d.ts.map +1 -0
- package/dist/core/web/home-api.js +106 -0
- package/dist/core/web/home-api.js.map +1 -0
- package/dist/core/web/server-http.d.ts +1 -0
- package/dist/core/web/server-http.d.ts.map +1 -1
- package/dist/core/web/server-http.js +60 -25
- package/dist/core/web/server-http.js.map +1 -1
- package/dist/core/web/static/home/index.html +218 -0
- package/dist/core/web/static/home/script.js +643 -0
- package/dist/core/web/{about-page/css.js → static/styles.css} +435 -105
- package/dist/core/web/static/token-gen/index.html +105 -0
- package/dist/core/web/static/token-gen/jwt-icon.svg +3 -0
- package/dist/core/web/static/token-gen/logout.svg +4 -0
- package/dist/core/web/static/token-gen/script.js +553 -0
- package/dist/core/web/static/token-gen/user.svg +4 -0
- package/dist/core/web/svg-icons.d.ts +7 -0
- package/dist/core/web/svg-icons.d.ts.map +1 -0
- package/dist/core/web/svg-icons.js +78 -0
- package/dist/core/web/svg-icons.js.map +1 -0
- package/package.json +7 -3
- package/scripts/copy-static.js +31 -0
- package/src/template/_types_/custom-config.ts +83 -0
- package/src/template/asset/logo.svg +4 -0
- package/src/template/start.ts +3 -3
- package/src/template/tools/handle-tool-call.ts +2 -1
- package/src/tests/mcp/test-http.js +10 -2
- package/src/tests/mcp/test-sse.js +10 -2
- package/src/tests/mcp/test-stdio.js +1 -2
- package/cli-template/run/TEST HTTP.run.xml +0 -5
- package/cli-template/run/TEST search.run.xml +0 -11
- package/cli-template/run/remove-nul.js.run.xml +0 -5
- package/dist/core/auth/jwt-validation.d.ts.map +0 -1
- package/dist/core/auth/jwt-validation.js.map +0 -1
- package/dist/core/auth/token-generator/html.d.ts +0 -9
- package/dist/core/auth/token-generator/html.d.ts.map +0 -1
- package/dist/core/auth/token-generator/html.js +0 -862
- package/dist/core/auth/token-generator/html.js.map +0 -1
- package/dist/core/web/about-page/css.d.ts +0 -2
- package/dist/core/web/about-page/css.d.ts.map +0 -1
- package/dist/core/web/about-page/css.js.map +0 -1
- package/dist/core/web/about-page/render.d.ts +0 -2
- package/dist/core/web/about-page/render.d.ts.map +0 -1
- package/dist/core/web/about-page/render.js +0 -773
- package/dist/core/web/about-page/render.js.map +0 -1
- package/src/template/_examples/multi-auth-examples.ts +0 -541
- /package/cli-template/{run/== START ==.run.xml → r/== START ==.xml} +0 -0
- /package/cli-template/{run/cb.run.xml → r/cb.xml} +0 -0
- /package/cli-template/{run/ci.run.xml → r/ci.xml} +0 -0
- /package/cli-template/{run/lint.run.xml → r/lint.xml} +0 -0
- /package/cli-template/{run/lint_fix.run.xml → r/lint_fix.xml} +0 -0
- /package/cli-template/{run/reinstall.run.xml → r/reinstall.xml} +0 -0
- /package/{cli-template/config → config}/test.yaml +0 -0
- /package/{src/template/asset/favicon.svg → dist/core/web/static/logo.svg} +0 -0
- /package/{cli-template/scripts → scripts}/kill-port.js +0 -0
- /package/{cli-template/scripts → scripts}/npm/patch_node_modules.js +0 -0
- /package/{cli-template/scripts → scripts}/npm/run.js +0 -0
- /package/{cli-template/scripts → scripts}/npm/yarn-ci.ps1 +0 -0
- /package/{cli-template/scripts → scripts}/npm/yarn-ci.sh +0 -0
- /package/{cli-template/scripts → scripts}/npm/yarn-reinstall.ps1 +0 -0
- /package/{cli-template/scripts → scripts}/npm/yarn-reinstall.sh +0 -0
- /package/{cli-template/scripts → scripts}/pre-commit +0 -0
- /package/{cli-template/scripts → scripts}/remove-nul.js +0 -0
package/README.md
CHANGED
|
@@ -174,7 +174,7 @@ npm start
|
|
|
174
174
|
|
|
175
175
|
Provides endpoints:
|
|
176
176
|
|
|
177
|
-
- `GET /` -
|
|
177
|
+
- `GET /` - Home page with server info
|
|
178
178
|
- `GET /health` - Health check
|
|
179
179
|
- `GET /sse` - Server-Sent Events for MCP communication
|
|
180
180
|
- `POST /mcp` - Direct MCP JSON-RPC endpoint
|
package/bin/fa-mcp.js
CHANGED
|
@@ -46,6 +46,7 @@ const ALLOWED_FILES = [
|
|
|
46
46
|
'__misc',
|
|
47
47
|
'_tmp',
|
|
48
48
|
'~last-cli-config.json',
|
|
49
|
+
'yarn.lock',
|
|
49
50
|
];
|
|
50
51
|
|
|
51
52
|
const getAsk = () => {
|
|
@@ -227,6 +228,11 @@ class MCPGenerator {
|
|
|
227
228
|
defaultValue: '***',
|
|
228
229
|
title: 'Token for registering service with Consul agent',
|
|
229
230
|
},
|
|
231
|
+
{
|
|
232
|
+
name: 'consul.agent.reg.host',
|
|
233
|
+
defaultValue: '',
|
|
234
|
+
title: 'The host of the consul agent where the service will be registered',
|
|
235
|
+
},
|
|
230
236
|
{
|
|
231
237
|
name: 'consul.envCode.dev',
|
|
232
238
|
defaultValue: '<envCode.dev>',
|
|
@@ -730,6 +736,9 @@ certificate's public and private keys`,
|
|
|
730
736
|
|
|
731
737
|
async copyDirectory (source, target) {
|
|
732
738
|
const entries = await fs.readdir(source, { withFileTypes: true });
|
|
739
|
+
if (!fss.existsSync(target)) {
|
|
740
|
+
await fs.mkdir(target, { recursive: true });
|
|
741
|
+
}
|
|
733
742
|
|
|
734
743
|
for (const entry of entries) {
|
|
735
744
|
if (entry.name === 'node_modules' || entry.name === 'dist') {
|
|
@@ -845,6 +854,10 @@ certificate's public and private keys`,
|
|
|
845
854
|
content = content.replace(/http:\/\/localhost:9876/g, `http://localhost:${config.port}`);
|
|
846
855
|
modified = true;
|
|
847
856
|
}
|
|
857
|
+
if (filePath.endsWith('test-stdio.js')) {
|
|
858
|
+
content = content.replace('../dist/template/start.js', 'dist/src/start.js');
|
|
859
|
+
modified = true;
|
|
860
|
+
}
|
|
848
861
|
|
|
849
862
|
if (modified) {
|
|
850
863
|
await fs.writeFile(filePath, content, 'utf8');
|
|
@@ -854,40 +867,14 @@ certificate's public and private keys`,
|
|
|
854
867
|
await this.transformTargetFile(config, '.env', (c) => c.replace(/^(NODE_CONSUL_ENV)=([^\r\n]*)/m, '#$1=$2'));
|
|
855
868
|
}
|
|
856
869
|
if (config['claude.isBypassPermissions'] === 'true') {
|
|
870
|
+
const c1 = ['sudo cp', 'sudo', 'bash', 'chmod', 'curl', 'dir', 'echo', 'git', 'find', 'grep', 'jest',
|
|
871
|
+
'mkdir', 'node', 'npm install', 'npm run', 'npm test', 'npm', 'npx', 'pkill', 'set', 'playwright', 'powershell',
|
|
872
|
+
'rm', 'taskkill', 'tasklist', 'timeout', 'turbo run', 'wc'];
|
|
873
|
+
const c2 = ['jobs', 'npm start', 'unset http_proxy'];
|
|
874
|
+
const i = ' '.repeat(8);
|
|
875
|
+
const allowBashLines = [...c1.map((c) => `${i}"Bash(${c}:*)",`), ...c2.map((c) => `${i}"Bash(${c})",`)].join('\n');
|
|
857
876
|
const transformFn = (c) => c.replace('"acceptEdits"', '"bypassPermissions"')
|
|
858
|
-
.replace(/"allow": \[\s+"Edit",/, `"allow": [
|
|
859
|
-
"Bash(sudo cp:*)",
|
|
860
|
-
"Bash(sudo:*)",
|
|
861
|
-
"Bash(bash:*)",
|
|
862
|
-
"Bash(chmod:*)",
|
|
863
|
-
"Bash(curl:*)",
|
|
864
|
-
"Bash(dir:*)",
|
|
865
|
-
"Bash(echo:*)",
|
|
866
|
-
"Bash(git:*)",
|
|
867
|
-
"Bash(find:*)",
|
|
868
|
-
"Bash(grep:*)",
|
|
869
|
-
"Bash(jest:*)",
|
|
870
|
-
"Bash(jobs)",
|
|
871
|
-
"Bash(mkdir:*)",
|
|
872
|
-
"Bash(node:*)",
|
|
873
|
-
"Bash(npm install:*)",
|
|
874
|
-
"Bash(npm run:*)",
|
|
875
|
-
"Bash(npm start)",
|
|
876
|
-
"Bash(npm test:*)",
|
|
877
|
-
"Bash(npm:*)",
|
|
878
|
-
"Bash(npx:*)",
|
|
879
|
-
"Bash(pkill:*)",
|
|
880
|
-
"Bash(set:*)",
|
|
881
|
-
"Bash(playwright:*)",
|
|
882
|
-
"Bash(powershell:*)",
|
|
883
|
-
"Bash(rm:*)",
|
|
884
|
-
"Bash(taskkill:*)",
|
|
885
|
-
"Bash(tasklist:*)",
|
|
886
|
-
"Bash(timeout:*)",
|
|
887
|
-
"Bash(turbo run:*)",
|
|
888
|
-
"Bash(unset http_proxy)",
|
|
889
|
-
"Bash(wc:*)",
|
|
890
|
-
"Edit",`);
|
|
877
|
+
.replace(/"allow": \[\s+"Edit",/, `"allow": [\n${allowBashLines}\n${i}"Edit",`);
|
|
891
878
|
await this.transformTargetFile(config, '.claude/settings.json', transformFn);
|
|
892
879
|
}
|
|
893
880
|
}
|
|
@@ -897,12 +884,32 @@ certificate's public and private keys`,
|
|
|
897
884
|
// Copy template files
|
|
898
885
|
await this.copyDirectory(path.join(PROJ_ROOT, 'cli-template'), targetPath);
|
|
899
886
|
await this.copyDirectory(path.join(PROJ_ROOT, 'src/template'), path.join(targetPath, 'src'));
|
|
900
|
-
|
|
901
|
-
|
|
887
|
+
|
|
888
|
+
const testsTargetPath = path.join(targetPath, 'tests');
|
|
889
|
+
|
|
902
890
|
await this.copyDirectory(path.join(PROJ_ROOT, 'src/tests'), testsTargetPath);
|
|
903
891
|
await fs.copyFile(path.join(targetPath, '.env.example'), path.join(targetPath, '.env'));
|
|
904
892
|
await fs.rename(path.join(targetPath, 'gitignore'), path.join(targetPath, '.gitignore'));
|
|
905
|
-
await fs.rename(path.join(targetPath, '
|
|
893
|
+
await fs.rename(path.join(targetPath, 'r'), path.join(targetPath, '.run'));
|
|
894
|
+
|
|
895
|
+
await this.copyDirectory(path.join(PROJ_ROOT, 'config'), path.join(targetPath, 'config'));
|
|
896
|
+
|
|
897
|
+
const scriptsTargetPath = path.join(targetPath, 'scripts');
|
|
898
|
+
await this.copyDirectory(path.join(PROJ_ROOT, 'scripts'), scriptsTargetPath);
|
|
899
|
+
await fs.rm(path.join(targetPath, 'scripts/copy-static.js'), { force: true });
|
|
900
|
+
|
|
901
|
+
// Rename all .xml files in .run directory to .run.xml
|
|
902
|
+
const runDirPath = path.join(targetPath, '.run');
|
|
903
|
+
const files = await fs.readdir(runDirPath);
|
|
904
|
+
|
|
905
|
+
for (const file of files) {
|
|
906
|
+
if (file.endsWith('.xml')) {
|
|
907
|
+
const oldFilePath = path.join(runDirPath, file);
|
|
908
|
+
const newFileName = file.slice(0, -4) + '.run.xml';
|
|
909
|
+
const newFilePath = path.join(runDirPath, newFileName);
|
|
910
|
+
await fs.rename(oldFilePath, newFilePath);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
906
913
|
|
|
907
914
|
// Rename mcp-template.com.conf if mcp.domain is provided
|
|
908
915
|
const mcpDomain = config['mcp.domain'];
|
|
@@ -920,15 +927,13 @@ certificate's public and private keys`,
|
|
|
920
927
|
}
|
|
921
928
|
|
|
922
929
|
// Read _local.yaml into memory and rename it to local.yaml
|
|
923
|
-
let
|
|
930
|
+
let localYamlExampleContent = '';
|
|
931
|
+
const localYamlExamplePath = path.join(targetPath, 'config', '_local.yaml');
|
|
932
|
+
const localYamlPath = path.join(targetPath, 'config', 'local.yaml');
|
|
924
933
|
try {
|
|
925
|
-
const localYamlPath = path.join(targetPath, 'config', '_local.yaml');
|
|
926
|
-
const localYamlNewPath = path.join(targetPath, 'config', 'local.yaml');
|
|
927
934
|
|
|
928
|
-
|
|
929
|
-
await fs.rename(localYamlPath, localYamlNewPath);
|
|
935
|
+
localYamlExampleContent = await fs.readFile(localYamlExamplePath, 'utf8');
|
|
930
936
|
} catch (error) {
|
|
931
|
-
// _local.yaml doesn't exist, which might be fine
|
|
932
937
|
console.log('⚠️ Warning: Could not process config/_local.yaml file:', error.message);
|
|
933
938
|
}
|
|
934
939
|
|
|
@@ -936,35 +941,40 @@ certificate's public and private keys`,
|
|
|
936
941
|
await this.replaceTemplateParameters(config);
|
|
937
942
|
|
|
938
943
|
// Replace template placeholders with defaultValue from optionalParams and save as _local.yaml
|
|
939
|
-
if (
|
|
944
|
+
if (localYamlExampleContent) {
|
|
940
945
|
try {
|
|
941
|
-
let
|
|
942
|
-
|
|
946
|
+
let localYamlExampleModifiedContent = localYamlExampleContent;
|
|
947
|
+
let localYamlModifiedContent = localYamlExampleContent;
|
|
943
948
|
// Replace with defaultValue from optionalParams
|
|
944
949
|
for (const param of this.optionalParams) {
|
|
945
950
|
const template = `{{${param.name}}}`;
|
|
946
|
-
if (
|
|
951
|
+
if (localYamlExampleModifiedContent.includes(template)) {
|
|
947
952
|
const defaultValue = param.defaultValue || '';
|
|
948
|
-
|
|
953
|
+
localYamlExampleModifiedContent = localYamlExampleModifiedContent.replace(new RegExp(escapeRegExp(template), 'g'), defaultValue);
|
|
949
954
|
}
|
|
950
955
|
}
|
|
956
|
+
|
|
951
957
|
// Replacement of the remaining substitution places with what is in the config
|
|
952
958
|
for (const [paramName, value] of Object.entries(config)) {
|
|
953
959
|
const template = `{{${paramName}}}`;
|
|
954
|
-
if (
|
|
955
|
-
|
|
960
|
+
if (localYamlExampleModifiedContent.includes(template)) {
|
|
961
|
+
localYamlExampleModifiedContent = localYamlExampleModifiedContent.replace(new RegExp(escapeRegExp(template), 'g'), value);
|
|
962
|
+
}
|
|
963
|
+
if (localYamlModifiedContent.includes(template)) {
|
|
964
|
+
localYamlModifiedContent = localYamlModifiedContent.replace(new RegExp(escapeRegExp(template), 'g'), value);
|
|
956
965
|
}
|
|
957
966
|
}
|
|
967
|
+
if (!config['consul.agent.reg.host']) {
|
|
968
|
+
localYamlModifiedContent = localYamlModifiedContent.replace(/(\n +)host: '[^']*'( # The host of the consul agent)/, '$1# host: \'\'$2');
|
|
969
|
+
}
|
|
958
970
|
|
|
959
|
-
|
|
960
|
-
await fs.writeFile(
|
|
971
|
+
await fs.writeFile(localYamlPath, localYamlModifiedContent, 'utf8');
|
|
972
|
+
await fs.writeFile(localYamlExamplePath, localYamlExampleModifiedContent, 'utf8');
|
|
961
973
|
} catch (error) {
|
|
962
974
|
console.log('⚠️ Warning: Could not create config/_local.yaml file:', error.message);
|
|
963
975
|
}
|
|
964
976
|
}
|
|
965
977
|
const pathsToRemove = [
|
|
966
|
-
{ rel: 'node_modules' },
|
|
967
|
-
{ rel: 'yarn.lock' },
|
|
968
978
|
{ rel: 'package-lock.json' },
|
|
969
979
|
];
|
|
970
980
|
|
|
@@ -994,7 +1004,9 @@ certificate's public and private keys`,
|
|
|
994
1004
|
process.exit(0);
|
|
995
1005
|
|
|
996
1006
|
} catch (error) {
|
|
997
|
-
|
|
1007
|
+
if (error.message && !(error.stack || '').includes(String(error.message))) {
|
|
1008
|
+
console.error('\n❌ Error:', error.message);
|
|
1009
|
+
}
|
|
998
1010
|
console.error(error.stack);
|
|
999
1011
|
process.exit(1);
|
|
1000
1012
|
}
|
|
@@ -16,8 +16,8 @@ DEBUG=config-info
|
|
|
16
16
|
|
|
17
17
|
## DEBUG patterns ##
|
|
18
18
|
# AP-UPDATER - consul/access-points-updater
|
|
19
|
-
#
|
|
20
|
-
#
|
|
19
|
+
# fa-consul:reg | fa-consul:* - consul/cyclic-register
|
|
20
|
+
# fa-consul:curl - consul/prepare-consul-api
|
|
21
21
|
# token:auth
|
|
22
22
|
|
|
23
23
|
# The address of the mcp server for testing. Default: http://localhost:<config.webServer.port>
|