mcp-server-framework 1.0.0 → 1.0.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.
- package/CHANGELOG.md +47 -0
- package/LICENSE-GPL.txt +675 -0
- package/LICENSE.txt +165 -0
- package/README.md +3 -5
- package/build/config/env.d.ts +11 -10
- package/build/config/env.d.ts.map +1 -1
- package/build/config/env.js +29 -17
- package/build/config/env.js.map +1 -1
- package/build/config/file/loader.js +1 -1
- package/build/config/file/schema.d.ts +18 -18
- package/build/config/file/schema.d.ts.map +1 -1
- package/build/config/file/schema.js +10 -10
- package/build/config/file/schema.js.map +1 -1
- package/build/errors/categories/validation.js +6 -6
- package/build/errors/categories/validation.js.map +1 -1
- package/build/errors/factory.d.ts +1 -1
- package/build/errors/factory.d.ts.map +1 -1
- package/build/errors/factory.js +1 -1
- package/build/errors/factory.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/logger/formatters/text-formatter.d.ts +4 -3
- package/build/logger/formatters/text-formatter.d.ts.map +1 -1
- package/build/logger/formatters/text-formatter.js +4 -3
- package/build/logger/formatters/text-formatter.js.map +1 -1
- package/build/mcp/capabilities/registry/tool-registry.d.ts.map +1 -1
- package/build/mcp/capabilities/registry/tool-registry.js +7 -2
- package/build/mcp/capabilities/registry/tool-registry.js.map +1 -1
- package/build/server/builder/server-builder.js +1 -1
- package/build/server/builder/server-builder.js.map +1 -1
- package/build/server/create-server.d.ts.map +1 -1
- package/build/server/create-server.js +30 -1
- package/build/server/create-server.js.map +1 -1
- package/build/server/middleware/rate-limit.d.ts.map +1 -1
- package/build/server/middleware/rate-limit.js +3 -2
- package/build/server/middleware/rate-limit.js.map +1 -1
- package/build/server/option-overrides.js +1 -1
- package/build/server/option-overrides.js.map +1 -1
- package/build/server/routes/health.d.ts.map +1 -1
- package/build/server/routes/health.js +2 -14
- package/build/server/routes/health.js.map +1 -1
- package/build/server/server-instance.d.ts.map +1 -1
- package/build/server/server-instance.js +4 -8
- package/build/server/server-instance.js.map +1 -1
- package/build/server/server-options.d.ts +6 -4
- package/build/server/server-options.d.ts.map +1 -1
- package/build/server/session/in-memory-store.d.ts.map +1 -1
- package/build/server/session/in-memory-store.js +2 -7
- package/build/server/session/in-memory-store.js.map +1 -1
- package/build/server/session/mcp-session.d.ts.map +1 -1
- package/build/server/session/mcp-session.js +10 -5
- package/build/server/session/mcp-session.js.map +1 -1
- package/build/server/session/session-factory.js +1 -1
- package/build/server/session/session-manager.d.ts +1 -1
- package/build/server/session/session-manager.d.ts.map +1 -1
- package/build/server/session/session-manager.js +15 -12
- package/build/server/session/session-manager.js.map +1 -1
- package/build/server/transport/sse/handler.d.ts.map +1 -1
- package/build/server/transport/sse/handler.js +2 -4
- package/build/server/transport/sse/handler.js.map +1 -1
- package/build/server/transport/streamable-http/stateful-handler.d.ts.map +1 -1
- package/build/server/transport/streamable-http/stateful-handler.js +24 -22
- package/build/server/transport/streamable-http/stateful-handler.js.map +1 -1
- package/build/server/types.d.ts +9 -6
- package/build/server/types.d.ts.map +1 -1
- package/build/telemetry/core/constants.d.ts +6 -4
- package/build/telemetry/core/constants.d.ts.map +1 -1
- package/build/telemetry/core/constants.js +6 -4
- package/build/telemetry/core/constants.js.map +1 -1
- package/build/telemetry/core/types.d.ts +1 -1
- package/build/telemetry/core/types.d.ts.map +1 -1
- package/build/telemetry/sdk.d.ts.map +1 -1
- package/build/telemetry/sdk.js +30 -6
- package/build/telemetry/sdk.js.map +1 -1
- package/build/utils/index.d.ts +2 -2
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +2 -2
- package/build/utils/index.js.map +1 -1
- package/build/utils/string-helpers.d.ts +69 -0
- package/build/utils/string-helpers.d.ts.map +1 -1
- package/build/utils/string-helpers.js +116 -0
- package/build/utils/string-helpers.js.map +1 -1
- package/build/utils/zod-helpers.d.ts +18 -0
- package/build/utils/zod-helpers.d.ts.map +1 -1
- package/build/utils/zod-helpers.js +27 -1
- package/build/utils/zod-helpers.js.map +1 -1
- package/package.json +5 -7
- package/LICENSE-GPL.md +0 -219
- package/LICENSE.md +0 -187
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MCP Server Framework
|
|
2
2
|
|
|
3
|
-
[](LICENSE.
|
|
3
|
+
[](LICENSE.txt)
|
|
4
4
|
[](https://nodejs.org/)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
[](https://modelcontextprotocol.io/)
|
|
@@ -20,11 +20,11 @@ It's opinionated where it matters (security defaults, structured logging, transp
|
|
|
20
20
|
|
|
21
21
|
This framework is a personal project built with best effort and care. AI tools (GitHub Copilot, Claude) were used extensively during development — for code generation, architecture exploration, and documentation. All AI-generated code and documentation has been critically reviewed, tested, and refined by me.
|
|
22
22
|
|
|
23
|
-
That said: this software is provided **as-is, without warranty of any kind**. See the [license](LICENSE.
|
|
23
|
+
That said: this software is provided **as-is, without warranty of any kind**. See the [license](LICENSE.txt) for the full legal terms. If you find bugs or have ideas, [issues](https://github.com/MP-Tool/mcp-server-framework/issues) and contributions are always welcome.
|
|
24
24
|
|
|
25
25
|
## License
|
|
26
26
|
|
|
27
|
-
[LGPL-3.0](LICENSE.
|
|
27
|
+
[LGPL-3.0](LICENSE.txt) — GNU Lesser General Public License v3.0 or later
|
|
28
28
|
|
|
29
29
|
## Features
|
|
30
30
|
|
|
@@ -232,8 +232,6 @@ Sources are merged in order of precedence:
|
|
|
232
232
|
Defaults → .env file → Config file → Environment variables → Programmatic overrides
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
**Environment variables** (excerpt — [full reference](docs/configuration.md)):
|
|
236
|
-
|
|
237
235
|
| Variable | Default | Description |
|
|
238
236
|
|----------|---------|-------------|
|
|
239
237
|
| `MCP_TRANSPORT` | `http` | Transport mode: `stdio`, `http`, `https` |
|
package/build/config/env.d.ts
CHANGED
|
@@ -73,8 +73,8 @@ export declare const frameworkEnvSchema: z.ZodEffects<z.ZodObject<{
|
|
|
73
73
|
MCP_TLS_CA_PATH: z.ZodOptional<z.ZodString>;
|
|
74
74
|
/** Allowed hosts for DNS rebinding protection (comma-separated) */
|
|
75
75
|
MCP_ALLOWED_HOSTS: z.ZodOptional<z.ZodEffects<z.ZodString, string[] | undefined, string>>;
|
|
76
|
-
/** Rate limit window
|
|
77
|
-
MCP_RATE_LIMIT_WINDOW_MS: z.ZodDefault<z.ZodNumber>;
|
|
76
|
+
/** Rate limit window duration (default: '15m' = 900000ms). Accepts human-readable durations like '15m', '1h', '30s'. */
|
|
77
|
+
MCP_RATE_LIMIT_WINDOW_MS: z.ZodPipeline<z.ZodDefault<z.ZodEffects<z.ZodString, number, string>>, z.ZodNumber>;
|
|
78
78
|
/** Maximum requests per rate limit window (default: 1000) */
|
|
79
79
|
MCP_RATE_LIMIT_MAX: z.ZodDefault<z.ZodNumber>;
|
|
80
80
|
/**
|
|
@@ -178,7 +178,7 @@ export declare const frameworkEnvSchema: z.ZodEffects<z.ZodObject<{
|
|
|
178
178
|
MCP_AUTH_RESOURCE_METADATA_URL: z.ZodOptional<z.ZodString>;
|
|
179
179
|
/** Maximum total concurrent sessions across all transports (default: 200) */
|
|
180
180
|
MCP_MAX_SESSIONS: z.ZodDefault<z.ZodNumber>;
|
|
181
|
-
/** Maximum concurrent Streamable HTTP sessions (default:
|
|
181
|
+
/** Maximum concurrent Streamable HTTP sessions (default: 200) */
|
|
182
182
|
MCP_MAX_STREAMABLE_HTTP_SESSIONS: z.ZodDefault<z.ZodNumber>;
|
|
183
183
|
/** Maximum concurrent SSE sessions (default: 50) */
|
|
184
184
|
MCP_MAX_SSE_SESSIONS: z.ZodDefault<z.ZodNumber>;
|
|
@@ -252,12 +252,13 @@ export declare const frameworkEnvSchema: z.ZodEffects<z.ZodObject<{
|
|
|
252
252
|
*/
|
|
253
253
|
OTEL_LOG_LEVEL: z.ZodOptional<z.ZodString>;
|
|
254
254
|
/**
|
|
255
|
-
* Periodic metric export interval
|
|
255
|
+
* Periodic metric export interval.
|
|
256
256
|
*
|
|
257
257
|
* Standard OTEL env var name. Controls how often PeriodicExportingMetricReader
|
|
258
258
|
* pushes metrics to the OTLP endpoint or console.
|
|
259
|
+
* Accepts human-readable durations like '60s', '5m', or plain millisecond counts.
|
|
259
260
|
*/
|
|
260
|
-
OTEL_METRIC_EXPORT_INTERVAL: z.ZodOptional<z.ZodNumber
|
|
261
|
+
OTEL_METRIC_EXPORT_INTERVAL: z.ZodOptional<z.ZodPipeline<z.ZodEffects<z.ZodString, number, string>, z.ZodNumber>>;
|
|
261
262
|
/**
|
|
262
263
|
* Metric exporters to activate (comma-separated).
|
|
263
264
|
*
|
|
@@ -267,7 +268,7 @@ export declare const frameworkEnvSchema: z.ZodEffects<z.ZodObject<{
|
|
|
267
268
|
* - `console` — Log metrics to console (useful for debugging)
|
|
268
269
|
* - `none` — Disable all metric export
|
|
269
270
|
*
|
|
270
|
-
* Default: '
|
|
271
|
+
* Default: 'prometheus' (Prometheus scrape endpoint)
|
|
271
272
|
*/
|
|
272
273
|
OTEL_METRICS_EXPORTER: z.ZodDefault<z.ZodEffects<z.ZodString, string[], string>>;
|
|
273
274
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -331,7 +332,7 @@ export declare const frameworkEnvSchema: z.ZodEffects<z.ZodObject<{
|
|
|
331
332
|
OTEL_TRACES_EXPORTER?: string | undefined;
|
|
332
333
|
OTEL_LOGS_EXPORTER?: string | undefined;
|
|
333
334
|
OTEL_LOG_LEVEL?: string | undefined;
|
|
334
|
-
OTEL_METRIC_EXPORT_INTERVAL?:
|
|
335
|
+
OTEL_METRIC_EXPORT_INTERVAL?: string | undefined;
|
|
335
336
|
VERSION?: string | undefined;
|
|
336
337
|
MCP_BIND_HOST?: string | undefined;
|
|
337
338
|
MCP_PORT?: number | undefined;
|
|
@@ -342,7 +343,7 @@ export declare const frameworkEnvSchema: z.ZodEffects<z.ZodObject<{
|
|
|
342
343
|
MCP_TLS_KEY_PATH?: string | undefined;
|
|
343
344
|
MCP_TLS_CA_PATH?: string | undefined;
|
|
344
345
|
MCP_ALLOWED_HOSTS?: string | undefined;
|
|
345
|
-
MCP_RATE_LIMIT_WINDOW_MS?:
|
|
346
|
+
MCP_RATE_LIMIT_WINDOW_MS?: string | undefined;
|
|
346
347
|
MCP_RATE_LIMIT_MAX?: number | undefined;
|
|
347
348
|
MCP_BODY_SIZE_LIMIT?: string | undefined;
|
|
348
349
|
MCP_TRUST_PROXY?: string | undefined;
|
|
@@ -417,7 +418,7 @@ export declare const frameworkEnvSchema: z.ZodEffects<z.ZodObject<{
|
|
|
417
418
|
OTEL_TRACES_EXPORTER?: string | undefined;
|
|
418
419
|
OTEL_LOGS_EXPORTER?: string | undefined;
|
|
419
420
|
OTEL_LOG_LEVEL?: string | undefined;
|
|
420
|
-
OTEL_METRIC_EXPORT_INTERVAL?:
|
|
421
|
+
OTEL_METRIC_EXPORT_INTERVAL?: string | undefined;
|
|
421
422
|
VERSION?: string | undefined;
|
|
422
423
|
MCP_BIND_HOST?: string | undefined;
|
|
423
424
|
MCP_PORT?: number | undefined;
|
|
@@ -428,7 +429,7 @@ export declare const frameworkEnvSchema: z.ZodEffects<z.ZodObject<{
|
|
|
428
429
|
MCP_TLS_KEY_PATH?: string | undefined;
|
|
429
430
|
MCP_TLS_CA_PATH?: string | undefined;
|
|
430
431
|
MCP_ALLOWED_HOSTS?: string | undefined;
|
|
431
|
-
MCP_RATE_LIMIT_WINDOW_MS?:
|
|
432
|
+
MCP_RATE_LIMIT_WINDOW_MS?: string | undefined;
|
|
432
433
|
MCP_RATE_LIMIT_MAX?: number | undefined;
|
|
433
434
|
MCP_BODY_SIZE_LIMIT?: string | undefined;
|
|
434
435
|
MCP_TRUST_PROXY?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;A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;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,IAAI,CACV,kBAAkB,EAChB,eAAe,GACf,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,kCAAkC,GAClC,sBAAsB,CACzB,GACA,yBAAyB,EAAE,CAwE7B;AAMD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,kBAAkB,CAEjH"}
|
package/build/config/env.js
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module config/env
|
|
9
9
|
*/
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
import { booleanFromEnv, optionalCommaSeparatedList, commaSeparatedList, byteSizeSchema, } from "../utils/zod-helpers.js";
|
|
12
|
-
import { BYTE_SIZE_REGEX } from "../utils/string-helpers.js";
|
|
11
|
+
import { booleanFromEnv, optionalCommaSeparatedList, commaSeparatedList, byteSizeSchema, durationSchema, } from "../utils/zod-helpers.js";
|
|
12
|
+
import { BYTE_SIZE_REGEX, parseDuration } from "../utils/string-helpers.js";
|
|
13
13
|
import { readFileSync, accessSync, constants as fsConstants } from "node:fs";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
import { dirname, join } from "node:path";
|
|
@@ -123,8 +123,8 @@ export const frameworkEnvSchema = z
|
|
|
123
123
|
// ==========================================================================
|
|
124
124
|
/** Allowed hosts for DNS rebinding protection (comma-separated) */
|
|
125
125
|
MCP_ALLOWED_HOSTS: optionalCommaSeparatedList(),
|
|
126
|
-
/** Rate limit window
|
|
127
|
-
MCP_RATE_LIMIT_WINDOW_MS: z.
|
|
126
|
+
/** Rate limit window duration (default: '15m' = 900000ms). Accepts human-readable durations like '15m', '1h', '30s'. */
|
|
127
|
+
MCP_RATE_LIMIT_WINDOW_MS: durationSchema("15m").pipe(z.number().int().min(1000)),
|
|
128
128
|
/** Maximum requests per rate limit window (default: 1000) */
|
|
129
129
|
MCP_RATE_LIMIT_MAX: z.coerce.number().int().min(100).default(1000),
|
|
130
130
|
/**
|
|
@@ -237,8 +237,8 @@ export const frameworkEnvSchema = z
|
|
|
237
237
|
// ==========================================================================
|
|
238
238
|
/** Maximum total concurrent sessions across all transports (default: 200) */
|
|
239
239
|
MCP_MAX_SESSIONS: z.coerce.number().int().min(1).default(200),
|
|
240
|
-
/** Maximum concurrent Streamable HTTP sessions (default:
|
|
241
|
-
MCP_MAX_STREAMABLE_HTTP_SESSIONS: z.coerce.number().int().min(1).default(
|
|
240
|
+
/** Maximum concurrent Streamable HTTP sessions (default: 200) */
|
|
241
|
+
MCP_MAX_STREAMABLE_HTTP_SESSIONS: z.coerce.number().int().min(1).default(200),
|
|
242
242
|
/** Maximum concurrent SSE sessions (default: 50) */
|
|
243
243
|
MCP_MAX_SSE_SESSIONS: z.coerce.number().int().min(1).default(50),
|
|
244
244
|
// ==========================================================================
|
|
@@ -323,12 +323,17 @@ export const frameworkEnvSchema = z
|
|
|
323
323
|
*/
|
|
324
324
|
OTEL_LOG_LEVEL: z.string().min(1).optional(),
|
|
325
325
|
/**
|
|
326
|
-
* Periodic metric export interval
|
|
326
|
+
* Periodic metric export interval.
|
|
327
327
|
*
|
|
328
328
|
* Standard OTEL env var name. Controls how often PeriodicExportingMetricReader
|
|
329
329
|
* pushes metrics to the OTLP endpoint or console.
|
|
330
|
+
* Accepts human-readable durations like '60s', '5m', or plain millisecond counts.
|
|
330
331
|
*/
|
|
331
|
-
OTEL_METRIC_EXPORT_INTERVAL: z
|
|
332
|
+
OTEL_METRIC_EXPORT_INTERVAL: z
|
|
333
|
+
.string()
|
|
334
|
+
.transform((val) => parseDuration(val))
|
|
335
|
+
.pipe(z.number().int().positive())
|
|
336
|
+
.optional(),
|
|
332
337
|
/**
|
|
333
338
|
* Metric exporters to activate (comma-separated).
|
|
334
339
|
*
|
|
@@ -338,9 +343,9 @@ export const frameworkEnvSchema = z
|
|
|
338
343
|
* - `console` — Log metrics to console (useful for debugging)
|
|
339
344
|
* - `none` — Disable all metric export
|
|
340
345
|
*
|
|
341
|
-
* Default: '
|
|
346
|
+
* Default: 'prometheus' (Prometheus scrape endpoint)
|
|
342
347
|
*/
|
|
343
|
-
OTEL_METRICS_EXPORTER: commaSeparatedList({ lowercase: true }).default("
|
|
348
|
+
OTEL_METRICS_EXPORTER: commaSeparatedList({ lowercase: true }).default("prometheus"),
|
|
344
349
|
})
|
|
345
350
|
.superRefine((data, ctx) => {
|
|
346
351
|
// Validate TLS configuration when HTTPS mode is selected
|
|
@@ -416,14 +421,21 @@ export function validateConfigConstraints(config) {
|
|
|
416
421
|
}
|
|
417
422
|
}
|
|
418
423
|
}
|
|
419
|
-
// Session
|
|
420
|
-
|
|
421
|
-
|
|
424
|
+
// Session limits: per-transport caps must not exceed the global cap.
|
|
425
|
+
// Limits are independent — global MCP_MAX_SESSIONS is a first-come-first-served hard cap,
|
|
426
|
+
// while per-transport limits are independent ceilings within that global pool.
|
|
427
|
+
if (config.MCP_MAX_STREAMABLE_HTTP_SESSIONS > config.MCP_MAX_SESSIONS) {
|
|
428
|
+
violations.push({
|
|
429
|
+
message: `MCP_MAX_STREAMABLE_HTTP_SESSIONS (${config.MCP_MAX_STREAMABLE_HTTP_SESSIONS}) ` +
|
|
430
|
+
`exceeds MCP_MAX_SESSIONS (${config.MCP_MAX_SESSIONS})`,
|
|
431
|
+
path: ["MCP_MAX_SESSIONS", "MCP_MAX_STREAMABLE_HTTP_SESSIONS"],
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
if (config.MCP_MAX_SSE_SESSIONS > config.MCP_MAX_SESSIONS) {
|
|
422
435
|
violations.push({
|
|
423
|
-
message: `
|
|
424
|
-
`
|
|
425
|
-
|
|
426
|
-
path: ["MCP_MAX_SESSIONS", "MCP_MAX_STREAMABLE_HTTP_SESSIONS", "MCP_MAX_SSE_SESSIONS"],
|
|
436
|
+
message: `MCP_MAX_SSE_SESSIONS (${config.MCP_MAX_SSE_SESSIONS}) ` +
|
|
437
|
+
`exceeds MCP_MAX_SESSIONS (${config.MCP_MAX_SESSIONS})`,
|
|
438
|
+
path: ["MCP_MAX_SESSIONS", "MCP_MAX_SSE_SESSIONS"],
|
|
427
439
|
});
|
|
428
440
|
}
|
|
429
441
|
return violations;
|
package/build/config/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,cAAc,EACd,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,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the config file path.
|
|
67
67
|
*
|
|
68
68
|
* Resolution order:
|
|
69
|
-
* 1. `
|
|
69
|
+
* 1. `MCP_CONFIG_FILE_PATH` env var — explicit path (must exist, must be supported format)
|
|
70
70
|
* 2. Auto-discovery in `process.cwd()` — first match from {@link DISCOVERY_FILENAMES}
|
|
71
71
|
*
|
|
72
72
|
* @returns Absolute path to the config file, or `undefined` if none found
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* All fields are optional — you only configure what you need.
|
|
15
15
|
*
|
|
16
16
|
* Intentionally excluded from config file support:
|
|
17
|
-
* - `
|
|
17
|
+
* - `MCP_CONFIG_FILE_PATH` — meta-config (chicken-egg problem)
|
|
18
18
|
* - `NODE_ENV` — runtime concern, not file-config
|
|
19
19
|
* - `VERSION` — build/deployment concern
|
|
20
20
|
*
|
|
@@ -40,7 +40,7 @@ export declare const DISCOVERY_FILENAMES: readonly ["config.toml", "config.yaml"
|
|
|
40
40
|
*
|
|
41
41
|
* This is a meta-config variable and intentionally NOT part of `FrameworkEnvConfig`.
|
|
42
42
|
*/
|
|
43
|
-
export declare const CONFIG_FILE_ENV_VAR: "
|
|
43
|
+
export declare const CONFIG_FILE_ENV_VAR: "MCP_CONFIG_FILE_PATH";
|
|
44
44
|
/**
|
|
45
45
|
* Maps file extensions to their format.
|
|
46
46
|
*
|
|
@@ -138,7 +138,7 @@ export declare const CONFIG_FILE_SECTIONS: Readonly<{
|
|
|
138
138
|
security: z.ZodObject<{
|
|
139
139
|
allowed_hosts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
140
140
|
rate_limit_max: z.ZodOptional<z.ZodNumber>;
|
|
141
|
-
|
|
141
|
+
rate_limit_window: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
142
142
|
trust_proxy: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
143
143
|
cors_origin: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
144
144
|
cors_credentials: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -149,7 +149,7 @@ export declare const CONFIG_FILE_SECTIONS: Readonly<{
|
|
|
149
149
|
}, "strip", z.ZodTypeAny, {
|
|
150
150
|
allowed_hosts?: string[] | undefined;
|
|
151
151
|
rate_limit_max?: number | undefined;
|
|
152
|
-
|
|
152
|
+
rate_limit_window?: string | number | undefined;
|
|
153
153
|
trust_proxy?: string | number | undefined;
|
|
154
154
|
cors_origin?: string[] | undefined;
|
|
155
155
|
cors_credentials?: boolean | undefined;
|
|
@@ -160,7 +160,7 @@ export declare const CONFIG_FILE_SECTIONS: Readonly<{
|
|
|
160
160
|
}, {
|
|
161
161
|
allowed_hosts?: string[] | undefined;
|
|
162
162
|
rate_limit_max?: number | undefined;
|
|
163
|
-
|
|
163
|
+
rate_limit_window?: string | number | undefined;
|
|
164
164
|
trust_proxy?: string | number | undefined;
|
|
165
165
|
cors_origin?: string[] | undefined;
|
|
166
166
|
cors_credentials?: boolean | undefined;
|
|
@@ -217,7 +217,7 @@ export declare const CONFIG_FILE_SECTIONS: Readonly<{
|
|
|
217
217
|
traces_exporter: z.ZodOptional<z.ZodString>;
|
|
218
218
|
logs_exporter: z.ZodOptional<z.ZodString>;
|
|
219
219
|
log_level: z.ZodOptional<z.ZodString>;
|
|
220
|
-
metric_export_interval: z.ZodOptional<z.ZodNumber
|
|
220
|
+
metric_export_interval: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
221
221
|
metrics_exporter: z.ZodOptional<z.ZodString>;
|
|
222
222
|
}, "strip", z.ZodTypeAny, {
|
|
223
223
|
enabled?: boolean | undefined;
|
|
@@ -226,7 +226,7 @@ export declare const CONFIG_FILE_SECTIONS: Readonly<{
|
|
|
226
226
|
traces_exporter?: string | undefined;
|
|
227
227
|
logs_exporter?: string | undefined;
|
|
228
228
|
log_level?: string | undefined;
|
|
229
|
-
metric_export_interval?: number | undefined;
|
|
229
|
+
metric_export_interval?: string | number | undefined;
|
|
230
230
|
metrics_exporter?: string | undefined;
|
|
231
231
|
}, {
|
|
232
232
|
enabled?: boolean | undefined;
|
|
@@ -235,7 +235,7 @@ export declare const CONFIG_FILE_SECTIONS: Readonly<{
|
|
|
235
235
|
traces_exporter?: string | undefined;
|
|
236
236
|
logs_exporter?: string | undefined;
|
|
237
237
|
log_level?: string | undefined;
|
|
238
|
-
metric_export_interval?: number | undefined;
|
|
238
|
+
metric_export_interval?: string | number | undefined;
|
|
239
239
|
metrics_exporter?: string | undefined;
|
|
240
240
|
}>;
|
|
241
241
|
auth: z.ZodObject<{
|
|
@@ -329,7 +329,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
329
329
|
readonly security: z.ZodOptional<z.ZodObject<{
|
|
330
330
|
allowed_hosts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
331
331
|
rate_limit_max: z.ZodOptional<z.ZodNumber>;
|
|
332
|
-
|
|
332
|
+
rate_limit_window: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
333
333
|
trust_proxy: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
334
334
|
cors_origin: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
335
335
|
cors_credentials: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -340,7 +340,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
340
340
|
}, "strip", z.ZodTypeAny, {
|
|
341
341
|
allowed_hosts?: string[] | undefined;
|
|
342
342
|
rate_limit_max?: number | undefined;
|
|
343
|
-
|
|
343
|
+
rate_limit_window?: string | number | undefined;
|
|
344
344
|
trust_proxy?: string | number | undefined;
|
|
345
345
|
cors_origin?: string[] | undefined;
|
|
346
346
|
cors_credentials?: boolean | undefined;
|
|
@@ -351,7 +351,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
351
351
|
}, {
|
|
352
352
|
allowed_hosts?: string[] | undefined;
|
|
353
353
|
rate_limit_max?: number | undefined;
|
|
354
|
-
|
|
354
|
+
rate_limit_window?: string | number | undefined;
|
|
355
355
|
trust_proxy?: string | number | undefined;
|
|
356
356
|
cors_origin?: string[] | undefined;
|
|
357
357
|
cors_credentials?: boolean | undefined;
|
|
@@ -408,7 +408,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
408
408
|
traces_exporter: z.ZodOptional<z.ZodString>;
|
|
409
409
|
logs_exporter: z.ZodOptional<z.ZodString>;
|
|
410
410
|
log_level: z.ZodOptional<z.ZodString>;
|
|
411
|
-
metric_export_interval: z.ZodOptional<z.ZodNumber
|
|
411
|
+
metric_export_interval: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
412
412
|
metrics_exporter: z.ZodOptional<z.ZodString>;
|
|
413
413
|
}, "strip", z.ZodTypeAny, {
|
|
414
414
|
enabled?: boolean | undefined;
|
|
@@ -417,7 +417,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
417
417
|
traces_exporter?: string | undefined;
|
|
418
418
|
logs_exporter?: string | undefined;
|
|
419
419
|
log_level?: string | undefined;
|
|
420
|
-
metric_export_interval?: number | undefined;
|
|
420
|
+
metric_export_interval?: string | number | undefined;
|
|
421
421
|
metrics_exporter?: string | undefined;
|
|
422
422
|
}, {
|
|
423
423
|
enabled?: boolean | undefined;
|
|
@@ -426,7 +426,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
426
426
|
traces_exporter?: string | undefined;
|
|
427
427
|
logs_exporter?: string | undefined;
|
|
428
428
|
log_level?: string | undefined;
|
|
429
|
-
metric_export_interval?: number | undefined;
|
|
429
|
+
metric_export_interval?: string | number | undefined;
|
|
430
430
|
metrics_exporter?: string | undefined;
|
|
431
431
|
}>>;
|
|
432
432
|
readonly auth: z.ZodOptional<z.ZodObject<{
|
|
@@ -471,7 +471,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
471
471
|
security?: {
|
|
472
472
|
allowed_hosts?: string[] | undefined;
|
|
473
473
|
rate_limit_max?: number | undefined;
|
|
474
|
-
|
|
474
|
+
rate_limit_window?: string | number | undefined;
|
|
475
475
|
trust_proxy?: string | number | undefined;
|
|
476
476
|
cors_origin?: string[] | undefined;
|
|
477
477
|
cors_credentials?: boolean | undefined;
|
|
@@ -487,7 +487,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
487
487
|
traces_exporter?: string | undefined;
|
|
488
488
|
logs_exporter?: string | undefined;
|
|
489
489
|
log_level?: string | undefined;
|
|
490
|
-
metric_export_interval?: number | undefined;
|
|
490
|
+
metric_export_interval?: string | number | undefined;
|
|
491
491
|
metrics_exporter?: string | undefined;
|
|
492
492
|
} | undefined;
|
|
493
493
|
auth?: {
|
|
@@ -526,7 +526,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
526
526
|
security?: {
|
|
527
527
|
allowed_hosts?: string[] | undefined;
|
|
528
528
|
rate_limit_max?: number | undefined;
|
|
529
|
-
|
|
529
|
+
rate_limit_window?: string | number | undefined;
|
|
530
530
|
trust_proxy?: string | number | undefined;
|
|
531
531
|
cors_origin?: string[] | undefined;
|
|
532
532
|
cors_credentials?: boolean | undefined;
|
|
@@ -542,7 +542,7 @@ export declare const configFileSchema: z.ZodObject<{
|
|
|
542
542
|
traces_exporter?: string | undefined;
|
|
543
543
|
logs_exporter?: string | undefined;
|
|
544
544
|
log_level?: string | undefined;
|
|
545
|
-
metric_export_interval?: number | undefined;
|
|
545
|
+
metric_export_interval?: string | number | undefined;
|
|
546
546
|
metrics_exporter?: string | undefined;
|
|
547
547
|
} | undefined;
|
|
548
548
|
auth?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/config/file/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;
|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