fa-mcp-sdk 0.4.141 → 0.11.2

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.
Files changed (200) hide show
  1. package/README.md +5 -0
  2. package/cli-template/.dockerignore +16 -0
  3. package/cli-template/.gitlab-ci.yml +135 -0
  4. package/cli-template/AGENTS.md +1 -0
  5. package/cli-template/CHANGELOG.md +64 -0
  6. package/cli-template/FA-MCP-SDK-DOC/00-FA-MCP-SDK-index.md +27 -4
  7. package/cli-template/FA-MCP-SDK-DOC/02-1-tools-and-api.md +195 -0
  8. package/cli-template/FA-MCP-SDK-DOC/02-2-prompts-and-resources.md +172 -9
  9. package/cli-template/FA-MCP-SDK-DOC/03-configuration.md +170 -12
  10. package/cli-template/FA-MCP-SDK-DOC/04-authentication.md +158 -8
  11. package/cli-template/FA-MCP-SDK-DOC/06-utilities.md +67 -6
  12. package/cli-template/FA-MCP-SDK-DOC/07-testing-and-operations.md +31 -15
  13. package/cli-template/FA-MCP-SDK-DOC/10-mcp-apps.md +1 -1
  14. package/cli-template/FA-MCP-SDK-DOC/11-public-contract.md +342 -0
  15. package/cli-template/README.md +37 -0
  16. package/cli-template/deploy/docker/.env.example +10 -0
  17. package/cli-template/deploy/docker/Dockerfile +44 -0
  18. package/cli-template/deploy/docker/Dockerfile.local +29 -0
  19. package/cli-template/deploy/docker/README.md +94 -0
  20. package/cli-template/deploy/docker/config/local.docker.yaml +14 -0
  21. package/cli-template/deploy/docker/docker-compose.yml +31 -0
  22. package/cli-template/deploy/gitlab-runner/.env.example +16 -0
  23. package/cli-template/deploy/gitlab-runner/README.md +65 -0
  24. package/cli-template/deploy/gitlab-runner/config/config.toml.template +26 -0
  25. package/cli-template/deploy/gitlab-runner/docker-compose.yml +39 -0
  26. package/cli-template/deploy/gitlab-runner/entrypoint.sh +27 -0
  27. package/cli-template/deploy/gitlab-runner/start.sh +47 -0
  28. package/cli-template/gitignore +96 -95
  29. package/cli-template/package.json +1 -1
  30. package/config/_local.yaml +73 -11
  31. package/config/custom-environment-variables.yaml +102 -0
  32. package/config/default.yaml +164 -11
  33. package/config/local.yaml +20 -19
  34. package/dist/core/_types_/config.d.ts +119 -0
  35. package/dist/core/_types_/config.d.ts.map +1 -1
  36. package/dist/core/_types_/types.d.ts +137 -4
  37. package/dist/core/_types_/types.d.ts.map +1 -1
  38. package/dist/core/agent-tester/agent-tester-router.d.ts.map +1 -1
  39. package/dist/core/agent-tester/agent-tester-router.js +25 -11
  40. package/dist/core/agent-tester/agent-tester-router.js.map +1 -1
  41. package/dist/core/agent-tester/services/TesterMcpClientService.d.ts.map +1 -1
  42. package/dist/core/agent-tester/services/TesterMcpClientService.js +6 -4
  43. package/dist/core/agent-tester/services/TesterMcpClientService.js.map +1 -1
  44. package/dist/core/auth/admin-auth.js +4 -4
  45. package/dist/core/auth/admin-auth.js.map +1 -1
  46. package/dist/core/auth/agent-tester-auth.d.ts +1 -1
  47. package/dist/core/auth/agent-tester-auth.d.ts.map +1 -1
  48. package/dist/core/auth/agent-tester-auth.js +8 -4
  49. package/dist/core/auth/agent-tester-auth.js.map +1 -1
  50. package/dist/core/auth/auth-profile.d.ts +38 -0
  51. package/dist/core/auth/auth-profile.d.ts.map +1 -0
  52. package/dist/core/auth/auth-profile.js +101 -0
  53. package/dist/core/auth/auth-profile.js.map +1 -0
  54. package/dist/core/auth/jwt-v2.d.ts +27 -0
  55. package/dist/core/auth/jwt-v2.d.ts.map +1 -0
  56. package/dist/core/auth/jwt-v2.js +180 -0
  57. package/dist/core/auth/jwt-v2.js.map +1 -0
  58. package/dist/core/auth/jwt.d.ts +27 -13
  59. package/dist/core/auth/jwt.d.ts.map +1 -1
  60. package/dist/core/auth/jwt.js +36 -13
  61. package/dist/core/auth/jwt.js.map +1 -1
  62. package/dist/core/auth/key-resolver.d.ts +74 -0
  63. package/dist/core/auth/key-resolver.d.ts.map +1 -0
  64. package/dist/core/auth/key-resolver.js +330 -0
  65. package/dist/core/auth/key-resolver.js.map +1 -0
  66. package/dist/core/auth/middleware.d.ts.map +1 -1
  67. package/dist/core/auth/middleware.js +66 -0
  68. package/dist/core/auth/middleware.js.map +1 -1
  69. package/dist/core/auth/multi-auth.d.ts +1 -1
  70. package/dist/core/auth/multi-auth.d.ts.map +1 -1
  71. package/dist/core/auth/multi-auth.js +7 -7
  72. package/dist/core/auth/multi-auth.js.map +1 -1
  73. package/dist/core/auth/token-generator/server.js +4 -4
  74. package/dist/core/auth/token-generator/server.js.map +1 -1
  75. package/dist/core/auth/types.d.ts +5 -0
  76. package/dist/core/auth/types.d.ts.map +1 -1
  77. package/dist/core/db/pg-db.d.ts +7 -0
  78. package/dist/core/db/pg-db.d.ts.map +1 -1
  79. package/dist/core/db/pg-db.js +54 -3
  80. package/dist/core/db/pg-db.js.map +1 -1
  81. package/dist/core/errors/BaseMcpError.d.ts +21 -1
  82. package/dist/core/errors/BaseMcpError.d.ts.map +1 -1
  83. package/dist/core/errors/BaseMcpError.js +20 -1
  84. package/dist/core/errors/BaseMcpError.js.map +1 -1
  85. package/dist/core/errors/ValidationError.d.ts +5 -0
  86. package/dist/core/errors/ValidationError.d.ts.map +1 -1
  87. package/dist/core/errors/ValidationError.js +6 -1
  88. package/dist/core/errors/ValidationError.js.map +1 -1
  89. package/dist/core/errors/errors.d.ts +31 -3
  90. package/dist/core/errors/errors.d.ts.map +1 -1
  91. package/dist/core/errors/errors.js +86 -6
  92. package/dist/core/errors/errors.js.map +1 -1
  93. package/dist/core/errors/specific-errors.d.ts +54 -0
  94. package/dist/core/errors/specific-errors.d.ts.map +1 -0
  95. package/dist/core/errors/specific-errors.js +82 -0
  96. package/dist/core/errors/specific-errors.js.map +1 -0
  97. package/dist/core/index.d.ts +10 -2
  98. package/dist/core/index.d.ts.map +1 -1
  99. package/dist/core/index.js +9 -1
  100. package/dist/core/index.js.map +1 -1
  101. package/dist/core/init-mcp-server.d.ts.map +1 -1
  102. package/dist/core/init-mcp-server.js +39 -0
  103. package/dist/core/init-mcp-server.js.map +1 -1
  104. package/dist/core/mcp/create-mcp-server.d.ts +12 -6
  105. package/dist/core/mcp/create-mcp-server.d.ts.map +1 -1
  106. package/dist/core/mcp/create-mcp-server.js +592 -33
  107. package/dist/core/mcp/create-mcp-server.js.map +1 -1
  108. package/dist/core/mcp/debug-trace.d.ts +3 -1
  109. package/dist/core/mcp/debug-trace.d.ts.map +1 -1
  110. package/dist/core/mcp/debug-trace.js +17 -2
  111. package/dist/core/mcp/debug-trace.js.map +1 -1
  112. package/dist/core/mcp/deprecation.d.ts +31 -0
  113. package/dist/core/mcp/deprecation.d.ts.map +1 -0
  114. package/dist/core/mcp/deprecation.js +96 -0
  115. package/dist/core/mcp/deprecation.js.map +1 -0
  116. package/dist/core/mcp/mcp-logging.d.ts +32 -0
  117. package/dist/core/mcp/mcp-logging.d.ts.map +1 -0
  118. package/dist/core/mcp/mcp-logging.js +97 -0
  119. package/dist/core/mcp/mcp-logging.js.map +1 -0
  120. package/dist/core/mcp/pagination.d.ts +13 -0
  121. package/dist/core/mcp/pagination.d.ts.map +1 -0
  122. package/dist/core/mcp/pagination.js +50 -0
  123. package/dist/core/mcp/pagination.js.map +1 -0
  124. package/dist/core/mcp/prompts.d.ts +5 -1
  125. package/dist/core/mcp/prompts.d.ts.map +1 -1
  126. package/dist/core/mcp/prompts.js +3 -1
  127. package/dist/core/mcp/prompts.js.map +1 -1
  128. package/dist/core/mcp/resources.d.ts +9 -0
  129. package/dist/core/mcp/resources.d.ts.map +1 -1
  130. package/dist/core/mcp/resources.js +158 -11
  131. package/dist/core/mcp/resources.js.map +1 -1
  132. package/dist/core/mcp/server-stdio.d.ts +7 -1
  133. package/dist/core/mcp/server-stdio.d.ts.map +1 -1
  134. package/dist/core/mcp/server-stdio.js +8 -3
  135. package/dist/core/mcp/server-stdio.js.map +1 -1
  136. package/dist/core/mcp/task-store.d.ts +97 -0
  137. package/dist/core/mcp/task-store.d.ts.map +1 -0
  138. package/dist/core/mcp/task-store.js +175 -0
  139. package/dist/core/mcp/task-store.js.map +1 -0
  140. package/dist/core/mcp/tool-limits.d.ts +22 -0
  141. package/dist/core/mcp/tool-limits.d.ts.map +1 -0
  142. package/dist/core/mcp/tool-limits.js +115 -0
  143. package/dist/core/mcp/tool-limits.js.map +1 -0
  144. package/dist/core/mcp/validate-tool-args.d.ts +16 -0
  145. package/dist/core/mcp/validate-tool-args.d.ts.map +1 -0
  146. package/dist/core/mcp/validate-tool-args.js +67 -0
  147. package/dist/core/mcp/validate-tool-args.js.map +1 -0
  148. package/dist/core/mcp/validate-tool-names.d.ts +11 -0
  149. package/dist/core/mcp/validate-tool-names.d.ts.map +1 -0
  150. package/dist/core/mcp/validate-tool-names.js +23 -0
  151. package/dist/core/mcp/validate-tool-names.js.map +1 -0
  152. package/dist/core/metrics/metrics.d.ts +45 -0
  153. package/dist/core/metrics/metrics.d.ts.map +1 -0
  154. package/dist/core/metrics/metrics.js +119 -0
  155. package/dist/core/metrics/metrics.js.map +1 -0
  156. package/dist/core/utils/mask-sensitive.d.ts +44 -0
  157. package/dist/core/utils/mask-sensitive.d.ts.map +1 -0
  158. package/dist/core/utils/mask-sensitive.js +64 -0
  159. package/dist/core/utils/mask-sensitive.js.map +1 -0
  160. package/dist/core/utils/testing/McpHttpClient.d.ts +8 -33
  161. package/dist/core/utils/testing/McpHttpClient.d.ts.map +1 -1
  162. package/dist/core/utils/testing/McpHttpClient.js +8 -74
  163. package/dist/core/utils/testing/McpHttpClient.js.map +1 -1
  164. package/dist/core/utils/testing/McpStreamableHttpClient.d.ts +24 -30
  165. package/dist/core/utils/testing/McpStreamableHttpClient.d.ts.map +1 -1
  166. package/dist/core/utils/testing/McpStreamableHttpClient.js +36 -198
  167. package/dist/core/utils/testing/McpStreamableHttpClient.js.map +1 -1
  168. package/dist/core/utils/utils.d.ts.map +1 -1
  169. package/dist/core/utils/utils.js +2 -0
  170. package/dist/core/utils/utils.js.map +1 -1
  171. package/dist/core/web/admin-router.js +3 -3
  172. package/dist/core/web/admin-router.js.map +1 -1
  173. package/dist/core/web/cors.d.ts +9 -1
  174. package/dist/core/web/cors.d.ts.map +1 -1
  175. package/dist/core/web/cors.js +26 -5
  176. package/dist/core/web/cors.js.map +1 -1
  177. package/dist/core/web/event-store.d.ts +33 -0
  178. package/dist/core/web/event-store.d.ts.map +1 -0
  179. package/dist/core/web/event-store.js +65 -0
  180. package/dist/core/web/event-store.js.map +1 -0
  181. package/dist/core/web/oauth-router.d.ts +37 -0
  182. package/dist/core/web/oauth-router.d.ts.map +1 -0
  183. package/dist/core/web/oauth-router.js +207 -0
  184. package/dist/core/web/oauth-router.js.map +1 -0
  185. package/dist/core/web/request-id.d.ts +44 -0
  186. package/dist/core/web/request-id.d.ts.map +1 -0
  187. package/dist/core/web/request-id.js +82 -0
  188. package/dist/core/web/request-id.js.map +1 -0
  189. package/dist/core/web/server-http.d.ts.map +1 -1
  190. package/dist/core/web/server-http.js +322 -182
  191. package/dist/core/web/server-http.js.map +1 -1
  192. package/package.json +15 -2
  193. package/scripts/claude-2-agents-symlink.js +10 -1
  194. package/scripts/generate-jwt.js +129 -51
  195. package/src/template/custom-resources.ts +14 -0
  196. package/src/template/prompts/custom-prompts.ts +4 -0
  197. package/src/template/tools/handle-tool-call.ts +59 -3
  198. package/src/template/tools/tools.ts +92 -31
  199. package/src/tests/mcp/test-http.js +1 -1
  200. package/src/tests/mcp/test-sse.js +1 -1
