fa-mcp-sdk 0.2.38 → 0.2.76
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 +781 -0
- package/cli-template/.editorconfig +13 -0
- package/cli-template/.env.example +29 -0
- package/cli-template/.envrc +3 -0
- package/cli-template/.run/== START ==.run.xml +14 -0
- package/cli-template/.run/TEST HTTP.run.xml +5 -0
- package/cli-template/.run/TEST SSE.run.xml +5 -0
- package/cli-template/.run/TEST STDIO.run.xml +5 -0
- package/cli-template/.run/TEST search.run.xml +11 -0
- package/cli-template/.run/cb.run.xml +12 -0
- package/cli-template/.run/ci.run.xml +12 -0
- package/cli-template/.run/kill-port 3030.run.xml +5 -0
- package/cli-template/.run/lint.run.xml +12 -0
- package/cli-template/.run/lint_fix.run.xml +12 -0
- package/cli-template/.run/reinstall.run.xml +12 -0
- package/cli-template/.run/remove-nul.js.run.xml +5 -0
- package/cli-template/LICENSE +21 -0
- package/cli-template/config/_local.yaml +64 -0
- package/cli-template/config/custom-environment-variables.yaml +33 -0
- package/cli-template/config/default.yaml +101 -0
- package/cli-template/config/development.yaml +4 -0
- package/cli-template/config/production.yaml +4 -0
- package/cli-template/config/test.yaml +26 -0
- package/cli-template/deploy/.gitkeep +0 -0
- package/cli-template/deploy/config.example.yml +3 -0
- package/cli-template/deploy/mcp-template.com.conf +58 -0
- package/cli-template/deploy/pm2.config.js +30 -0
- package/cli-template/deploy/pm2reg.sh +49 -0
- package/cli-template/deploy/srv.sh +359 -0
- package/cli-template/deploy/srv.sh.readme.md +347 -0
- package/cli-template/eslint.config.js +139 -0
- package/cli-template/jest.config.js +30 -0
- package/cli-template/package.json +73 -0
- package/cli-template/scripts/kill-port.js +107 -0
- package/cli-template/scripts/npm/patch_node_modules.js +9 -0
- package/cli-template/scripts/npm/run.js +31 -0
- package/cli-template/scripts/npm/yarn-ci.ps1 +16 -0
- package/cli-template/scripts/npm/yarn-ci.sh +8 -0
- package/cli-template/scripts/npm/yarn-reinstall.ps1 +54 -0
- package/cli-template/scripts/npm/yarn-reinstall.sh +10 -0
- package/cli-template/scripts/pre-commit +58 -0
- package/cli-template/scripts/remove-nul.js +53 -0
- package/cli-template/src/_types_/common.d.ts +27 -0
- package/cli-template/src/api/router.ts +35 -0
- package/cli-template/src/api/swagger.ts +167 -0
- package/cli-template/src/asset/favicon.svg +4 -0
- package/cli-template/src/custom-resources.ts +11 -0
- package/cli-template/src/prompts/agent-brief.ts +8 -0
- package/cli-template/src/prompts/agent-prompt.ts +1 -0
- package/cli-template/src/prompts/custom-prompts.ts +12 -0
- package/cli-template/src/start.ts +84 -0
- package/cli-template/src/tools/handle-tool-call.ts +55 -0
- package/cli-template/src/tools/tools.ts +88 -0
- package/cli-template/tests/jest-simple-reporter.js +10 -0
- package/cli-template/tests/mcp/sse/mcp-sse-client-handling.md +111 -0
- package/cli-template/tests/mcp/sse/test-sse-npm-package.js +96 -0
- package/cli-template/tests/mcp/test-cases.js +143 -0
- package/cli-template/tests/mcp/test-http.js +63 -0
- package/cli-template/tests/mcp/test-sse.js +67 -0
- package/cli-template/tests/mcp/test-stdio.js +78 -0
- package/cli-template/tests/utils.ts +154 -0
- package/cli-template/tsconfig.json +48 -0
- package/cli-template/update.cjs +631 -0
- package/dist/core/_types_/active-directory-config.d.ts +24 -0
- package/dist/core/_types_/active-directory-config.d.ts.map +1 -0
- package/dist/core/_types_/active-directory-config.js +2 -0
- package/dist/core/_types_/active-directory-config.js.map +1 -0
- package/dist/core/bootstrap/init-config.d.ts.map +1 -1
- package/dist/core/bootstrap/init-config.js +14 -3
- package/dist/core/bootstrap/init-config.js.map +1 -1
- package/dist/core/bootstrap/startup-info.js +1 -1
- package/dist/core/bootstrap/startup-info.js.map +1 -1
- package/dist/core/index.d.ts +3 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -2
- package/dist/core/index.js.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/token/gen-token-app/gen-token-server.d.ts.map +1 -1
- package/dist/core/token/gen-token-app/gen-token-server.js +85 -9
- package/dist/core/token/gen-token-app/gen-token-server.js.map +1 -1
- package/dist/core/token/gen-token-app/html.d.ts +8 -1
- package/dist/core/token/gen-token-app/html.d.ts.map +1 -1
- package/dist/core/token/gen-token-app/html.js +98 -2
- package/dist/core/token/gen-token-app/html.js.map +1 -1
- package/dist/core/token/gen-token-app/ntlm-auth-options.d.ts +4 -0
- package/dist/core/token/gen-token-app/ntlm-auth-options.d.ts.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-auth-options.js +85 -0
- package/dist/core/token/gen-token-app/ntlm-auth-options.js.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-domain-config.d.ts +16 -0
- package/dist/core/token/gen-token-app/ntlm-domain-config.d.ts.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-domain-config.js +71 -0
- package/dist/core/token/gen-token-app/ntlm-domain-config.js.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-integration.d.ts +6 -0
- package/dist/core/token/gen-token-app/ntlm-integration.d.ts.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-integration.js +73 -0
- package/dist/core/token/gen-token-app/ntlm-integration.js.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-session-storage.d.ts +16 -0
- package/dist/core/token/gen-token-app/ntlm-session-storage.d.ts.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-session-storage.js +74 -0
- package/dist/core/token/gen-token-app/ntlm-session-storage.js.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-templates.d.ts +21 -0
- package/dist/core/token/gen-token-app/ntlm-templates.d.ts.map +1 -0
- package/dist/core/token/gen-token-app/ntlm-templates.js +211 -0
- package/dist/core/token/gen-token-app/ntlm-templates.js.map +1 -0
- package/dist/core/token/{token.d.ts → token-auth.d.ts} +1 -1
- package/dist/core/token/token-auth.d.ts.map +1 -0
- package/dist/core/token/{token.js → token-auth.js} +4 -6
- package/dist/core/token/token-auth.js.map +1 -0
- package/dist/core/token/token-core.d.ts +5 -1
- package/dist/core/token/token-core.d.ts.map +1 -1
- package/dist/core/token/token-core.js +13 -3
- package/dist/core/token/token-core.js.map +1 -1
- package/dist/core/web/about-page/render.js +1 -1
- package/dist/core/web/about-page/render.js.map +1 -1
- package/dist/core/web/server-http.js +1 -1
- package/dist/core/web/server-http.js.map +1 -1
- package/package.json +10 -3
- package/dist/core/token/token.d.ts.map +0 -1
- package/dist/core/token/token.js.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
SERVICE_NAME={{project.name}}
|
|
2
|
+
# Used as an alternate service name when using systemd
|
|
3
|
+
SERVICE_NAME_ALT={{project.name}}
|
|
4
|
+
NODE_ENV={{NODE_ENV}}
|
|
5
|
+
# Used for PM2
|
|
6
|
+
SERVICE_INSTANCE={{SERVICE_INSTANCE}}
|
|
7
|
+
PM2_NAMESPACE={{PM2_NAMESPACE}}
|
|
8
|
+
|
|
9
|
+
# Affects how the Consul service ID is formed - as a product or development ID
|
|
10
|
+
NODE_CONSUL_ENV={{NODE_CONSUL_ENV}}
|
|
11
|
+
|
|
12
|
+
DEBUG=config-info
|
|
13
|
+
# Used for PM2 service configuration
|
|
14
|
+
#┌────┬───────────────────────────────────────────────────────────┬─────────────────┬
|
|
15
|
+
#│ id │ name │ namespace │
|
|
16
|
+
#├────┼───────────────────────────────────────────────────────────┼─────────────────┼
|
|
17
|
+
#│ 1 │ <SERVICE_NAME | package.json.name>[--<SERVICE_INSTANCE>] │ <PM2_NAMESPACE> │
|
|
18
|
+
|
|
19
|
+
## DEBUG patterns ##
|
|
20
|
+
# AP-UPDATER - consul/access-points-updater
|
|
21
|
+
# af-consul:reg | af-consul:* - consul/cyclic-register
|
|
22
|
+
# af-consul:curl - consul/prepare-consul-api
|
|
23
|
+
# token:auth
|
|
24
|
+
|
|
25
|
+
# The address of the mcp server for testing. Default: http://localhost:<config.webServer.port>
|
|
26
|
+
# TEST_MCP_SERVER_URL=
|
|
27
|
+
|
|
28
|
+
# The directory to store test result logs
|
|
29
|
+
TEST_RESULT_LOGS_DIR='_logs/mcp'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="== START ==" type="js.build_tools.npm">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="start" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<node-options value="--dns-result-order=ipv4first --no-node-snapshot" />
|
|
10
|
+
<package-manager value="npm" />
|
|
11
|
+
<envs />
|
|
12
|
+
<method v="2" />
|
|
13
|
+
</configuration>
|
|
14
|
+
</component>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="TEST search" type="JavaScriptTestRunnerJest">
|
|
3
|
+
<node-interpreter value="project" />
|
|
4
|
+
<jest-package value="$PROJECT_DIR$/node_modules/jest" />
|
|
5
|
+
<working-dir value="$PROJECT_DIR$" />
|
|
6
|
+
<envs />
|
|
7
|
+
<scope-kind value="TEST_FILE" />
|
|
8
|
+
<test-file value="$PROJECT_DIR$/tests/tools/search.test.ts" />
|
|
9
|
+
<method v="2" />
|
|
10
|
+
</configuration>
|
|
11
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="cb" type="js.build_tools.npm">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="cb" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<envs />
|
|
10
|
+
<method v="2" />
|
|
11
|
+
</configuration>
|
|
12
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="ci" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="ci" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<envs />
|
|
10
|
+
<method v="2" />
|
|
11
|
+
</configuration>
|
|
12
|
+
</component>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="kill-port 3030" type="NodeJSConfigurationType" application-parameters="3030" path-to-js-file="scripts/kill-port.js" working-dir="$PROJECT_DIR$">
|
|
3
|
+
<method v="2" />
|
|
4
|
+
</configuration>
|
|
5
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="lint" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="lint" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<envs />
|
|
10
|
+
<method v="2" />
|
|
11
|
+
</configuration>
|
|
12
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="lint:fix" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="lint:fix" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<envs />
|
|
10
|
+
<method v="2" />
|
|
11
|
+
</configuration>
|
|
12
|
+
</component>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="reinstall" type="js.build_tools.npm" nameIsGenerated="true">
|
|
3
|
+
<package-json value="$PROJECT_DIR$/package.json" />
|
|
4
|
+
<command value="run" />
|
|
5
|
+
<scripts>
|
|
6
|
+
<script value="reinstall" />
|
|
7
|
+
</scripts>
|
|
8
|
+
<node-interpreter value="project" />
|
|
9
|
+
<envs />
|
|
10
|
+
<method v="2" />
|
|
11
|
+
</configuration>
|
|
12
|
+
</component>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<component name="ProjectRunConfigurationManager">
|
|
2
|
+
<configuration default="false" name="remove-nul.js" type="NodeJSConfigurationType" nameIsGenerated="true" path-to-js-file="remove-nul.js" working-dir="$PROJECT_DIR$/scripts">
|
|
3
|
+
<method v="2" />
|
|
4
|
+
</configuration>
|
|
5
|
+
</component>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Michael Makarov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Copy this file to local.yaml and update with your database credentials
|
|
2
|
+
# local.yaml is gitignored and won't be committed
|
|
3
|
+
---
|
|
4
|
+
consul:
|
|
5
|
+
agent:
|
|
6
|
+
dev:
|
|
7
|
+
# Token for getting information about DEV services
|
|
8
|
+
token: '{{consul.agent.dev.token}}'
|
|
9
|
+
prd:
|
|
10
|
+
# Token for obtaining information about PROD services
|
|
11
|
+
token: '{{consul.agent.prd.token}}'
|
|
12
|
+
reg:
|
|
13
|
+
# 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
|
|
14
|
+
# Token for registering the service in the consul agent
|
|
15
|
+
token: '{{consul.agent.reg.token}}'
|
|
16
|
+
service:
|
|
17
|
+
enable: {{consul.service.enable}} # true - Allows registration of the service with the consul
|
|
18
|
+
instance: 'instance-0' # This value will be specified as a suffix in the id of the service
|
|
19
|
+
envCode: # Used to generate the service ID
|
|
20
|
+
prod: '{{consul.envCode.prod}}' # Production environment code
|
|
21
|
+
dev: '{{consul.envCode.dev}}' # Development environment code
|
|
22
|
+
|
|
23
|
+
db:
|
|
24
|
+
postgres:
|
|
25
|
+
dbs:
|
|
26
|
+
main:
|
|
27
|
+
label: 'Your Database Label'
|
|
28
|
+
database: your_database
|
|
29
|
+
host: 'your_host' # To exclude the use of the database, you need to set host = ''
|
|
30
|
+
port: 5432
|
|
31
|
+
user: your_user
|
|
32
|
+
password: your_password
|
|
33
|
+
# usedExtensions:
|
|
34
|
+
# - pgvector
|
|
35
|
+
|
|
36
|
+
logger:
|
|
37
|
+
level: info
|
|
38
|
+
useFileLogger: true # To use or not to use logging to a file
|
|
39
|
+
|
|
40
|
+
mcp:
|
|
41
|
+
transportType: http # 'stdio' or 'http'
|
|
42
|
+
toolAnswerAs: text # text | structuredContent
|
|
43
|
+
rateLimit:
|
|
44
|
+
maxRequests: 100
|
|
45
|
+
windowMs: 60000 # 1 minute
|
|
46
|
+
|
|
47
|
+
swagger:
|
|
48
|
+
servers: # An array of servers that will be added to swagger docs
|
|
49
|
+
- url: http://localhost:{{port}}
|
|
50
|
+
description: "Local server"
|
|
51
|
+
|
|
52
|
+
webServer:
|
|
53
|
+
port: {{port}}
|
|
54
|
+
# array of hosts that CORS skips
|
|
55
|
+
originHosts: ['localhost', '0.0.0.0']
|
|
56
|
+
auth:
|
|
57
|
+
enabled: {{webServer.auth.enabled}} # Enables/disables token authorization
|
|
58
|
+
# An array of fixed tokens that pass to the MCP (use only for MCPs with green data or for development)
|
|
59
|
+
permanentServerTokens: []
|
|
60
|
+
token:
|
|
61
|
+
# Symmetric encryption key to generate a token for this MCP
|
|
62
|
+
encryptKey: '{{webServer.auth.token.encryptKey}}'
|
|
63
|
+
# If webServer.auth.enabled and the parameter true, the service name and the service specified in the token will be checked
|
|
64
|
+
checkMCPName: {{webServer.auth.token.checkMCPName}}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
db:
|
|
2
|
+
postgres:
|
|
3
|
+
dbs:
|
|
4
|
+
main:
|
|
5
|
+
database: DB_NAME
|
|
6
|
+
host: DB_HOST
|
|
7
|
+
port: DB_PORT
|
|
8
|
+
user: DB_USER
|
|
9
|
+
password: DB_PASSWORD
|
|
10
|
+
|
|
11
|
+
logger:
|
|
12
|
+
level: LOGGER_LEVEL
|
|
13
|
+
useFileLogger: LOGGER_USE_FILE_LOGGER
|
|
14
|
+
|
|
15
|
+
mcp:
|
|
16
|
+
transportType: MCP_TRANSPORT_TYPE
|
|
17
|
+
toolAnswerAs: MCP_TOOL_ANSWER_AS
|
|
18
|
+
rateLimit:
|
|
19
|
+
maxRequests: MCP_RATE_LIMIT_MAX_REQUESTS
|
|
20
|
+
windowMs: MCP_RATE_LIMIT_WINDOW_MS
|
|
21
|
+
|
|
22
|
+
uiColor:
|
|
23
|
+
primary: UI_COLOR_PRIMARY
|
|
24
|
+
|
|
25
|
+
webServer:
|
|
26
|
+
host: WS_HOST
|
|
27
|
+
port: WS_PORT
|
|
28
|
+
auth:
|
|
29
|
+
enabled: WS_AUTH_ENABLED
|
|
30
|
+
permanentServerTokens: WS_SERVER_TOKENS # comma separated list
|
|
31
|
+
token:
|
|
32
|
+
encryptKey: WS_TOKEN_ENCRYPT_KEY
|
|
33
|
+
checkMCPName: WS_CHECK_MC_NAME
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
#accessPoints:
|
|
4
|
+
# myService:
|
|
5
|
+
# title: 'My remote service'
|
|
6
|
+
# host: <host>
|
|
7
|
+
# port: 9999
|
|
8
|
+
# token: '***'
|
|
9
|
+
# noConsul: true # Use if the service developers do not provide registration in consul
|
|
10
|
+
# consulServiceName: <consulServiceName>
|
|
11
|
+
|
|
12
|
+
consul:
|
|
13
|
+
check:
|
|
14
|
+
interval: '10s'
|
|
15
|
+
timeout: '5s'
|
|
16
|
+
deregistercriticalserviceafter: '3m'
|
|
17
|
+
agent:
|
|
18
|
+
dev:
|
|
19
|
+
dc: '{{consul.agent.dev.dc}}'
|
|
20
|
+
host: '{{consul.agent.dev.host}}'
|
|
21
|
+
port: 443
|
|
22
|
+
secure: true
|
|
23
|
+
# Token for getting information about DEV services
|
|
24
|
+
token: '***'
|
|
25
|
+
prd:
|
|
26
|
+
dc: '{{consul.agent.prd.dc}}'
|
|
27
|
+
host: '{{consul.agent.prd.host}}'
|
|
28
|
+
port: 443
|
|
29
|
+
secure: true
|
|
30
|
+
# Token for obtaining information about PROD services
|
|
31
|
+
token: '***'
|
|
32
|
+
reg:
|
|
33
|
+
host: null # 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
|
+
port: 8500
|
|
35
|
+
secure: false
|
|
36
|
+
# Token for registering the service in the consul agent
|
|
37
|
+
token: '***'
|
|
38
|
+
service:
|
|
39
|
+
enable: {{consul.service.enable}} # true - Allows registration of the service with the consul
|
|
40
|
+
name: <name> # <name> will be replaced by <package.json>.name at initialization
|
|
41
|
+
instance: 'instance-0' # This value will be specified as a suffix in the id of the service
|
|
42
|
+
version: <version> # <version> will be replaced by <package.json>.version at initialization
|
|
43
|
+
description: <description> # <description> will be replaced by <package.json>.description at initialization
|
|
44
|
+
tags: [] # If null or empty array - Will be pulled up from package.keywords at initialization
|
|
45
|
+
meta:
|
|
46
|
+
# "About" page link template
|
|
47
|
+
who: 'http://{address}:{port}/'
|
|
48
|
+
envCode: # Used to generate the service ID
|
|
49
|
+
prod: {{consul.envCode.prod}} # Production environment code
|
|
50
|
+
dev: {{consul.envCode.dev}} # Development environment code
|
|
51
|
+
|
|
52
|
+
db:
|
|
53
|
+
postgres:
|
|
54
|
+
dbs:
|
|
55
|
+
main:
|
|
56
|
+
label: 'My Database'
|
|
57
|
+
host: '' # To exclude the use of the database, you need to set host = ''
|
|
58
|
+
port: 5432
|
|
59
|
+
database: <database>
|
|
60
|
+
user: <user>
|
|
61
|
+
password: <password>
|
|
62
|
+
usedExtensions: []
|
|
63
|
+
|
|
64
|
+
logger:
|
|
65
|
+
level: info
|
|
66
|
+
useFileLogger: true # To use or not to use logging to a file
|
|
67
|
+
|
|
68
|
+
mcp:
|
|
69
|
+
transportType: http # stdio | http
|
|
70
|
+
# Response format configuration.
|
|
71
|
+
# - structuredContent - default - the response in result.structuredContent returns JSON
|
|
72
|
+
# - text - in the response, serialized JSON is returned in result.content[0].text
|
|
73
|
+
toolAnswerAs: text # text | structuredContent
|
|
74
|
+
rateLimit:
|
|
75
|
+
maxRequests: 100
|
|
76
|
+
windowMs: 60000 # 1 minute
|
|
77
|
+
|
|
78
|
+
swagger:
|
|
79
|
+
servers: # An array of servers that will be added to swagger docs
|
|
80
|
+
- url: http://localhost:{{port}}
|
|
81
|
+
description: "Development server (localhost)"
|
|
82
|
+
- url: http://0.0.0.0:{{port}}
|
|
83
|
+
description: "Development server (all interfaces)"
|
|
84
|
+
|
|
85
|
+
uiColor: # Font color of the header and a number of interface elements on the ABOUT page
|
|
86
|
+
primary: '#0f65dc'
|
|
87
|
+
|
|
88
|
+
webServer:
|
|
89
|
+
host: '0.0.0.0'
|
|
90
|
+
port: {{port}}
|
|
91
|
+
# array of hosts that CORS skips
|
|
92
|
+
originHosts: ['localhost', '0.0.0.0']
|
|
93
|
+
auth:
|
|
94
|
+
enabled: false # Enables/disables token authorization
|
|
95
|
+
# An array of fixed tokens that pass to the MCP (use only for MCPs with green data or for development)
|
|
96
|
+
permanentServerTokens: []
|
|
97
|
+
token:
|
|
98
|
+
# Symmetric encryption key to generate a token for this MCP
|
|
99
|
+
encryptKey: '***'
|
|
100
|
+
# If webServer.auth.enabled and the parameter true, the service name and the service specified in the token will be checked
|
|
101
|
+
checkMCPName: true
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
# Test configuration - mocked database and minimal setup
|
|
3
|
+
db:
|
|
4
|
+
postgres:
|
|
5
|
+
dbs:
|
|
6
|
+
main:
|
|
7
|
+
label: 'Test Database (Mocked)'
|
|
8
|
+
database: test_db
|
|
9
|
+
host: localhost
|
|
10
|
+
port: 5432
|
|
11
|
+
password: test_password
|
|
12
|
+
user: test_user
|
|
13
|
+
|
|
14
|
+
logger:
|
|
15
|
+
level: error # Minimize log output during tests
|
|
16
|
+
|
|
17
|
+
mcp:
|
|
18
|
+
transportType: stdio
|
|
19
|
+
rateLimit:
|
|
20
|
+
maxRequests: 1000
|
|
21
|
+
windowMs: 60000
|
|
22
|
+
|
|
23
|
+
webServer:
|
|
24
|
+
host: '127.0.0.1'
|
|
25
|
+
port: 0 # Random port for testing
|
|
26
|
+
originHosts: ['localhost']
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# sudo vim /etc/nginx/sites-enabled/{{mcp.domain}}.conf
|
|
2
|
+
|
|
3
|
+
#Setup upstream for backend Node.js server
|
|
4
|
+
upstream {{upstream}} {
|
|
5
|
+
server 127.0.0.1:9020;
|
|
6
|
+
keepalive 8;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#The Nginx server instance
|
|
10
|
+
server {
|
|
11
|
+
server_name {{mcp.domain}};
|
|
12
|
+
access_log /var/log/nginx/{{mcp.domain}}.log;
|
|
13
|
+
error_log /var/log/nginx/{{mcp.domain}}.ERROR.log;
|
|
14
|
+
|
|
15
|
+
# SSE endpoint for MCP protocol - requires special streaming settings
|
|
16
|
+
location /sse {
|
|
17
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
18
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
19
|
+
proxy_set_header Host $http_host;
|
|
20
|
+
proxy_set_header X-NginX-Proxy true;
|
|
21
|
+
proxy_set_header Cache-Control no-cache;
|
|
22
|
+
proxy_set_header Connection '';
|
|
23
|
+
|
|
24
|
+
proxy_http_version 1.1;
|
|
25
|
+
proxy_pass http://{{upstream}}/sse;
|
|
26
|
+
proxy_redirect off;
|
|
27
|
+
proxy_buffering off;
|
|
28
|
+
proxy_cache off;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# All other endpoints (/, /health, /api/, /docs, /mcp)
|
|
32
|
+
location / {
|
|
33
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
34
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
35
|
+
proxy_set_header Host $http_host;
|
|
36
|
+
proxy_set_header X-NginX-Proxy true;
|
|
37
|
+
|
|
38
|
+
proxy_pass http://{{upstream}}/;
|
|
39
|
+
proxy_redirect off;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
listen 443 ssl http2;
|
|
43
|
+
include snippets/ssl-wildcard-finam-ru.conf;
|
|
44
|
+
include snippets/ssl-params.conf;
|
|
45
|
+
ssl_protocols TLSv1.3;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
server {
|
|
49
|
+
if ($host = {{mcp.domain}}) {
|
|
50
|
+
return 301 https://$host$request_uri;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
listen 0.0.0.0:80;
|
|
54
|
+
server_name {{mcp.domain}};
|
|
55
|
+
return 404;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#sudo systemctl restart nginx
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require('dotenv').config({ path: './.env', debug: true });
|
|
2
|
+
const { name, main } = require('../package.json');
|
|
3
|
+
|
|
4
|
+
const { SERVICE_NAME, SERVICE_INSTANCE, PM2_NAMESPACE } = process.env;
|
|
5
|
+
const suffix = SERVICE_INSTANCE ? `--${SERVICE_INSTANCE}` : '';
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
apps: [{
|
|
9
|
+
name: `${SERVICE_NAME || name}${suffix}`,
|
|
10
|
+
script: main,
|
|
11
|
+
node_args: '--no-node-snapshot',
|
|
12
|
+
// Options reference: https://pm2.keymetrics.io/docs/usage/application-declaration/
|
|
13
|
+
namespace: PM2_NAMESPACE || undefined,
|
|
14
|
+
instances: 1,
|
|
15
|
+
// exec_interpreter: '/root/.nvm/versions/node/v22.17.1/bin/node',
|
|
16
|
+
exec_mode: 'fork', // Fixing ESM Connection
|
|
17
|
+
autorestart: true,
|
|
18
|
+
// restart_delay: 5000,
|
|
19
|
+
exp_backoff_restart_delay: 100,
|
|
20
|
+
watch: false,
|
|
21
|
+
watch_delay: 5000, // Delay between restart
|
|
22
|
+
// watch: ["server", "client"],
|
|
23
|
+
ignore_watch: ['.git', '_misc', '_sql', 'deploy', 'node_modules', 'sql', 'tmp'],
|
|
24
|
+
max_memory_restart: '10G',
|
|
25
|
+
error_file: `/var/log/pm2/${name}.app.log`,
|
|
26
|
+
out_file: `/var/log/pm2/${name}.log`,
|
|
27
|
+
// env_prd: { NODE_ENV: 'production' },
|
|
28
|
+
// env_dev: { NODE_ENV: 'development' },
|
|
29
|
+
}],
|
|
30
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
c='\033[0;35m'
|
|
4
|
+
y='\033[0;33m'
|
|
5
|
+
c0='\033[0;0m'
|
|
6
|
+
g='\033[0;32m'
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
# Parse arguments
|
|
10
|
+
NODE_ENV="development"
|
|
11
|
+
if [[ "$1" == "-p" || "$1" == "--prod" ]]; then
|
|
12
|
+
NODE_ENV="production"
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
16
|
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" # Parent directory (project root)
|
|
17
|
+
|
|
18
|
+
# Load environment variables from .env if exists
|
|
19
|
+
if [ -f "$PROJECT_ROOT/.env" ]; then
|
|
20
|
+
source "$PROJECT_ROOT/.env"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# Get SERVICE_NAME from environment variable or package.json
|
|
24
|
+
if [ -n "$SERVICE_NAME" ]; then
|
|
25
|
+
# Use environment variable
|
|
26
|
+
SERVICE_NAME="$SERVICE_NAME"
|
|
27
|
+
else
|
|
28
|
+
# Read from package.json
|
|
29
|
+
SERVICE_NAME=`cat "$PROJECT_ROOT/package.json" | grep name | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'`
|
|
30
|
+
fi
|
|
31
|
+
if [ -z "$SERVICE_INSTANCE" ]
|
|
32
|
+
then
|
|
33
|
+
SERVICE="${SERVICE_NAME}"
|
|
34
|
+
else
|
|
35
|
+
SERVICE="${SERVICE_NAME}--${SERVICE_INSTANCE}"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
echo -e "$g========================================$c0"
|
|
39
|
+
echo -e "$g**** REGISTER SERVICE $y${SERVICE}$g ****$c0"
|
|
40
|
+
echo -e "$g========================================$c0"
|
|
41
|
+
|
|
42
|
+
# Checking if the service exists in PM2
|
|
43
|
+
if pm2 list | grep -q "$SERVICE"; then
|
|
44
|
+
echo -e "${g}An existing process was found $y${SERVICE}$g. Deleting..."
|
|
45
|
+
pm2 delete $SERVICE
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
NODE_ENV=$NODE_ENV pm2 startOrRestart "$PROJECT_ROOT/deploy/pm2.config.js"
|
|
49
|
+
pm2 save
|