fa-mcp-sdk 0.2.146 → 0.2.174
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/README.md +2 -2
- package/cli-template/fa-mcp-sdk-spec.md +122 -41
- package/cli-template/package.json +3 -3
- 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 +81 -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 +5 -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 +3 -1
- 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 +227 -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 +93 -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 +206 -0
- package/dist/core/web/static/home/script.js +636 -0
- package/dist/core/web/{about-page/css.js → static/styles.css} +435 -105
- package/dist/core/web/static/token-gen/index.html +82 -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 +365 -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/_examples/multi-auth-examples.ts +14 -47
- 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/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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Copy this file to local.yaml and update with your database credentials
|
|
2
2
|
# local.yaml is gitignored and won't be committed
|
|
3
3
|
---
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
ad:
|
|
5
|
+
domains:
|
|
6
|
+
MYDOMAIN:
|
|
7
|
+
default: true
|
|
8
|
+
controllers:
|
|
9
|
+
- 'ldap://c1.corp.com'
|
|
10
|
+
- 'ldap://c2.corp.com'
|
|
11
|
+
username: '***'
|
|
12
|
+
password: '***'
|
|
13
13
|
|
|
14
14
|
# --------------------------------------------------
|
|
15
15
|
# CACHING Reduces API calls by caching responses
|
|
@@ -30,7 +30,7 @@ consul:
|
|
|
30
30
|
# Token for obtaining information about PROD services
|
|
31
31
|
token: '{{consul.agent.prd.token}}'
|
|
32
32
|
reg:
|
|
33
|
-
|
|
33
|
+
host: '{{consul.agent.reg.host}}' # The host of the consul agent where the service will be registered. If not specified, the server on which the service is running is used
|
|
34
34
|
# Token for registering the service in the consul agent
|
|
35
35
|
token: '{{consul.agent.reg.token}}'
|
|
36
36
|
service:
|
|
@@ -67,14 +67,14 @@ mcp:
|
|
|
67
67
|
windowMs: 60000 # 1 minute
|
|
68
68
|
|
|
69
69
|
swagger:
|
|
70
|
-
servers:
|
|
70
|
+
servers: # An array of servers that will be added to swagger docs
|
|
71
71
|
- url: http://localhost:{{port}}
|
|
72
72
|
description: "Local server"
|
|
73
73
|
|
|
74
74
|
webServer:
|
|
75
75
|
port: {{port}}
|
|
76
76
|
# array of hosts that CORS skips
|
|
77
|
-
originHosts: ['localhost', '0.0.0.0']
|
|
77
|
+
originHosts: [ 'localhost', '0.0.0.0' ]
|
|
78
78
|
# Authentication is configured here only when accessing the MCP server
|
|
79
79
|
# Authentication in services that enable tools, resources, and prompts
|
|
80
80
|
# is implemented more deeply. To do this, you need to use the information passed in HTTP headers
|
|
@@ -89,7 +89,8 @@ webServer:
|
|
|
89
89
|
# To enable this authentication, you need to set auth.enabled = true
|
|
90
90
|
# and set one token of at least 20 characters in length
|
|
91
91
|
# ========================================================================
|
|
92
|
-
permanentServerTokens: []
|
|
92
|
+
permanentServerTokens: [ ] # Add your server tokens here: ['token1', 'token2']
|
|
93
|
+
|
|
93
94
|
# ========================================================================
|
|
94
95
|
# JWT TOKEN WITH SYMMETRIC ENCRYPTION
|
|
95
96
|
# Custom JWT tokens with AES-256 encryption
|
|
@@ -99,10 +100,11 @@ webServer:
|
|
|
99
100
|
# encryptKey to at least 20 characters
|
|
100
101
|
# ========================================================================
|
|
101
102
|
jwtToken:
|
|
102
|
-
# Symmetric encryption key to generate a token for this MCP
|
|
103
|
+
# Symmetric encryption key to generate a token for this MCP (minimum 8 chars)
|
|
103
104
|
encryptKey: '{{webServer.auth.token.encryptKey}}'
|
|
104
105
|
# If webServer.auth.enabled and the parameter true, the service name and the service specified in the token will be checked
|
|
105
106
|
checkMCPName: {{webServer.auth.token.checkMCPName}}
|
|
107
|
+
|
|
106
108
|
# ========================================================================
|
|
107
109
|
# Basic Authentication - Base64 encoded username:password
|
|
108
110
|
# CPU cost: Medium - Base64 decoding + string comparison
|
|
@@ -112,3 +114,15 @@ webServer:
|
|
|
112
114
|
basic:
|
|
113
115
|
username: ''
|
|
114
116
|
password: '***'
|
|
117
|
+
|
|
118
|
+
# ========================================================================
|
|
119
|
+
# ADMIN PANEL AUTHENTICATION
|
|
120
|
+
# Token generation page available at /admin endpoint
|
|
121
|
+
# Supports 4 authentication methods: permanentServerTokens, basic, jwtToken, ntlm
|
|
122
|
+
# ========================================================================
|
|
123
|
+
adminAuth:
|
|
124
|
+
enabled: false # Enable/disable admin panel
|
|
125
|
+
# Authentication type for admin panel: 'permanentServerTokens' | 'basic' | 'jwtToken' | 'ntlm'
|
|
126
|
+
# For permanentServerTokens, basic, jwtToken - uses credentials from webServer.auth section
|
|
127
|
+
# For ntlm - uses AD configuration from ad.domains section (no additional credentials needed)
|
|
128
|
+
type: 'basic'
|
|
@@ -9,6 +9,31 @@
|
|
|
9
9
|
# noConsul: true # Use if the service developers do not provide registration in consul
|
|
10
10
|
# consulServiceName: <consulServiceName>
|
|
11
11
|
|
|
12
|
+
ad:
|
|
13
|
+
# Active Directory / LDAP settings.
|
|
14
|
+
# Used for authentication/authorization (e.g., NTLM in admin panel) and checking user membership in AD groups.
|
|
15
|
+
domains:
|
|
16
|
+
# Map of domains. Key is a domain name
|
|
17
|
+
MYDOMAIN:
|
|
18
|
+
# Marks this domain as default one
|
|
19
|
+
default: true
|
|
20
|
+
# List of LDAP controllers (can be multiple for failover).
|
|
21
|
+
# Use ldap:// for plain LDAP or ldaps:// for LDAP over TLS.
|
|
22
|
+
controllers:
|
|
23
|
+
- 'ldap://c1.corp.com'
|
|
24
|
+
- 'ldap://c2.corp.com'
|
|
25
|
+
# Service account (bind DN or username) used to connect to LDAP.
|
|
26
|
+
username: '***'
|
|
27
|
+
# Service account password.
|
|
28
|
+
password: '***'
|
|
29
|
+
# Base DN for LDAP searches. Auto-derived from controller URL if not set.
|
|
30
|
+
# baseDn: 'DC=corp,DC=com'
|
|
31
|
+
# Cache TTL for group membership checks (default: 600000 = 10 min)
|
|
32
|
+
# groupCacheTtlMs: 600000
|
|
33
|
+
# Cache TTL for user/group DN lookups (default: 86400000 = 24 hours)
|
|
34
|
+
# dnCacheTtlMs: 86400000
|
|
35
|
+
|
|
36
|
+
# ... existing code ...
|
|
12
37
|
# --------------------------------------------------
|
|
13
38
|
# CACHING Reduces API calls by caching responses
|
|
14
39
|
# --------------------------------------------------
|
|
@@ -17,6 +42,9 @@ cache:
|
|
|
17
42
|
ttlSeconds: 300
|
|
18
43
|
# Default maximum number of cached items
|
|
19
44
|
maxItems: 1000
|
|
45
|
+
# time in seconds to check all data and delete expired keys
|
|
46
|
+
checkPeriod: 1200
|
|
47
|
+
|
|
20
48
|
|
|
21
49
|
consul:
|
|
22
50
|
check:
|
|
@@ -54,13 +82,13 @@ consul:
|
|
|
54
82
|
instance: '{{SERVICE_INSTANCE}}' # This value will be specified as a suffix in the id of the service
|
|
55
83
|
version: <version> # <version> will be replaced by <package.json>.version at initialization
|
|
56
84
|
description: <description> # <description> will be replaced by <package.json>.description at initialization
|
|
57
|
-
tags: [] # If null or empty array - Will be pulled up from package.keywords at initialization
|
|
85
|
+
tags: [ ] # If null or empty array - Will be pulled up from package.keywords at initialization
|
|
58
86
|
meta:
|
|
59
|
-
# "
|
|
87
|
+
# "Home" page link template
|
|
60
88
|
who: 'http://{address}:{port}/'
|
|
61
89
|
envCode: # Used to generate the service ID
|
|
62
|
-
prod: {{consul.envCode.prod}} # Production environment code
|
|
63
|
-
dev: {{consul.envCode.dev}} # Development environment code
|
|
90
|
+
prod: '{{consul.envCode.prod}}' # Production environment code
|
|
91
|
+
dev: '{{consul.envCode.dev}}' # Development environment code
|
|
64
92
|
|
|
65
93
|
db:
|
|
66
94
|
postgres:
|
|
@@ -72,7 +100,7 @@ db:
|
|
|
72
100
|
database: <database>
|
|
73
101
|
user: <user>
|
|
74
102
|
password: <password>
|
|
75
|
-
usedExtensions: []
|
|
103
|
+
usedExtensions: [ ]
|
|
76
104
|
|
|
77
105
|
logger:
|
|
78
106
|
level: info
|
|
@@ -91,10 +119,10 @@ mcp:
|
|
|
91
119
|
windowMs: 60000 # 1 minute
|
|
92
120
|
|
|
93
121
|
swagger:
|
|
94
|
-
servers:
|
|
95
|
-
# - url: http://localhost:
|
|
122
|
+
servers: # An array of servers that will be added to swagger docs
|
|
123
|
+
# - url: http://localhost:{{port}}
|
|
96
124
|
# description: "Development server (localhost)"
|
|
97
|
-
# - url: http://0.0.0.0:
|
|
125
|
+
# - url: http://0.0.0.0:{{port}}
|
|
98
126
|
# description: "Development server (all interfaces)"
|
|
99
127
|
# - url: http://<prod_server_host_or_ip>:{{port}}
|
|
100
128
|
# description: "PROD server"
|
|
@@ -102,14 +130,14 @@ swagger:
|
|
|
102
130
|
description: "PROD server"
|
|
103
131
|
|
|
104
132
|
uiColor:
|
|
105
|
-
# Font color of the header and a number of interface elements on the
|
|
133
|
+
# Font color of the header and a number of interface elements on the HOME page
|
|
106
134
|
primary: '#0f65dc'
|
|
107
135
|
|
|
108
136
|
webServer:
|
|
109
137
|
host: '0.0.0.0'
|
|
110
138
|
port: {{port}}
|
|
111
139
|
# array of hosts that CORS skips
|
|
112
|
-
originHosts: ['localhost', '0.0.0.0']
|
|
140
|
+
originHosts: [ 'localhost', '0.0.0.0' ]
|
|
113
141
|
# Authentication is configured here only when accessing the MCP server
|
|
114
142
|
# Authentication in services that enable tools, resources, and prompts
|
|
115
143
|
# is implemented more deeply. To do this, you need to use the information passed in HTTP headers
|
|
@@ -149,3 +177,15 @@ webServer:
|
|
|
149
177
|
basic:
|
|
150
178
|
username: ''
|
|
151
179
|
password: '***'
|
|
180
|
+
|
|
181
|
+
# ========================================================================
|
|
182
|
+
# ADMIN PANEL AUTHENTICATION
|
|
183
|
+
# Token generation page available at /admin endpoint
|
|
184
|
+
# Supports 4 authentication methods: permanentServerTokens, basic, jwtToken, ntlm
|
|
185
|
+
# ========================================================================
|
|
186
|
+
adminAuth:
|
|
187
|
+
enabled: false # Enable/disable admin panel
|
|
188
|
+
# Authentication type for admin panel: 'permanentServerTokens' | 'basic' | 'jwtToken' | 'ntlm'
|
|
189
|
+
# For permanentServerTokens, basic, jwtToken - uses credentials from webServer.auth section
|
|
190
|
+
# For ntlm - uses AD configuration from ad.domains section (no additional credentials needed)
|
|
191
|
+
type: 'basic'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
ad:
|
|
2
|
+
domains:
|
|
3
|
+
OFFICE:
|
|
4
|
+
controllers:
|
|
5
|
+
- 'ldap://prdc1.office.finam.ru'
|
|
6
|
+
- 'ldap://prdc2.office.finam.ru'
|
|
7
|
+
default: true
|
|
8
|
+
password: International2025%
|
|
9
|
+
username: aite01-ldap-s
|
|
10
|
+
WTE:
|
|
11
|
+
controllers:
|
|
12
|
+
- 'ldap://prdc1.corp.whotrades.eu'
|
|
13
|
+
- 'ldap://prdc2.corp.whotrades.eu'
|
|
14
|
+
password: International2025%
|
|
15
|
+
username: aite01-ldap-s
|
|
16
|
+
|
|
17
|
+
consul:
|
|
18
|
+
agent:
|
|
19
|
+
dev:
|
|
20
|
+
dc: 'dc-dev'
|
|
21
|
+
host: 'consul.entapp.work'
|
|
22
|
+
token: db56c39b-4b3f-f995-f2e6-6b7c5ab76fa8
|
|
23
|
+
prd:
|
|
24
|
+
dc: 'dc-prd'
|
|
25
|
+
host: 'consul.entapp.work'
|
|
26
|
+
token: 4701c873-9af3-e9a5-cd81-3a0184a5d898
|
|
27
|
+
reg:
|
|
28
|
+
host: MSK-AITE01-AP01.office.finam.ru
|
|
29
|
+
# host: MSK-AITR01-AP01.office.finam.ru
|
|
30
|
+
token: db56c39b-4b3f-f995-f2e6-6b7c5ab76fa8
|
|
31
|
+
service:
|
|
32
|
+
enable: true
|
|
33
|
+
instance: ws1170
|
|
34
|
+
envCode: # Used to generate the service ID
|
|
35
|
+
prod: aitr01
|
|
36
|
+
dev: aite01
|
|
37
|
+
|
|
38
|
+
db:
|
|
39
|
+
postgres:
|
|
40
|
+
dbs:
|
|
41
|
+
main:
|
|
42
|
+
database: slava
|
|
43
|
+
host: msk-aite01-ap01
|
|
44
|
+
port: 5432
|
|
45
|
+
user: csbot
|
|
46
|
+
password: yxxfdZwTAkpz
|
|
47
|
+
usedExtensions:
|
|
48
|
+
- pgvector
|
|
49
|
+
|
|
50
|
+
logger:
|
|
51
|
+
level: info
|
|
52
|
+
useFileLogger: false # To use or not to use logging to a file
|
|
53
|
+
dir: ''
|
|
54
|
+
|
|
55
|
+
mcp:
|
|
56
|
+
transportType: http # 'stdio' or 'http'
|
|
57
|
+
toolAnswerAs: text # text | structuredContent
|
|
58
|
+
|
|
59
|
+
swagger:
|
|
60
|
+
servers: # An array of servers that will be added to swagger docs
|
|
61
|
+
- url: http://localhost:9876
|
|
62
|
+
description: "Local server"
|
|
63
|
+
|
|
64
|
+
webServer:
|
|
65
|
+
port: 9876
|
|
66
|
+
auth:
|
|
67
|
+
enabled: true
|
|
68
|
+
# An array of fixed tokens that pass to the MCP (use only for MCPs with green data or for development)
|
|
69
|
+
# permanentServerTokens: ['test-perm-token']
|
|
70
|
+
jwtToken:
|
|
71
|
+
# Symmetric encryption key to generate a token for this MCP
|
|
72
|
+
encryptKey: '66666666-7777-8888-9999-000000000000'
|
|
73
|
+
# If webServer.auth.enabled and the parameter true, the service name and the service specified in the token will be checked
|
|
74
|
+
checkMCPName: true
|
|
75
|
+
basic:
|
|
76
|
+
username: vpupkin
|
|
77
|
+
password: '1'
|
|
78
|
+
|
|
79
|
+
adminAuth:
|
|
80
|
+
enabled: true
|
|
81
|
+
type: 'ntlm'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
---
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
@@ -7,6 +7,7 @@ export interface IDcConfig {
|
|
|
7
7
|
controllers: string[];
|
|
8
8
|
username: string;
|
|
9
9
|
password: string;
|
|
10
|
+
baseDn?: string;
|
|
10
11
|
default?: boolean;
|
|
11
12
|
name?: string;
|
|
12
13
|
hostReSource?: string;
|
|
@@ -19,6 +20,8 @@ export interface IADConfig {
|
|
|
19
20
|
};
|
|
20
21
|
tlsOptions?: ConnectionOptions;
|
|
21
22
|
strategy?: EAuthStrategy;
|
|
23
|
+
groupCacheTtlMs?: number;
|
|
24
|
+
dnCacheTtlMs?: number;
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
//# sourceMappingURL=active-directory-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-directory-config.d.ts","sourceRoot":"","sources":["../../../src/core/_types_/active-directory-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,SAAS;IAExB;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"active-directory-config.d.ts","sourceRoot":"","sources":["../../../src/core/_types_/active-directory-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,SAAS;IAExB;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IAEjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAKlB,IAAI,CAAC,EAAE,MAAM,CAAC;IAId,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE;QACF,OAAO,EAAE;YAEP,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;SACjC,CAAA;QACD,UAAU,CAAC,EAAE,iBAAiB,CAAC;QAC/B,QAAQ,CAAC,EAAE,aAAa,CAAC;QAEzB,eAAe,CAAC,EAAE,MAAM,CAAC;QAEzB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAA;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TFileLogLevel } from 'af-logger-ts';
|
|
2
2
|
import { IAFDatabasesConfig } from 'af-db-ts';
|
|
3
|
-
import { IAFConsulConfig, IAccessPoints } from '
|
|
3
|
+
import { IAFConsulConfig, IAccessPoints } from 'fa-consul';
|
|
4
4
|
import { IADConfig } from './active-directory-config.js';
|
|
5
5
|
interface IWebServerConfig {
|
|
6
6
|
webServer: {
|
|
@@ -19,6 +19,10 @@ interface IWebServerConfig {
|
|
|
19
19
|
};
|
|
20
20
|
permanentServerTokens: string[];
|
|
21
21
|
};
|
|
22
|
+
adminAuth: {
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
type: 'permanentServerTokens' | 'basic' | 'jwtToken' | 'ntlm';
|
|
25
|
+
};
|
|
22
26
|
};
|
|
23
27
|
}
|
|
24
28
|
interface ILoggerConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/core/_types_/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/core/_types_/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD,UAAU,gBAAgB;IACxB,SAA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ACb,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,cAAc;IAEd,YAAY,EAAE,OAAO,CAAC;IAEtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IAEpB,YAAY,EAAE,aAAa,CAAC;IAC5B,MAAM,EAAE,eAAe,GAAG;QACxB,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;YACb,GAAG,EAAE,MAAM,CAAC;SACb,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;KACjB,CAAA;CACF"}
|
|
@@ -55,6 +55,10 @@ export interface McpServerData {
|
|
|
55
55
|
name: string;
|
|
56
56
|
arguments?: any;
|
|
57
57
|
headers?: Record<string, string>;
|
|
58
|
+
payload?: {
|
|
59
|
+
user: string;
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
} | undefined;
|
|
58
62
|
}) => Promise<any>;
|
|
59
63
|
agentBrief: string;
|
|
60
64
|
agentPrompt: string;
|
|
@@ -68,7 +72,7 @@ export interface McpServerData {
|
|
|
68
72
|
swagger?: ISwaggerData | null;
|
|
69
73
|
};
|
|
70
74
|
assets?: {
|
|
71
|
-
|
|
75
|
+
logoSvg?: string;
|
|
72
76
|
maintainerHtml?: string;
|
|
73
77
|
};
|
|
74
78
|
getConsulUIAddress?: (serviceId: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/_types_/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,WA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AE,MAAM,GAAG,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GroupChecker } from 'af-ad-ts';
|
|
2
|
+
export interface IGroupCheckerInitResult {
|
|
3
|
+
isUserInGroup: (userSam: string, groupSam: string) => Promise<boolean>;
|
|
4
|
+
groupChecker: GroupChecker;
|
|
5
|
+
domainName: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Initializes AD Group Checker for checking user membership in AD groups.
|
|
9
|
+
* @param domainName - Optional domain name. Uses default domain if not specified.
|
|
10
|
+
* @throws Error if AD configuration is missing or incomplete
|
|
11
|
+
*/
|
|
12
|
+
export declare function initADGroupChecker(domainName?: string): IGroupCheckerInitResult;
|
|
13
|
+
//# sourceMappingURL=group-checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-checker.d.ts","sourceRoot":"","sources":["../../../src/core/ad/group-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,UAAU,CAAC;AAK7D,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACvE,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB;AAkCD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAE,UAAU,CAAC,EAAE,MAAM,GAAG,uBAAuB,CA6ChF"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { GroupChecker } from 'af-ad-ts';
|
|
2
|
+
import { appConfig } from '../bootstrap/init-config.js';
|
|
3
|
+
import { logger } from '../logger.js';
|
|
4
|
+
/**
|
|
5
|
+
* Derives baseDn from LDAP controller URL.
|
|
6
|
+
* Example: 'ldap://dc1.corp.company.com' -> 'DC=corp,DC=company,DC=com'
|
|
7
|
+
*/
|
|
8
|
+
function deriveBaseDnFromController(controllerUrl) {
|
|
9
|
+
const url = controllerUrl.replace(/^ldaps?:\/\//, '');
|
|
10
|
+
const parts = url.split('.').reverse().slice(0, 3).reverse();
|
|
11
|
+
return parts.map((v) => `DC=${v}`).join(',');
|
|
12
|
+
}
|
|
13
|
+
function getDefaultDomain() {
|
|
14
|
+
const domains = appConfig.ad?.domains;
|
|
15
|
+
if (!domains) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
for (const [name, config] of Object.entries(domains)) {
|
|
19
|
+
if (config.default) {
|
|
20
|
+
return { name, config };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const names = Object.keys(domains);
|
|
24
|
+
return names.length > 0 ? { name: names[0], config: domains[names[0]] } : undefined;
|
|
25
|
+
}
|
|
26
|
+
function validateConfig(config, domain) {
|
|
27
|
+
const missing = [];
|
|
28
|
+
if (!config.controllers?.length) {
|
|
29
|
+
missing.push(`ad.domains.${domain}.controllers`);
|
|
30
|
+
}
|
|
31
|
+
if (!config.username) {
|
|
32
|
+
missing.push(`ad.domains.${domain}.username`);
|
|
33
|
+
}
|
|
34
|
+
if (!config.password) {
|
|
35
|
+
missing.push(`ad.domains.${domain}.password`);
|
|
36
|
+
}
|
|
37
|
+
return missing;
|
|
38
|
+
}
|
|
39
|
+
let cachedDefaultDomain;
|
|
40
|
+
/**
|
|
41
|
+
* Initializes AD Group Checker for checking user membership in AD groups.
|
|
42
|
+
* @param domainName - Optional domain name. Uses default domain if not specified.
|
|
43
|
+
* @throws Error if AD configuration is missing or incomplete
|
|
44
|
+
*/
|
|
45
|
+
export function initADGroupChecker(domainName) {
|
|
46
|
+
let domainConfig;
|
|
47
|
+
let resolvedDomainName;
|
|
48
|
+
if (domainName) {
|
|
49
|
+
domainConfig = appConfig.ad?.domains?.[domainName];
|
|
50
|
+
resolvedDomainName = domainName;
|
|
51
|
+
if (!domainConfig) {
|
|
52
|
+
const available = Object.keys(appConfig.ad?.domains || {}).join(', ') || 'none';
|
|
53
|
+
throw new Error(`AD domain "${domainName}" not found. Available: ${available}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
cachedDefaultDomain = cachedDefaultDomain || getDefaultDomain();
|
|
58
|
+
if (!cachedDefaultDomain) {
|
|
59
|
+
throw new Error('No AD domains configured in ad.domains');
|
|
60
|
+
}
|
|
61
|
+
domainConfig = cachedDefaultDomain.config;
|
|
62
|
+
resolvedDomainName = cachedDefaultDomain.name;
|
|
63
|
+
}
|
|
64
|
+
const missing = validateConfig(domainConfig, resolvedDomainName);
|
|
65
|
+
if (missing.length > 0) {
|
|
66
|
+
throw new Error(`Incomplete AD config for "${resolvedDomainName}". Missing: ${missing.join(', ')}`);
|
|
67
|
+
}
|
|
68
|
+
const controllerUrl = domainConfig.controllers[0];
|
|
69
|
+
const baseDn = domainConfig.baseDn || deriveBaseDnFromController(controllerUrl);
|
|
70
|
+
const groupCheckerConfig = {
|
|
71
|
+
url: controllerUrl,
|
|
72
|
+
bindDN: domainConfig.username,
|
|
73
|
+
bindPassword: domainConfig.password,
|
|
74
|
+
baseDn,
|
|
75
|
+
...(appConfig.ad.groupCacheTtlMs !== undefined && { cacheTtlMs: appConfig.ad.groupCacheTtlMs }),
|
|
76
|
+
...(appConfig.ad.dnCacheTtlMs !== undefined && { dnCacheTtlMs: appConfig.ad.dnCacheTtlMs }),
|
|
77
|
+
};
|
|
78
|
+
const groupChecker = new GroupChecker(groupCheckerConfig);
|
|
79
|
+
logger.info(`AD Group Checker initialized for "${resolvedDomainName}" (${controllerUrl}, baseDn: ${baseDn})`);
|
|
80
|
+
return {
|
|
81
|
+
isUserInGroup: (userSam, groupSam) => groupChecker.isUserInGroup(userSam, groupSam),
|
|
82
|
+
groupChecker,
|
|
83
|
+
domainName: resolvedDomainName,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=group-checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-checker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AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin panel authentication middleware
|
|
3
|
+
* Supports 4 authentication types: permanentServerTokens, basic, jwtToken, ntlm
|
|
4
|
+
*/
|
|
5
|
+
import { RequestHandler } from 'express';
|
|
6
|
+
export type AdminAuthType = 'permanentServerTokens' | 'basic' | 'jwtToken' | 'ntlm';
|
|
7
|
+
/**
|
|
8
|
+
* Validates admin auth configuration
|
|
9
|
+
* Returns error message if configuration is invalid, null if valid
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateAdminAuthConfig(): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Creates admin authentication middleware based on adminAuth.type config
|
|
14
|
+
*/
|
|
15
|
+
export declare function createAdminAuthMW(): RequestHandler[];
|
|
16
|
+
//# sourceMappingURL=admin-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-auth.d.ts","sourceRoot":"","sources":["../../../src/core/auth/admin-auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAmC,cAAc,EAAE,MAAM,SAAS,CAAC;AAa1E,MAAM,MAAM,aAAa,GAAG,uBAAuB,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;AAGpF;;;GAGG;AACH,wBAAgB,uBAAuB,IAAK,MAAM,GAAG,IAAI,CA8CxD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAK,cAAc,EAAE,CA0FrD"}
|