@@ -252,6 +252,16 @@ mcp:
252
252
  maxRequests: 100
253
253
  #> Rate limit window length in milliseconds (1 minute)
254
254
  windowMs: 60000
255
+ scope: subject
256
+ maxConcurrentPerSubject: 16
257
+ #> Hard ceilings enforced by the HTTP transport (standard §14).
258
+ limits:
259
+ #> Max accepted JSON / urlencoded request body, bytes. Default 1 MiB.
260
+ maxPayloadBytes: 1048576
261
+ #> Max serialized tool result, bytes. Default 10 MiB.
262
+ maxToolResultBytes: 10485760
263
+ #> Per-tool execution timeout, milliseconds. Default 30 s.
264
+ toolTimeoutMs: 30000
255
265
  #> Tool listing and response behavior
256
266
  tools:
257
267
  #> Response format configuration.
@@ -267,6 +277,36 @@ mcp:
267
277
  logFile: ''
268
278
  #> Register built-in MCP App / test helper tools. Default: false.
269
279
  builtinTools: false
280
+ #> Standard §8.4 — server-side pagination. See default.yaml for full documentation.
281
+ pagination:
282
+ pageSize: 100
283
+ #> Standard §11.5 — optional MAY resource capabilities.
284
+ resources:
285
+ subscribeEnabled: false
286
+ templatesEnabled: false
287
+ #> Standard §15.2 + §8.2 — MCP `logging` capability.
288
+ logging:
289
+ enabled: true
290
+ defaultLevel: info
291
+ maxBodyBytes: 4096
292
+ #> Standard §8.6 — notifications/progress throttle.
293
+ progress:
294
+ throttleMs: 100
295
+ #> Standard §8.2 (MAY) — completion/complete capability. Off by default; see default.yaml.
296
+ completions:
297
+ enabled: false
298
+ #> Standard §8.7 (MAY) — task-augmented execution. Off by default; see default.yaml.
299
+ tasks:
300
+ enabled: false
301
+ defaultTtlMs: 3600000
302
+ minTtlMs: 0
303
+ maxTtlMs: 86400000
304
+ pollIntervalMs: 1000
305
+ maxTasks: 1000
306
+ #> Standard §6 (MAY) — Streamable HTTP SSE stream resumability via Last-Event-ID. Off by default.
307
+ sse:
308
+ resumability: false
309
+ maxStoredEvents: 1000
270
310
 
271
311
  #> Swagger / OpenAPI documentation settings
272
312
  swagger:
@@ -288,8 +328,10 @@ uiColor:
288
328
 
289
329
  #> HTTP server hosting MCP, admin panel, agent tester, swagger and health endpoints
290
330
  webServer:
291
- #> Bind address for the HTTP server
292
- host: '0.0.0.0'
331
+ #> Bind address for the HTTP server.
332
+ #> Default: '127.0.0.1' — loopback only (safer default, standard §6).
333
+ #> Set to '0.0.0.0' explicitly to listen on every interface.
334
+ host: '127.0.0.1'
293
335
  #> TCP port for the HTTP server
294
336
  port: {{port}}
295
337
  #> Array of hosts that CORS skips
@@ -315,17 +357,13 @@ webServer:
315
357
  permanentServerTokens: [ 'token' ]
316
358
 
317
359
  #> ========================================================================
318
- #> JWT TOKEN — standard signed JWT (HS256)
319
- #> Tokens issued by this SDK are standard 3-segment JWTs `header.payload.signature`.
320
- #> The verifier also temporarily accepts pre-migration legacy tokens
321
- #> (`<expire_ms>.<hex>` AES-256-CTR format) for backward compatibility.
322
- #> CPU cost: Medium — signature verification + JSON parsing
323
- #>
324
- #> To enable this authentication, you need to set auth.enabled = true and set
325
- #> encryptKey to at least 8 characters (used as the HS256 signing secret).
360
+ #> JWT TOKEN
361
+ #> See config/default.yaml for full mode documentation. Modes:
362
+ #> legacyAesCtr (default) | embedded | localKey | remoteJwks
326
363
  #> ========================================================================
327
364
  jwtToken:
328
- #> HS256 signing secret used to sign/verify tokens for this MCP (minimum 8 chars)
365
+ mode: legacyAesCtr
366
+ #> HS256 signing secret — used ONLY by legacyAesCtr mode (minimum 8 chars).
329
367
  encryptKey: {{webServer.auth.token.encryptKey}}
330
368
  #> If webServer.auth.enabled and the parameter true, the service name and the service specified in the token will be checked
331
369
  checkMCPName: {{webServer.auth.token.checkMCPName}}
@@ -335,6 +373,19 @@ webServer:
335
373
  #> Optional JWT `iss` claim. When non-empty, the generator stamps it and the verifier requires it.
336
374
  issuer: ''
337
375
 
376
+ #> -------- Modes embedded / localKey / remoteJwks --------
377
+ algorithm: ES256
378
+ keyStoragePath: './keys'
379
+ publicKeyPath: ''
380
+ privateKeyPath: ''
381
+ jwksUri: ''
382
+ expectedIssuer: ''
383
+ expectedAudience: ''
384
+ jwksCacheTtl: 600
385
+ jwksCooldown: 30
386
+ clockSkew: 30
387
+ defaultTtl: 1800
388
+
338
389
  #> ========================================================================
339
390
  #> Basic Authentication — Base64 encoded username:password
340
391
  #> CPU cost: Medium — Base64 decoding + string comparison
@@ -367,3 +418,14 @@ webServer:
367
418
  #> Requires valid Authorization header (any method configured in webServer.auth).
368
419
  #> ========================================================================
369
420
  genJwtApiEnable: false
421
+
422
+ tokenCheck:
423
+ allowQueryToken: false
424
+
425
+ trustProxy: false
426
+
427
+ #> Standard §15.3 — Prometheus metrics endpoint (opt-in).
428
+ metrics:
429
+ enabled: false
430
+ path: '/metrics'
431
+ includeProcessMetrics: true
@@ -43,6 +43,20 @@ mcp:
43
43
  rateLimit:
44
44
  maxRequests: MCP_RATE_LIMIT_MAX_REQUESTS
45
45
  windowMs: MCP_RATE_LIMIT_WINDOW_MS
46
+ scope: MCP_RATE_LIMIT_SCOPE
47
+ maxConcurrentPerSubject:
48
+ __name: MCP_RATE_LIMIT_MAX_CONCURRENT_PER_SUBJECT
49
+ __format: number
50
+ limits:
51
+ maxPayloadBytes:
52
+ __name: MCP_LIMITS_MAX_PAYLOAD_BYTES
53
+ __format: number
54
+ maxToolResultBytes:
55
+ __name: MCP_LIMITS_MAX_TOOL_RESULT_BYTES
56
+ __format: number
57
+ toolTimeoutMs:
58
+ __name: MCP_LIMITS_TOOL_TIMEOUT_MS
59
+ __format: number
46
60
  tools:
47
61
  answerAs: MCP_TOOLS_ANSWER_AS
48
62
  hideAnnotations: MCP_TOOLS_HIDE_ANNOTATIONS
@@ -51,6 +65,59 @@ mcp:
51
65
  builtinTools:
52
66
  __name: MCP_DEBUG_BUILTIN_TOOLS
53
67
  __format: boolean
68
+ pagination:
69
+ pageSize:
70
+ __name: MCP_PAGINATION_PAGE_SIZE
71
+ __format: number
72
+ resources:
73
+ subscribeEnabled:
74
+ __name: MCP_RESOURCES_SUBSCRIBE_ENABLED
75
+ __format: boolean
76
+ templatesEnabled:
77
+ __name: MCP_RESOURCES_TEMPLATES_ENABLED
78
+ __format: boolean
79
+ logging:
80
+ enabled:
81
+ __name: MCP_LOGGING_ENABLED
82
+ __format: boolean
83
+ defaultLevel: MCP_LOGGING_DEFAULT_LEVEL
84
+ maxBodyBytes:
85
+ __name: MCP_LOGGING_MAX_BODY_BYTES
86
+ __format: number
87
+ progress:
88
+ throttleMs:
89
+ __name: MCP_PROGRESS_THROTTLE_MS
90
+ __format: number
91
+ completions:
92
+ enabled:
93
+ __name: MCP_COMPLETIONS_ENABLED
94
+ __format: boolean
95
+ tasks:
96
+ enabled:
97
+ __name: MCP_TASKS_ENABLED
98
+ __format: boolean
99
+ defaultTtlMs:
100
+ __name: MCP_TASKS_DEFAULT_TTL_MS
101
+ __format: number
102
+ minTtlMs:
103
+ __name: MCP_TASKS_MIN_TTL_MS
104
+ __format: number
105
+ maxTtlMs:
106
+ __name: MCP_TASKS_MAX_TTL_MS
107
+ __format: number
108
+ pollIntervalMs:
109
+ __name: MCP_TASKS_POLL_INTERVAL_MS
110
+ __format: number
111
+ maxTasks:
112
+ __name: MCP_TASKS_MAX_TASKS
113
+ __format: number
114
+ sse:
115
+ resumability:
116
+ __name: MCP_SSE_RESUMABILITY
117
+ __format: boolean
118
+ maxStoredEvents:
119
+ __name: MCP_SSE_MAX_STORED_EVENTS
120
+ __format: number
54
121
 
55
122
  uiColor:
56
123
  primary: UI_COLOR_PRIMARY
@@ -62,11 +129,46 @@ webServer:
62
129
  enabled: WS_AUTH_ENABLED
63
130
  permanentServerTokens: WS_SERVER_TOKENS # comma separated list
64
131
  jwtToken:
132
+ mode: WS_JWT_MODE # legacyAesCtr | embedded | localKey | remoteJwks
65
133
  encryptKey: WS_TOKEN_ENCRYPT_KEY
66
134
  checkMCPName: WS_CHECK_MC_NAME
67
135
  isCheckIP: WS_JWT_CHECK_IP
68
136
  issuer: WS_JWT_ISSUER
137
+ algorithm: WS_JWT_ALGORITHM # ES256 | RS256
138
+ keyStoragePath: WS_JWT_KEY_STORAGE_PATH
139
+ publicKeyPath: WS_JWT_PUBLIC_KEY_PATH
140
+ privateKeyPath: WS_JWT_PRIVATE_KEY_PATH
141
+ jwksUri: WS_JWT_JWKS_URI
142
+ expectedIssuer: WS_JWT_EXPECTED_ISSUER
143
+ expectedAudience: WS_JWT_EXPECTED_AUDIENCE
144
+ jwksCacheTtl:
145
+ __name: WS_JWT_JWKS_CACHE_TTL
146
+ __format: number
147
+ jwksCooldown:
148
+ __name: WS_JWT_JWKS_COOLDOWN
149
+ __format: number
150
+ clockSkew:
151
+ __name: WS_JWT_CLOCK_SKEW
152
+ __format: number
153
+ defaultTtl:
154
+ __name: WS_JWT_DEFAULT_TTL
155
+ __format: number
69
156
  basic:
70
157
  username: WS_AUTH_BASIC_USERNAME
71
158
  password: WS_AUTH_BASIC_PASSWORD
72
159
  genJwtApiEnable: WS_GEN_JWT_API_ENABLE
160
+ tokenCheck:
161
+ allowQueryToken:
162
+ __name: WS_TOKEN_CHECK_ALLOW_QUERY
163
+ __format: boolean
164
+ trustProxy:
165
+ __name: WS_TRUST_PROXY
166
+ __format: boolean
167
+ metrics:
168
+ enabled:
169
+ __name: WS_METRICS_ENABLED
170
+ __format: boolean
171
+ path: WS_METRICS_PATH
172
+ includeProcessMetrics:
173
+ __name: WS_METRICS_INCLUDE_PROCESS
174
+ __format: boolean
@@ -249,6 +249,23 @@ mcp:
249
249
  maxRequests: 100
250
250
  #> Rate limit window length in milliseconds (1 minute)
251
251
  windowMs: 60000
252
+ #> Standard §14 — 'subject' counts requests per JWT `sub` (fallback to IP when no JWT).
253
+ #> 'ip' = legacy behavior. Default: 'subject'.
254
+ scope: subject
255
+ #> Max simultaneous in-flight tools/call requests per subject. Excess → -32003 / 429 + Retry-After.
256
+ maxConcurrentPerSubject: 16
257
+ #> Hard ceilings enforced by the HTTP transport (standard §14).
258
+ #> Concrete servers MAY raise or lower these values without patching SDK code.
259
+ limits:
260
+ #> Max accepted JSON / urlencoded request body, bytes. Default 1 MiB.
261
+ #> Bodies above this limit are rejected with JSON-RPC code -32005 / HTTP 413.
262
+ maxPayloadBytes: 1048576
263
+ #> Max serialized tool result, bytes. Default 10 MiB.
264
+ #> Responses above this limit are truncated with an explicit `truncated: true` marker.
265
+ maxToolResultBytes: 10485760
266
+ #> Per-tool execution timeout, milliseconds. Default 30 s.
267
+ #> Exceeded calls return JSON-RPC code -32004 / HTTP 504.
268
+ toolTimeoutMs: 30000
252
269
  #> Tool listing and response behavior
253
270
  tools:
254
271
  #> Response format configuration.
@@ -273,6 +290,69 @@ mcp:
273
290
  #> only callable from MCP App widgets (app.callServerTool(...)) or test
274
291
  #> clients. Default: false.
275
292
  builtinTools: false
293
+ #> Standard §8.4 — server-side pagination for tools/list, prompts/list, resources/list.
294
+ pagination:
295
+ #> Items per page. Default 100.
296
+ pageSize: 100
297
+ #> Standard §11.5 — optional MAY resource capabilities. Off by default.
298
+ resources:
299
+ #> Enable resources/subscribe + notifications/resources/updated. Only turn on
300
+ #> when the project has dynamic resources; static resource sets do not benefit.
301
+ subscribeEnabled: false
302
+ #> Enable resources/templates/list (returns empty array if no templates configured).
303
+ templatesEnabled: false
304
+ #> Standard §15.2 + §8.2 — MCP `logging` capability. When enabled (default), the server
305
+ #> advertises `logging: {}` on initialize and accepts `logging/setLevel` to throttle
306
+ #> notifications/message emissions.
307
+ logging:
308
+ #> Set false to suppress the capability (compat tests against older clients).
309
+ enabled: true
310
+ #> Initial severity threshold (Syslog ladder). Levels: debug | info | notice | warning |
311
+ #> error | critical | alert | emergency. Default: info.
312
+ defaultLevel: info
313
+ #> Max serialized `data` payload in bytes. Anything longer is truncated. Default: 4096.
314
+ maxBodyBytes: 4096
315
+ #> Standard §8.6 — `notifications/progress` throttling. Minimum gap between successive
316
+ #> emissions for a single progressToken. Default 100 ms (10 events/s).
317
+ progress:
318
+ throttleMs: 100
319
+ #> Standard §8.2 (MAY) — `completion/complete` capability (argument autocompletion).
320
+ #> Off by default. Even when enabled, the capability is advertised only if the project also
321
+ #> supplies a `completionProvider` in McpServerData — otherwise there is nothing to serve.
322
+ completions:
323
+ #> Set true (and provide completionProvider) to advertise `completions: {}` and accept
324
+ #> completion/complete requests. Default: false.
325
+ enabled: false
326
+ #> Standard §8.7 (MAY) — task-augmented execution (long-running / pollable tool calls). Off by
327
+ #> default. When enabled, the server advertises the `tasks` capability and accepts tasks/list,
328
+ #> tasks/get, tasks/result, tasks/cancel. Long-running tools opt in per-tool via
329
+ #> `execution.taskSupport` in their declaration. The default store keeps tasks in process memory
330
+ #> only and does not survive a restart.
331
+ tasks:
332
+ #> Set true to advertise `tasks` capability and accept the task lifecycle methods. Default false.
333
+ enabled: false
334
+ #> Default retention of a finished task, milliseconds, from creation. A client-requested ttl is
335
+ #> clamped to [minTtlMs, maxTtlMs]. Default 3600000 (1 hour).
336
+ defaultTtlMs: 3600000
337
+ #> Lower bound a client-requested ttl is clamped to, milliseconds. Default 0 (no floor).
338
+ minTtlMs: 0
339
+ #> Hard upper bound on retention, milliseconds. Default 86400000 (24 hours).
340
+ maxTtlMs: 86400000
341
+ #> Recommended poll interval suggested to the client in every task object, milliseconds.
342
+ #> Default 1000.
343
+ pollIntervalMs: 1000
344
+ #> Max number of simultaneously retained tasks across all subjects. Oldest finished tasks are
345
+ #> evicted first when the cap is reached. Default 1000.
346
+ maxTasks: 1000
347
+ #> Standard §6 (MAY) — Streamable HTTP SSE stream resumability via the `Last-Event-ID` header.
348
+ #> Off by default. When enabled, the server keeps recent SSE events in process memory so a
349
+ #> reconnecting client can replay missed messages. The buffer is in-memory only: it is lost on
350
+ #> restart and does not span multiple server instances.
351
+ sse:
352
+ #> Set true to attach the in-memory EventStore to the Streamable HTTP transport. Default false.
353
+ resumability: false
354
+ #> Max number of events retained per process for replay. Default 1000.
355
+ maxStoredEvents: 1000
276
356
 
277
357
  #> Swagger / OpenAPI documentation settings
278
358
  swagger:
@@ -294,8 +374,10 @@ uiColor:
294
374
 
295
375
  #> HTTP server hosting MCP, admin panel, agent tester, swagger and health endpoints
296
376
  webServer:
297
- #> Bind address for the HTTP server
298
- host: '0.0.0.0'
377
+ #> Bind address for the HTTP server.
378
+ #> Default: '127.0.0.1' — loopback only (safer default, standard §6).
379
+ #> Set to '0.0.0.0' explicitly to listen on every interface (containers, public-facing deployments).
380
+ host: '127.0.0.1'
299
381
  #> TCP port for the HTTP server
300
382
  port: {{port}}
301
383
  #> Array of hosts that CORS skips
@@ -321,17 +403,25 @@ webServer:
321
403
  permanentServerTokens: [ 'token' ]
322
404
 
323
405
  #> ========================================================================
324
- #> JWT TOKEN — standard signed JWT (HS256)
325
- #> Tokens issued by this SDK are standard 3-segment JWTs `header.payload.signature`.
326
- #> The verifier also temporarily accepts pre-migration legacy tokens
327
- #> (`<expire_ms>.<hex>` AES-256-CTR format) for backward compatibility.
406
+ #> JWT TOKEN
407
+ #> Four operating modes:
408
+ #> legacyAesCtr (default) HS256 issue + legacy AES-CTR read. Uses `encryptKey`
409
+ #> below. Backward-compatible behavior no migration needed.
410
+ #> embedded — ES256/RS256 with built-in IdP. Server auto-generates a
411
+ #> keypair into `keyStoragePath` on first start, publishes
412
+ #> JWKS at /.well-known/jwks.json, and exposes
413
+ #> POST /oauth/token (grant_type=password). For dev / demo.
414
+ #> localKey — ES256/RS256 verify against a public key on disk
415
+ #> (`publicKeyPath`). Issuance requires `privateKeyPath`.
416
+ #> remoteJwks — Production: verify against a remote IdP's JWKS endpoint
417
+ #> (`jwksUri`). This server does NOT issue tokens —
418
+ #> obtain them from the IdP.
328
419
  #> CPU cost: Medium — signature verification + JSON parsing
329
- #>
330
- #> To enable this authentication, you need to set auth.enabled = true and set
331
- #> encryptKey to at least 8 characters (used as the HS256 signing secret).
332
420
  #> ========================================================================
333
421
  jwtToken:
334
- #> HS256 signing secret used to sign/verify tokens for this MCP (minimum 8 chars)
422
+ #> Operating mode (see above). Default: legacyAesCtr (preserves existing behavior).
423
+ mode: legacyAesCtr
424
+ #> HS256 signing secret — used ONLY by legacyAesCtr mode (minimum 8 chars).
335
425
  encryptKey: '***'
336
426
  #> If webServer.auth.enabled and the parameter true, the service name and the service specified in the token will be checked
337
427
  checkMCPName: true
@@ -339,9 +429,38 @@ webServer:
339
429
  #> the client IP will be checked against the allowed list in the token
340
430
  isCheckIP: false
341
431
  #> Optional JWT `iss` claim. When non-empty, the generator stamps it and the verifier requires it.
342
- #> Leave empty to skip issuer enforcement.
432
+ #> Leave empty to skip issuer enforcement. Used by legacyAesCtr mode.
343
433
  issuer: ''
344
434
 
435
+ #> -------- Settings below apply ONLY to modes embedded / localKey / remoteJwks --------
436
+
437
+ #> Asymmetric signing algorithm. ES256 (ECDSA P-256) recommended — smaller tokens, faster.
438
+ algorithm: ES256
439
+ #> Directory for embedded keypair (private.pem + public.pem). Auto-generated on first run.
440
+ #> Used only in mode=embedded. Default: ./keys
441
+ keyStoragePath: './keys'
442
+ #> Path to public key PEM. Used only in mode=localKey.
443
+ publicKeyPath: ''
444
+ #> Path to private key PEM. Optional — when set, allows local issuance via
445
+ #> generate-jwt.js and POST /gen-jwt. Used in mode=localKey.
446
+ privateKeyPath: ''
447
+ #> Remote JWKS endpoint URL. Used only in mode=remoteJwks.
448
+ #> Example: https://idp.example.com/.well-known/jwks.json
449
+ jwksUri: ''
450
+ #> Expected `iss` claim. Required match in modes embedded/localKey/remoteJwks.
451
+ #> In embedded mode auto-derived from request origin if empty.
452
+ expectedIssuer: ''
453
+ #> Expected `aud` claim. Defaults to appConfig.name when empty.
454
+ expectedAudience: ''
455
+ #> JWKS in-memory cache TTL (seconds). Default: 600 (10 min).
456
+ jwksCacheTtl: 600
457
+ #> Minimum interval between repeat JWKS fetches when kid is missing (seconds). Default: 30.
458
+ jwksCooldown: 30
459
+ #> Allowed clock skew for exp/nbf checks (seconds). Default: 30. Max enforced: 60 (standard Прил. A.1).
460
+ clockSkew: 30
461
+ #> Default TTL (seconds) for tokens issued by embedded /oauth/token endpoint. Default: 1800 (30 min).
462
+ defaultTtl: 1800
463
+
345
464
  #> ========================================================================
346
465
  #> Basic Authentication — Base64 encoded username:password
347
466
  #> CPU cost: Medium — Base64 decoding + string comparison
@@ -374,3 +493,37 @@ webServer:
374
493
  #> Requires valid Authorization header (any method configured in webServer.auth).
375
494
  #> ========================================================================
376
495
  genJwtApiEnable: false
496
+
497
+ #> ========================================================================
498
+ #> TOKEN CHECK ENDPOINT (/ct)
499
+ #> Standard §7.1 forbids passing secrets in URL query strings (logs / referrers).
500
+ #> By default only POST /ct with JSON body { "t": "<token>" } is accepted.
501
+ #> GET /ct?t=<token> is disabled and returns HTTP 405.
502
+ #> ========================================================================
503
+ tokenCheck:
504
+ #> Allow legacy GET /ct?t=<token> form. Ignored when NODE_ENV=production.
505
+ #> Default: false (compliant with standard §7.1).
506
+ allowQueryToken: false
507
+
508
+ #> ========================================================================
509
+ #> Trust proxy (used by /.well-known/openid-configuration etc. to derive issuer
510
+ #> from X-Forwarded-Proto / X-Forwarded-Host). Set true behind HTTPS reverse proxy.
511
+ #> ========================================================================
512
+ trustProxy: false
513
+
514
+ #> ========================================================================
515
+ #> Standard §15.3 — Prometheus metrics endpoint.
516
+ #> Opt-in. Endpoint is PUBLIC (no auth) — protect via network policy / reverse proxy
517
+ #> when the server is reachable from the network.
518
+ #> Metrics exposed: mcp_tool_calls_total, mcp_tool_duration_seconds,
519
+ #> mcp_auth_failures_total, mcp_rate_limit_hits_total, mcp_http_requests_total,
520
+ #> mcp_concurrent_calls, mcp_payload_bytes, mcp_result_bytes + Node.js process metrics.
521
+ #> ========================================================================
522
+ metrics:
523
+ #> Set true to mount the metrics endpoint. Default: false.
524
+ enabled: false
525
+ #> URL path. Default: /metrics.
526
+ path: '/metrics'
527
+ #> Include Node.js process metrics (GC, heap, uptime). Default: true. Disable to shed
528
+ #> ~30 default series when scraping many SDK instances.
529
+ includeProcessMetrics: true
package/config/local.yaml CHANGED
@@ -52,25 +52,25 @@ consul:
52
52
  prod: aitr01
53
53
  dev: aite01
54
54
 
55
- db:
56
- postgres:
57
- dbs:
58
- main:
59
- label: 'znayka_dev on DEV-1'
60
- host: 127.0.0.1
61
- database: znayka_dev
62
- port: 5432
63
- password: Glaui46X49
64
- user: znayka_dev
65
- powerPassword: mCyDLHUZhbyj
66
- powerUser: postgres
67
- usedExtensions:
68
- - pgvector
69
- ssh:
70
- host: MSK-AITE01-AP01
71
- port: 22
72
- username: root
73
- privateKey: 'C:\Users\vv\.ssh\id_rsa_finam_vvmakarov'
55
+ #db:
56
+ # postgres:
57
+ # dbs:
58
+ # main:
59
+ # label: 'znayka_dev on DEV-1'
60
+ # host: 127.0.0.1
61
+ # database: znayka_dev
62
+ # port: 5432
63
+ # password: Glaui46X49
64
+ # user: znayka_dev
65
+ # powerPassword: mCyDLHUZhbyj
66
+ # powerUser: postgres
67
+ # usedExtensions:
68
+ # - pgvector
69
+ # ssh:
70
+ # host: MSK-AITE01-AP01
71
+ # port: 22
72
+ # username: root
73
+ # privateKey: 'C:\Users\vv\.ssh\id_rsa_finam_vvmakarov'
74
74
 
75
75
  homePage:
76
76
  helpLink:
@@ -99,6 +99,7 @@ webServer:
99
99
  enabled: true
100
100
  permanentServerTokens: [ 'test-token' ]
101
101
  jwtToken:
102
+ mode: legacyAesCtr
102
103
  encryptKey: '66666666-7777-8888-9999-000000000000'
103
104
  checkMCPName: true
104
105
  isCheckIP: false
@@ -16,10 +16,22 @@ interface IWebServerConfig {
16
16
  password: string;
17
17
  };
18
18
  jwtToken: {
19
+ mode?: 'legacyAesCtr' | 'embedded' | 'localKey' | 'remoteJwks';
19
20
  encryptKey: string;
20
21
  checkMCPName: boolean;
21
22
  isCheckIP: boolean;
22
23
  issuer?: string;
24
+ algorithm?: 'ES256' | 'RS256';
25
+ keyStoragePath?: string;
26
+ publicKeyPath?: string;
27
+ privateKeyPath?: string;
28
+ jwksUri?: string;
29
+ expectedIssuer?: string;
30
+ expectedAudience?: string;
31
+ jwksCacheTtl?: number;
32
+ jwksCooldown?: number;
33
+ clockSkew?: number;
34
+ defaultTtl?: number;
23
35
  };
24
36
  permanentServerTokens: string[];
25
37
  revoked?: {
@@ -31,6 +43,15 @@ interface IWebServerConfig {
31
43
  };
32
44
  };
33
45
  genJwtApiEnable: boolean;
46
+ tokenCheck?: {
47
+ allowQueryToken?: boolean;
48
+ };
49
+ trustProxy?: boolean | string | number;
50
+ metrics?: {
51
+ enabled?: boolean;
52
+ path?: string;
53
+ includeProcessMetrics?: boolean;
54
+ };
34
55
  };
35
56
  }
36
57
  interface IAdminPanelConfig {
@@ -52,12 +73,110 @@ interface IMCPConfig {
52
73
  rateLimit: {
53
74
  maxRequests: number;
54
75
  windowMs: number;
76
+ scope?: 'subject' | 'ip';
77
+ maxConcurrentPerSubject?: number;
78
+ };
79
+ /**
80
+ * Hard ceilings enforced by the HTTP transport. Standard §14 defines the defaults;
81
+ * concrete servers MAY raise or lower them via `config/*.yaml`.
82
+ */
83
+ limits: {
84
+ /** Max accepted JSON / urlencoded request body, bytes. Default 1 MiB (1_048_576). */
85
+ maxPayloadBytes: number;
86
+ /** Max serialized tool result, bytes. Anything above is truncated with explicit markers. */
87
+ maxToolResultBytes: number;
88
+ /** Per-tool execution timeout, milliseconds. */
89
+ toolTimeoutMs: number;
55
90
  };
56
91
  transportType: 'stdio' | 'http';
57
92
  tools: {
58
93
  answerAs: 'text' | 'structuredContent';
59
94
  hideAnnotations: boolean;
60
95
  };
96
+ /**
97
+ * Standard §8.4 — server-side pagination for `tools/list`, `prompts/list`, `resources/list`.
98
+ * Cursor is opaque base64(offset); page is sorted stably by `name` / `uri`.
99
+ */
100
+ pagination?: {
101
+ /** Items per page. Default 100. */
102
+ pageSize?: number;
103
+ };
104
+ /**
105
+ * Standard §11.5 — optional MAY capabilities. Off by default.
106
+ */
107
+ resources?: {
108
+ /** Enable `resources/subscribe` + `notifications/resources/updated`. */
109
+ subscribeEnabled?: boolean;
110
+ /** Enable `resources/templates/list`. */
111
+ templatesEnabled?: boolean;
112
+ };
113
+ /**
114
+ * Standard §15.2 + §8.2 — MCP `logging` capability. When enabled, the server declares
115
+ * `logging: {}` on initialize and accepts `logging/setLevel` to throttle emissions.
116
+ */
117
+ logging?: {
118
+ /** Default `true`. Set to `false` to suppress `logging` capability advertisement. */
119
+ enabled?: boolean;
120
+ /** Initial severity threshold. Syslog ladder; default `info`. */
121
+ defaultLevel?: 'debug' | 'info' | 'notice' | 'warning' | 'error' | 'critical' | 'alert' | 'emergency';
122
+ /** Max serialized `data` payload, bytes. Anything above is truncated. Default 4096. */
123
+ maxBodyBytes?: number;
124
+ };
125
+ /**
126
+ * Standard §8.6 — `notifications/progress` server-side throttling.
127
+ */
128
+ progress?: {
129
+ /** Minimum gap between successive progress emissions, milliseconds. Default 100 (10 events/s). */
130
+ throttleMs?: number;
131
+ };
132
+ /**
133
+ * Standard §8.2 (MAY) — `completion/complete` capability. Off by default. Even when enabled,
134
+ * the capability is advertised only if `McpServerData.completionProvider` is also supplied.
135
+ */
136
+ completions?: {
137
+ /** Default `false`. Set `true` (plus a `completionProvider`) to advertise `completions: {}`. */
138
+ enabled?: boolean;
139
+ };
140
+ /**
141
+ * Standard §8.7 (MAY) — task-augmented execution. Off by default. When enabled, the server
142
+ * advertises the `tasks` capability and accepts the task lifecycle methods (`tasks/list`,
143
+ * `tasks/get`, `tasks/result`, `tasks/cancel`). Individual long-running tools opt in via
144
+ * `execution.taskSupport` in their declaration (§9.1). The default task store keeps records in
145
+ * process memory only — it does not survive a restart.
146
+ */
147
+ tasks?: {
148
+ /** Default `false`. Set `true` to advertise `tasks` capability and accept task methods. */
149
+ enabled?: boolean;
150
+ /**
151
+ * Default retention of a finished task, milliseconds, measured from creation. A client may
152
+ * request a different `ttl`; the server clamps it to `[minTtlMs ?? 0, maxTtlMs]`.
153
+ * Default 3_600_000 (1 hour).
154
+ */
155
+ defaultTtlMs?: number;
156
+ /** Lower bound a client-requested `ttl` is clamped to, milliseconds. Default 0 (no floor). */
157
+ minTtlMs?: number;
158
+ /** Hard upper bound on retention, milliseconds. Default 86_400_000 (24 hours). */
159
+ maxTtlMs?: number;
160
+ /** Recommended poll interval suggested to the client in every task object. Default 1000. */
161
+ pollIntervalMs?: number;
162
+ /**
163
+ * Max number of simultaneously retained tasks across all subjects. When the cap is reached,
164
+ * the oldest finished tasks are evicted first. Default 1000.
165
+ */
166
+ maxTasks?: number;
167
+ };
168
+ /**
169
+ * Standard §6 (MAY) — Streamable HTTP SSE stream resumability via the `Last-Event-ID` header.
170
+ * Off by default. When enabled, the server wires an in-memory `EventStore` into the transport
171
+ * so a reconnecting client can replay the messages it missed. The store lives in process memory
172
+ * only — it does not survive a restart and does not span multiple server instances.
173
+ */
174
+ sse?: {
175
+ /** Default `false`. Set `true` to attach the in-memory EventStore to the Streamable HTTP transport. */
176
+ resumability?: boolean;
177
+ /** Max number of events retained per process for replay. Default 1000. */
178
+ maxStoredEvents?: number;
179
+ };
61
180
  /**
62
181
  * Debug & diagnostics. All keys are optional and disabled by default — the
63
182
  * stderr `DEBUG=mcp:*` stream keeps working independently of this section.