@getmcp/core 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 getmcp Contributors
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.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @getmcp/core
2
+
3
+ Core types, schemas, and validation for the getmcp canonical configuration format. Aligned with [FastMCP](https://github.com/jlowin/fastmcp)'s standard.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @getmcp/core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Schema Validation
14
+
15
+ All schemas use [Zod](https://zod.dev) for runtime validation:
16
+
17
+ ```ts
18
+ import { StdioServerConfig, RemoteServerConfig, CanonicalMCPConfig } from "@getmcp/core";
19
+
20
+ // Validate a stdio server config
21
+ const result = StdioServerConfig.safeParse({
22
+ command: "npx",
23
+ args: ["-y", "@modelcontextprotocol/server-github"],
24
+ env: { GITHUB_TOKEN: "..." },
25
+ });
26
+
27
+ if (result.success) {
28
+ console.log(result.data); // typed StdioServerConfigType
29
+ }
30
+
31
+ // Validate a remote server config
32
+ RemoteServerConfig.parse({
33
+ url: "https://mcp.example.com/sse",
34
+ headers: { Authorization: "Bearer token" },
35
+ });
36
+
37
+ // Validate a full canonical config
38
+ CanonicalMCPConfig.parse({
39
+ mcpServers: {
40
+ github: { command: "npx", args: ["-y", "@modelcontextprotocol/server-github"] },
41
+ sentry: { url: "https://mcp.sentry.dev/sse" },
42
+ },
43
+ });
44
+ ```
45
+
46
+ ### Type Guards
47
+
48
+ ```ts
49
+ import { isStdioConfig, isRemoteConfig, inferTransport } from "@getmcp/core";
50
+
51
+ const config = { command: "npx", args: ["server"] };
52
+
53
+ isStdioConfig(config); // true
54
+ isRemoteConfig(config); // false
55
+ inferTransport(config); // "stdio"
56
+ ```
57
+
58
+ ### TypeScript Types
59
+
60
+ Types are inferred from Zod schemas:
61
+
62
+ ```ts
63
+ import type {
64
+ StdioServerConfigType,
65
+ RemoteServerConfigType,
66
+ ServerConfigType,
67
+ RegistryEntryType,
68
+ AppIdType,
69
+ ConfigGenerator,
70
+ AppMetadata,
71
+ } from "@getmcp/core";
72
+ ```
73
+
74
+ ## Schemas
75
+
76
+ | Schema | Description |
77
+ |--------|-------------|
78
+ | `StdioServerConfig` | Local server with `command`, `args`, `env` |
79
+ | `RemoteServerConfig` | Remote server with `url`, `headers` |
80
+ | `ServerConfig` | Union of stdio and remote |
81
+ | `LooseServerConfig` | Passthrough schema for unknown fields |
82
+ | `CanonicalMCPConfig` | Top-level `{ mcpServers: { ... } }` |
83
+ | `RegistryEntry` | Server definition for the registry |
84
+ | `AppId` | Enum of supported app identifiers |
85
+ | `TransportType` | `"stdio" | "sse" | "streamable-http"` |
86
+
87
+ ## Supported Apps
88
+
89
+ `AppId` includes: `claude-desktop`, `claude-code`, `vscode`, `cursor`, `cline`, `roo-code`, `goose`, `windsurf`, `opencode`, `zed`
90
+
91
+ ## License
92
+
93
+ MIT
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @getmcp/core
3
+ *
4
+ * Core types, schemas, and validation for the getmcp canonical configuration format.
5
+ * Aligned with FastMCP's CanonicalMCPConfig standard.
6
+ */
7
+ export { TransportType, StdioServerConfig, RemoteServerConfig, ServerConfig, LooseServerConfig, CanonicalMCPConfig, PlatformOverride, Runtime, RegistryEntry, AppId, } from "./schemas.js";
8
+ export type { TransportType as TransportTypeType, StdioServerConfig as StdioServerConfigType, RemoteServerConfig as RemoteServerConfigType, ServerConfig as ServerConfigType, LooseServerConfig as LooseServerConfigType, CanonicalMCPConfig as CanonicalMCPConfigType, PlatformOverride as PlatformOverrideType, Runtime as RuntimeType, RegistryEntry as RegistryEntryType, AppId as AppIdType, AppMetadata, ConfigGenerator, } from "./types.js";
9
+ export { isStdioConfig, isRemoteConfig, inferTransport } from "./utils.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,KAAK,GACN,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,aAAa,IAAI,iBAAiB,EAClC,iBAAiB,IAAI,qBAAqB,EAC1C,kBAAkB,IAAI,sBAAsB,EAC5C,YAAY,IAAI,gBAAgB,EAChC,iBAAiB,IAAI,qBAAqB,EAC1C,kBAAkB,IAAI,sBAAsB,EAC5C,gBAAgB,IAAI,oBAAoB,EACxC,OAAO,IAAI,WAAW,EACtB,aAAa,IAAI,iBAAiB,EAClC,KAAK,IAAI,SAAS,EAClB,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @getmcp/core
3
+ *
4
+ * Core types, schemas, and validation for the getmcp canonical configuration format.
5
+ * Aligned with FastMCP's CanonicalMCPConfig standard.
6
+ */
7
+ // Zod schemas (runtime validation)
8
+ export { TransportType, StdioServerConfig, RemoteServerConfig, ServerConfig, LooseServerConfig, CanonicalMCPConfig, PlatformOverride, Runtime, RegistryEntry, AppId, } from "./schemas.js";
9
+ // Utilities
10
+ export { isStdioConfig, isRemoteConfig, inferTransport } from "./utils.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,mCAAmC;AACnC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,KAAK,GACN,MAAM,cAAc,CAAC;AAkBtB,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,556 @@
1
+ /**
2
+ * Zod schemas for the canonical MCP configuration format.
3
+ *
4
+ * Aligned with FastMCP's CanonicalMCPConfig:
5
+ * - Root key: "mcpServers"
6
+ * - Stdio: command, args, env, cwd, timeout, description
7
+ * - Remote: url, transport, headers, timeout, description
8
+ *
9
+ * Extended with registry metadata for the getmcp ecosystem.
10
+ */
11
+ import { z } from "zod";
12
+ export declare const TransportType: z.ZodEnum<["stdio", "http", "streamable-http", "sse"]>;
13
+ /**
14
+ * Stdio transport server configuration.
15
+ * This is the most common format — runs a local process.
16
+ */
17
+ export declare const StdioServerConfig: z.ZodObject<{
18
+ /** The executable command (e.g. "npx", "uvx", "docker", "node") */
19
+ command: z.ZodString;
20
+ /** Arguments passed to the command */
21
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
22
+ /** Environment variables for the process */
23
+ env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
24
+ /** Transport type — always "stdio" for this variant */
25
+ transport: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"stdio">>>;
26
+ /** Working directory for command execution */
27
+ cwd: z.ZodOptional<z.ZodString>;
28
+ /** Maximum response time in milliseconds */
29
+ timeout: z.ZodOptional<z.ZodNumber>;
30
+ /** Human-readable server description */
31
+ description: z.ZodOptional<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ command: string;
34
+ args: string[];
35
+ env: Record<string, string>;
36
+ transport: "stdio";
37
+ cwd?: string | undefined;
38
+ timeout?: number | undefined;
39
+ description?: string | undefined;
40
+ }, {
41
+ command: string;
42
+ args?: string[] | undefined;
43
+ env?: Record<string, string> | undefined;
44
+ transport?: "stdio" | undefined;
45
+ cwd?: string | undefined;
46
+ timeout?: number | undefined;
47
+ description?: string | undefined;
48
+ }>;
49
+ /**
50
+ * Remote transport server configuration.
51
+ * Used for HTTP, Streamable HTTP, and SSE servers.
52
+ */
53
+ export declare const RemoteServerConfig: z.ZodObject<{
54
+ /** The server URL */
55
+ url: z.ZodString;
56
+ /** Transport type — inferred from URL if not provided */
57
+ transport: z.ZodOptional<z.ZodEnum<["http", "streamable-http", "sse"]>>;
58
+ /** HTTP headers to include with requests */
59
+ headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
60
+ /** Maximum response time in milliseconds */
61
+ timeout: z.ZodOptional<z.ZodNumber>;
62
+ /** Human-readable server description */
63
+ description: z.ZodOptional<z.ZodString>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ url: string;
66
+ headers: Record<string, string>;
67
+ transport?: "http" | "streamable-http" | "sse" | undefined;
68
+ timeout?: number | undefined;
69
+ description?: string | undefined;
70
+ }, {
71
+ url: string;
72
+ transport?: "http" | "streamable-http" | "sse" | undefined;
73
+ timeout?: number | undefined;
74
+ description?: string | undefined;
75
+ headers?: Record<string, string> | undefined;
76
+ }>;
77
+ /**
78
+ * Union of both transport configurations.
79
+ * Discriminated by the presence of `command` (stdio) vs `url` (remote).
80
+ */
81
+ export declare const ServerConfig: z.ZodDiscriminatedUnion<"transport", [z.ZodObject<{
82
+ command: z.ZodString;
83
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
84
+ env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
85
+ cwd: z.ZodOptional<z.ZodString>;
86
+ timeout: z.ZodOptional<z.ZodNumber>;
87
+ description: z.ZodOptional<z.ZodString>;
88
+ } & {
89
+ transport: z.ZodLiteral<"stdio">;
90
+ }, "strip", z.ZodTypeAny, {
91
+ command: string;
92
+ args: string[];
93
+ env: Record<string, string>;
94
+ transport: "stdio";
95
+ cwd?: string | undefined;
96
+ timeout?: number | undefined;
97
+ description?: string | undefined;
98
+ }, {
99
+ command: string;
100
+ transport: "stdio";
101
+ args?: string[] | undefined;
102
+ env?: Record<string, string> | undefined;
103
+ cwd?: string | undefined;
104
+ timeout?: number | undefined;
105
+ description?: string | undefined;
106
+ }>, z.ZodObject<{
107
+ url: z.ZodString;
108
+ headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
109
+ timeout: z.ZodOptional<z.ZodNumber>;
110
+ description: z.ZodOptional<z.ZodString>;
111
+ } & {
112
+ transport: z.ZodLiteral<"http">;
113
+ }, "strip", z.ZodTypeAny, {
114
+ url: string;
115
+ transport: "http";
116
+ headers: Record<string, string>;
117
+ timeout?: number | undefined;
118
+ description?: string | undefined;
119
+ }, {
120
+ url: string;
121
+ transport: "http";
122
+ timeout?: number | undefined;
123
+ description?: string | undefined;
124
+ headers?: Record<string, string> | undefined;
125
+ }>, z.ZodObject<{
126
+ url: z.ZodString;
127
+ headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
128
+ timeout: z.ZodOptional<z.ZodNumber>;
129
+ description: z.ZodOptional<z.ZodString>;
130
+ } & {
131
+ transport: z.ZodLiteral<"streamable-http">;
132
+ }, "strip", z.ZodTypeAny, {
133
+ url: string;
134
+ transport: "streamable-http";
135
+ headers: Record<string, string>;
136
+ timeout?: number | undefined;
137
+ description?: string | undefined;
138
+ }, {
139
+ url: string;
140
+ transport: "streamable-http";
141
+ timeout?: number | undefined;
142
+ description?: string | undefined;
143
+ headers?: Record<string, string> | undefined;
144
+ }>, z.ZodObject<{
145
+ url: z.ZodString;
146
+ headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
147
+ timeout: z.ZodOptional<z.ZodNumber>;
148
+ description: z.ZodOptional<z.ZodString>;
149
+ } & {
150
+ transport: z.ZodLiteral<"sse">;
151
+ }, "strip", z.ZodTypeAny, {
152
+ url: string;
153
+ transport: "sse";
154
+ headers: Record<string, string>;
155
+ timeout?: number | undefined;
156
+ description?: string | undefined;
157
+ }, {
158
+ url: string;
159
+ transport: "sse";
160
+ timeout?: number | undefined;
161
+ description?: string | undefined;
162
+ headers?: Record<string, string> | undefined;
163
+ }>]>;
164
+ /**
165
+ * Loose server config — accepts either stdio or remote without requiring
166
+ * an explicit transport field. Uses the presence of `command` vs `url` to
167
+ * determine the type.
168
+ */
169
+ export declare const LooseServerConfig: z.ZodUnion<[z.ZodObject<{
170
+ /** The executable command (e.g. "npx", "uvx", "docker", "node") */
171
+ command: z.ZodString;
172
+ /** Arguments passed to the command */
173
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
174
+ /** Environment variables for the process */
175
+ env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
176
+ /** Transport type — always "stdio" for this variant */
177
+ transport: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"stdio">>>;
178
+ /** Working directory for command execution */
179
+ cwd: z.ZodOptional<z.ZodString>;
180
+ /** Maximum response time in milliseconds */
181
+ timeout: z.ZodOptional<z.ZodNumber>;
182
+ /** Human-readable server description */
183
+ description: z.ZodOptional<z.ZodString>;
184
+ }, "strip", z.ZodTypeAny, {
185
+ command: string;
186
+ args: string[];
187
+ env: Record<string, string>;
188
+ transport: "stdio";
189
+ cwd?: string | undefined;
190
+ timeout?: number | undefined;
191
+ description?: string | undefined;
192
+ }, {
193
+ command: string;
194
+ args?: string[] | undefined;
195
+ env?: Record<string, string> | undefined;
196
+ transport?: "stdio" | undefined;
197
+ cwd?: string | undefined;
198
+ timeout?: number | undefined;
199
+ description?: string | undefined;
200
+ }>, z.ZodObject<{
201
+ /** The server URL */
202
+ url: z.ZodString;
203
+ /** Transport type — inferred from URL if not provided */
204
+ transport: z.ZodOptional<z.ZodEnum<["http", "streamable-http", "sse"]>>;
205
+ /** HTTP headers to include with requests */
206
+ headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
207
+ /** Maximum response time in milliseconds */
208
+ timeout: z.ZodOptional<z.ZodNumber>;
209
+ /** Human-readable server description */
210
+ description: z.ZodOptional<z.ZodString>;
211
+ }, "strip", z.ZodTypeAny, {
212
+ url: string;
213
+ headers: Record<string, string>;
214
+ transport?: "http" | "streamable-http" | "sse" | undefined;
215
+ timeout?: number | undefined;
216
+ description?: string | undefined;
217
+ }, {
218
+ url: string;
219
+ transport?: "http" | "streamable-http" | "sse" | undefined;
220
+ timeout?: number | undefined;
221
+ description?: string | undefined;
222
+ headers?: Record<string, string> | undefined;
223
+ }>]>;
224
+ /**
225
+ * The canonical MCP configuration format.
226
+ * This mirrors FastMCP's CanonicalMCPConfig: { mcpServers: { name: config } }
227
+ */
228
+ export declare const CanonicalMCPConfig: z.ZodObject<{
229
+ mcpServers: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
230
+ /** The executable command (e.g. "npx", "uvx", "docker", "node") */
231
+ command: z.ZodString;
232
+ /** Arguments passed to the command */
233
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
234
+ /** Environment variables for the process */
235
+ env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
236
+ /** Transport type — always "stdio" for this variant */
237
+ transport: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"stdio">>>;
238
+ /** Working directory for command execution */
239
+ cwd: z.ZodOptional<z.ZodString>;
240
+ /** Maximum response time in milliseconds */
241
+ timeout: z.ZodOptional<z.ZodNumber>;
242
+ /** Human-readable server description */
243
+ description: z.ZodOptional<z.ZodString>;
244
+ }, "strip", z.ZodTypeAny, {
245
+ command: string;
246
+ args: string[];
247
+ env: Record<string, string>;
248
+ transport: "stdio";
249
+ cwd?: string | undefined;
250
+ timeout?: number | undefined;
251
+ description?: string | undefined;
252
+ }, {
253
+ command: string;
254
+ args?: string[] | undefined;
255
+ env?: Record<string, string> | undefined;
256
+ transport?: "stdio" | undefined;
257
+ cwd?: string | undefined;
258
+ timeout?: number | undefined;
259
+ description?: string | undefined;
260
+ }>, z.ZodObject<{
261
+ /** The server URL */
262
+ url: z.ZodString;
263
+ /** Transport type — inferred from URL if not provided */
264
+ transport: z.ZodOptional<z.ZodEnum<["http", "streamable-http", "sse"]>>;
265
+ /** HTTP headers to include with requests */
266
+ headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
267
+ /** Maximum response time in milliseconds */
268
+ timeout: z.ZodOptional<z.ZodNumber>;
269
+ /** Human-readable server description */
270
+ description: z.ZodOptional<z.ZodString>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ url: string;
273
+ headers: Record<string, string>;
274
+ transport?: "http" | "streamable-http" | "sse" | undefined;
275
+ timeout?: number | undefined;
276
+ description?: string | undefined;
277
+ }, {
278
+ url: string;
279
+ transport?: "http" | "streamable-http" | "sse" | undefined;
280
+ timeout?: number | undefined;
281
+ description?: string | undefined;
282
+ headers?: Record<string, string> | undefined;
283
+ }>]>>;
284
+ }, "strip", z.ZodTypeAny, {
285
+ mcpServers: Record<string, {
286
+ command: string;
287
+ args: string[];
288
+ env: Record<string, string>;
289
+ transport: "stdio";
290
+ cwd?: string | undefined;
291
+ timeout?: number | undefined;
292
+ description?: string | undefined;
293
+ } | {
294
+ url: string;
295
+ headers: Record<string, string>;
296
+ transport?: "http" | "streamable-http" | "sse" | undefined;
297
+ timeout?: number | undefined;
298
+ description?: string | undefined;
299
+ }>;
300
+ }, {
301
+ mcpServers: Record<string, {
302
+ command: string;
303
+ args?: string[] | undefined;
304
+ env?: Record<string, string> | undefined;
305
+ transport?: "stdio" | undefined;
306
+ cwd?: string | undefined;
307
+ timeout?: number | undefined;
308
+ description?: string | undefined;
309
+ } | {
310
+ url: string;
311
+ transport?: "http" | "streamable-http" | "sse" | undefined;
312
+ timeout?: number | undefined;
313
+ description?: string | undefined;
314
+ headers?: Record<string, string> | undefined;
315
+ }>;
316
+ }>;
317
+ /** Platform-specific command overrides for stdio servers */
318
+ export declare const PlatformOverride: z.ZodObject<{
319
+ command: z.ZodOptional<z.ZodString>;
320
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
321
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
322
+ cwd: z.ZodOptional<z.ZodString>;
323
+ }, "strip", z.ZodTypeAny, {
324
+ command?: string | undefined;
325
+ args?: string[] | undefined;
326
+ env?: Record<string, string> | undefined;
327
+ cwd?: string | undefined;
328
+ }, {
329
+ command?: string | undefined;
330
+ args?: string[] | undefined;
331
+ env?: Record<string, string> | undefined;
332
+ cwd?: string | undefined;
333
+ }>;
334
+ export declare const Runtime: z.ZodEnum<["node", "python", "docker", "binary"]>;
335
+ /**
336
+ * A full MCP server registry entry.
337
+ * Contains the canonical server config plus metadata for discovery,
338
+ * display, and multi-platform support.
339
+ */
340
+ export declare const RegistryEntry: z.ZodObject<{
341
+ /** Unique identifier (e.g. "github-mcp-server") */
342
+ id: z.ZodString;
343
+ /** Display name (e.g. "GitHub MCP Server") */
344
+ name: z.ZodString;
345
+ /** What this server does */
346
+ description: z.ZodString;
347
+ /** The canonical server configuration */
348
+ config: z.ZodUnion<[z.ZodObject<{
349
+ /** The executable command (e.g. "npx", "uvx", "docker", "node") */
350
+ command: z.ZodString;
351
+ /** Arguments passed to the command */
352
+ args: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
353
+ /** Environment variables for the process */
354
+ env: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
355
+ /** Transport type — always "stdio" for this variant */
356
+ transport: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"stdio">>>;
357
+ /** Working directory for command execution */
358
+ cwd: z.ZodOptional<z.ZodString>;
359
+ /** Maximum response time in milliseconds */
360
+ timeout: z.ZodOptional<z.ZodNumber>;
361
+ /** Human-readable server description */
362
+ description: z.ZodOptional<z.ZodString>;
363
+ }, "strip", z.ZodTypeAny, {
364
+ command: string;
365
+ args: string[];
366
+ env: Record<string, string>;
367
+ transport: "stdio";
368
+ cwd?: string | undefined;
369
+ timeout?: number | undefined;
370
+ description?: string | undefined;
371
+ }, {
372
+ command: string;
373
+ args?: string[] | undefined;
374
+ env?: Record<string, string> | undefined;
375
+ transport?: "stdio" | undefined;
376
+ cwd?: string | undefined;
377
+ timeout?: number | undefined;
378
+ description?: string | undefined;
379
+ }>, z.ZodObject<{
380
+ /** The server URL */
381
+ url: z.ZodString;
382
+ /** Transport type — inferred from URL if not provided */
383
+ transport: z.ZodOptional<z.ZodEnum<["http", "streamable-http", "sse"]>>;
384
+ /** HTTP headers to include with requests */
385
+ headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
386
+ /** Maximum response time in milliseconds */
387
+ timeout: z.ZodOptional<z.ZodNumber>;
388
+ /** Human-readable server description */
389
+ description: z.ZodOptional<z.ZodString>;
390
+ }, "strip", z.ZodTypeAny, {
391
+ url: string;
392
+ headers: Record<string, string>;
393
+ transport?: "http" | "streamable-http" | "sse" | undefined;
394
+ timeout?: number | undefined;
395
+ description?: string | undefined;
396
+ }, {
397
+ url: string;
398
+ transport?: "http" | "streamable-http" | "sse" | undefined;
399
+ timeout?: number | undefined;
400
+ description?: string | undefined;
401
+ headers?: Record<string, string> | undefined;
402
+ }>]>;
403
+ /** Package name (npm or pypi) */
404
+ package: z.ZodOptional<z.ZodString>;
405
+ /** Runtime used to execute the server */
406
+ runtime: z.ZodOptional<z.ZodEnum<["node", "python", "docker", "binary"]>>;
407
+ /** Source code repository URL */
408
+ repository: z.ZodOptional<z.ZodString>;
409
+ /** Homepage URL */
410
+ homepage: z.ZodOptional<z.ZodString>;
411
+ /** Author or organization */
412
+ author: z.ZodOptional<z.ZodString>;
413
+ /** Discovery categories (e.g. ["developer-tools", "git"]) */
414
+ categories: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
415
+ /** Environment variables that the user MUST provide */
416
+ requiredEnvVars: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
417
+ /** Platform-specific overrides (e.g. Windows needs cmd /c wrapper) */
418
+ windows: z.ZodOptional<z.ZodObject<{
419
+ command: z.ZodOptional<z.ZodString>;
420
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
421
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
422
+ cwd: z.ZodOptional<z.ZodString>;
423
+ }, "strip", z.ZodTypeAny, {
424
+ command?: string | undefined;
425
+ args?: string[] | undefined;
426
+ env?: Record<string, string> | undefined;
427
+ cwd?: string | undefined;
428
+ }, {
429
+ command?: string | undefined;
430
+ args?: string[] | undefined;
431
+ env?: Record<string, string> | undefined;
432
+ cwd?: string | undefined;
433
+ }>>;
434
+ linux: z.ZodOptional<z.ZodObject<{
435
+ command: z.ZodOptional<z.ZodString>;
436
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
437
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
438
+ cwd: z.ZodOptional<z.ZodString>;
439
+ }, "strip", z.ZodTypeAny, {
440
+ command?: string | undefined;
441
+ args?: string[] | undefined;
442
+ env?: Record<string, string> | undefined;
443
+ cwd?: string | undefined;
444
+ }, {
445
+ command?: string | undefined;
446
+ args?: string[] | undefined;
447
+ env?: Record<string, string> | undefined;
448
+ cwd?: string | undefined;
449
+ }>>;
450
+ macos: z.ZodOptional<z.ZodObject<{
451
+ command: z.ZodOptional<z.ZodString>;
452
+ args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
453
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
454
+ cwd: z.ZodOptional<z.ZodString>;
455
+ }, "strip", z.ZodTypeAny, {
456
+ command?: string | undefined;
457
+ args?: string[] | undefined;
458
+ env?: Record<string, string> | undefined;
459
+ cwd?: string | undefined;
460
+ }, {
461
+ command?: string | undefined;
462
+ args?: string[] | undefined;
463
+ env?: Record<string, string> | undefined;
464
+ cwd?: string | undefined;
465
+ }>>;
466
+ }, "strip", z.ZodTypeAny, {
467
+ description: string;
468
+ id: string;
469
+ name: string;
470
+ config: {
471
+ command: string;
472
+ args: string[];
473
+ env: Record<string, string>;
474
+ transport: "stdio";
475
+ cwd?: string | undefined;
476
+ timeout?: number | undefined;
477
+ description?: string | undefined;
478
+ } | {
479
+ url: string;
480
+ headers: Record<string, string>;
481
+ transport?: "http" | "streamable-http" | "sse" | undefined;
482
+ timeout?: number | undefined;
483
+ description?: string | undefined;
484
+ };
485
+ categories: string[];
486
+ requiredEnvVars: string[];
487
+ package?: string | undefined;
488
+ runtime?: "node" | "python" | "docker" | "binary" | undefined;
489
+ repository?: string | undefined;
490
+ homepage?: string | undefined;
491
+ author?: string | undefined;
492
+ windows?: {
493
+ command?: string | undefined;
494
+ args?: string[] | undefined;
495
+ env?: Record<string, string> | undefined;
496
+ cwd?: string | undefined;
497
+ } | undefined;
498
+ linux?: {
499
+ command?: string | undefined;
500
+ args?: string[] | undefined;
501
+ env?: Record<string, string> | undefined;
502
+ cwd?: string | undefined;
503
+ } | undefined;
504
+ macos?: {
505
+ command?: string | undefined;
506
+ args?: string[] | undefined;
507
+ env?: Record<string, string> | undefined;
508
+ cwd?: string | undefined;
509
+ } | undefined;
510
+ }, {
511
+ description: string;
512
+ id: string;
513
+ name: string;
514
+ config: {
515
+ command: string;
516
+ args?: string[] | undefined;
517
+ env?: Record<string, string> | undefined;
518
+ transport?: "stdio" | undefined;
519
+ cwd?: string | undefined;
520
+ timeout?: number | undefined;
521
+ description?: string | undefined;
522
+ } | {
523
+ url: string;
524
+ transport?: "http" | "streamable-http" | "sse" | undefined;
525
+ timeout?: number | undefined;
526
+ description?: string | undefined;
527
+ headers?: Record<string, string> | undefined;
528
+ };
529
+ package?: string | undefined;
530
+ runtime?: "node" | "python" | "docker" | "binary" | undefined;
531
+ repository?: string | undefined;
532
+ homepage?: string | undefined;
533
+ author?: string | undefined;
534
+ categories?: string[] | undefined;
535
+ requiredEnvVars?: string[] | undefined;
536
+ windows?: {
537
+ command?: string | undefined;
538
+ args?: string[] | undefined;
539
+ env?: Record<string, string> | undefined;
540
+ cwd?: string | undefined;
541
+ } | undefined;
542
+ linux?: {
543
+ command?: string | undefined;
544
+ args?: string[] | undefined;
545
+ env?: Record<string, string> | undefined;
546
+ cwd?: string | undefined;
547
+ } | undefined;
548
+ macos?: {
549
+ command?: string | undefined;
550
+ args?: string[] | undefined;
551
+ env?: Record<string, string> | undefined;
552
+ cwd?: string | undefined;
553
+ } | undefined;
554
+ }>;
555
+ export declare const AppId: z.ZodEnum<["claude-desktop", "claude-code", "vscode", "cursor", "cline", "roo-code", "goose", "windsurf", "opencode", "zed"]>;
556
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA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C5D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAK3B,CAAC;AAMH,eAAO,MAAM,OAAO,mDAAiD,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,aAAa;IACxB,mDAAmD;;IAGnD,8CAA8C;;IAG9C,4BAA4B;;IAG5B,yCAAyC;;QA/GzC,mEAAmE;;QAGnE,sCAAsC;;QAGtC,4CAA4C;;QAG5C,uDAAuD;;QAGvD,8CAA8C;;QAG9C,4CAA4C;;QAG5C,wCAAwC;;;;;;;;;;;;;;;;;;;QASxC,qBAAqB;;QAGrB,yDAAyD;;QAKzD,4CAA4C;;QAG5C,4CAA4C;;QAG5C,wCAAwC;;;;;;;;;;;;;;;IAyExC,iCAAiC;;IAGjC,yCAAyC;;IAGzC,iCAAiC;;IAGjC,mBAAmB;;IAGnB,6BAA6B;;IAG7B,6DAA6D;;IAG7D,uDAAuD;;IAGvD,sEAAsE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAItE,CAAC;AAMH,eAAO,MAAM,KAAK,+HAWhB,CAAC"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Zod schemas for the canonical MCP configuration format.
3
+ *
4
+ * Aligned with FastMCP's CanonicalMCPConfig:
5
+ * - Root key: "mcpServers"
6
+ * - Stdio: command, args, env, cwd, timeout, description
7
+ * - Remote: url, transport, headers, timeout, description
8
+ *
9
+ * Extended with registry metadata for the getmcp ecosystem.
10
+ */
11
+ import { z } from "zod";
12
+ // ---------------------------------------------------------------------------
13
+ // Transport types
14
+ // ---------------------------------------------------------------------------
15
+ export const TransportType = z.enum([
16
+ "stdio",
17
+ "http",
18
+ "streamable-http",
19
+ "sse",
20
+ ]);
21
+ // ---------------------------------------------------------------------------
22
+ // Canonical server configs (FastMCP-compatible)
23
+ // ---------------------------------------------------------------------------
24
+ /**
25
+ * Stdio transport server configuration.
26
+ * This is the most common format — runs a local process.
27
+ */
28
+ export const StdioServerConfig = z.object({
29
+ /** The executable command (e.g. "npx", "uvx", "docker", "node") */
30
+ command: z.string().min(1),
31
+ /** Arguments passed to the command */
32
+ args: z.array(z.string()).optional().default([]),
33
+ /** Environment variables for the process */
34
+ env: z.record(z.string(), z.string()).optional().default({}),
35
+ /** Transport type — always "stdio" for this variant */
36
+ transport: z.literal("stdio").optional().default("stdio"),
37
+ /** Working directory for command execution */
38
+ cwd: z.string().optional(),
39
+ /** Maximum response time in milliseconds */
40
+ timeout: z.number().int().positive().optional(),
41
+ /** Human-readable server description */
42
+ description: z.string().optional(),
43
+ });
44
+ /**
45
+ * Remote transport server configuration.
46
+ * Used for HTTP, Streamable HTTP, and SSE servers.
47
+ */
48
+ export const RemoteServerConfig = z.object({
49
+ /** The server URL */
50
+ url: z.string().url(),
51
+ /** Transport type — inferred from URL if not provided */
52
+ transport: z
53
+ .enum(["http", "streamable-http", "sse"])
54
+ .optional(),
55
+ /** HTTP headers to include with requests */
56
+ headers: z.record(z.string(), z.string()).optional().default({}),
57
+ /** Maximum response time in milliseconds */
58
+ timeout: z.number().int().positive().optional(),
59
+ /** Human-readable server description */
60
+ description: z.string().optional(),
61
+ });
62
+ /**
63
+ * Union of both transport configurations.
64
+ * Discriminated by the presence of `command` (stdio) vs `url` (remote).
65
+ */
66
+ export const ServerConfig = z.discriminatedUnion("transport", [
67
+ StdioServerConfig.extend({ transport: z.literal("stdio") }),
68
+ RemoteServerConfig.extend({ transport: z.literal("http") }),
69
+ RemoteServerConfig.extend({ transport: z.literal("streamable-http") }),
70
+ RemoteServerConfig.extend({ transport: z.literal("sse") }),
71
+ ]);
72
+ /**
73
+ * Loose server config — accepts either stdio or remote without requiring
74
+ * an explicit transport field. Uses the presence of `command` vs `url` to
75
+ * determine the type.
76
+ */
77
+ export const LooseServerConfig = z.union([
78
+ StdioServerConfig,
79
+ RemoteServerConfig,
80
+ ]);
81
+ // ---------------------------------------------------------------------------
82
+ // Canonical MCP config (FastMCP-compatible root format)
83
+ // ---------------------------------------------------------------------------
84
+ /**
85
+ * The canonical MCP configuration format.
86
+ * This mirrors FastMCP's CanonicalMCPConfig: { mcpServers: { name: config } }
87
+ */
88
+ export const CanonicalMCPConfig = z.object({
89
+ mcpServers: z.record(z.string(), LooseServerConfig),
90
+ });
91
+ // ---------------------------------------------------------------------------
92
+ // Platform overrides
93
+ // ---------------------------------------------------------------------------
94
+ /** Platform-specific command overrides for stdio servers */
95
+ export const PlatformOverride = z.object({
96
+ command: z.string().min(1).optional(),
97
+ args: z.array(z.string()).optional(),
98
+ env: z.record(z.string(), z.string()).optional(),
99
+ cwd: z.string().optional(),
100
+ });
101
+ // ---------------------------------------------------------------------------
102
+ // Registry entry (our metadata layer on top of canonical config)
103
+ // ---------------------------------------------------------------------------
104
+ export const Runtime = z.enum(["node", "python", "docker", "binary"]);
105
+ /**
106
+ * A full MCP server registry entry.
107
+ * Contains the canonical server config plus metadata for discovery,
108
+ * display, and multi-platform support.
109
+ */
110
+ export const RegistryEntry = z.object({
111
+ /** Unique identifier (e.g. "github-mcp-server") */
112
+ id: z.string().min(1).regex(/^[a-z0-9-]+$/, "ID must be lowercase alphanumeric with hyphens"),
113
+ /** Display name (e.g. "GitHub MCP Server") */
114
+ name: z.string().min(1),
115
+ /** What this server does */
116
+ description: z.string().min(1),
117
+ /** The canonical server configuration */
118
+ config: LooseServerConfig,
119
+ /** Package name (npm or pypi) */
120
+ package: z.string().optional(),
121
+ /** Runtime used to execute the server */
122
+ runtime: Runtime.optional(),
123
+ /** Source code repository URL */
124
+ repository: z.string().url().optional(),
125
+ /** Homepage URL */
126
+ homepage: z.string().url().optional(),
127
+ /** Author or organization */
128
+ author: z.string().optional(),
129
+ /** Discovery categories (e.g. ["developer-tools", "git"]) */
130
+ categories: z.array(z.string()).optional().default([]),
131
+ /** Environment variables that the user MUST provide */
132
+ requiredEnvVars: z.array(z.string()).optional().default([]),
133
+ /** Platform-specific overrides (e.g. Windows needs cmd /c wrapper) */
134
+ windows: PlatformOverride.optional(),
135
+ linux: PlatformOverride.optional(),
136
+ macos: PlatformOverride.optional(),
137
+ });
138
+ // ---------------------------------------------------------------------------
139
+ // App identifiers (all supported target apps)
140
+ // ---------------------------------------------------------------------------
141
+ export const AppId = z.enum([
142
+ "claude-desktop",
143
+ "claude-code",
144
+ "vscode",
145
+ "cursor",
146
+ "cline",
147
+ "roo-code",
148
+ "goose",
149
+ "windsurf",
150
+ "opencode",
151
+ "zed",
152
+ ]);
153
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC;IAClC,OAAO;IACP,MAAM;IACN,iBAAiB;IACjB,KAAK;CACN,CAAC,CAAC;AAEH,8EAA8E;AAC9E,gDAAgD;AAChD,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,mEAAmE;IACnE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAE1B,sCAAsC;IACtC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAEhD,4CAA4C;IAC5C,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;I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,EAAE,CAAC;IAE3D,sEAAsE;IACtE,OAAO,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IACpC,KAAK,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,gBAAgB,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,8EAA8E;AAC9E,8CAA8C;AAC9C,8EAA8E;AAE9E,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1B,gBAAgB;IAChB,aAAa;IACb,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,UAAU;IACV,OAAO;IACP,UAAU;IACV,UAAU;IACV,KAAK;CACN,CAAC,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * TypeScript types inferred from Zod schemas.
3
+ *
4
+ * These types are the single source of truth — derived directly from
5
+ * the schemas so they can never drift out of sync.
6
+ */
7
+ import { z } from "zod";
8
+ import { TransportType, StdioServerConfig, RemoteServerConfig, ServerConfig, LooseServerConfig, CanonicalMCPConfig, PlatformOverride, Runtime, RegistryEntry, AppId } from "./schemas.js";
9
+ export type TransportType = z.infer<typeof TransportType>;
10
+ export type StdioServerConfig = z.infer<typeof StdioServerConfig>;
11
+ export type RemoteServerConfig = z.infer<typeof RemoteServerConfig>;
12
+ export type ServerConfig = z.infer<typeof ServerConfig>;
13
+ export type LooseServerConfig = z.infer<typeof LooseServerConfig>;
14
+ export type CanonicalMCPConfig = z.infer<typeof CanonicalMCPConfig>;
15
+ export type PlatformOverride = z.infer<typeof PlatformOverride>;
16
+ export type Runtime = z.infer<typeof Runtime>;
17
+ export type RegistryEntry = z.infer<typeof RegistryEntry>;
18
+ export type AppId = z.infer<typeof AppId>;
19
+ /**
20
+ * Metadata about a target application.
21
+ * Used by the CLI for auto-detection and display.
22
+ */
23
+ export interface AppMetadata {
24
+ /** Unique app identifier */
25
+ id: AppId;
26
+ /** Human-readable app name */
27
+ name: string;
28
+ /** Brief description of the app */
29
+ description: string;
30
+ /** Config file path pattern (with platform placeholders) */
31
+ configPaths: {
32
+ win32?: string;
33
+ darwin?: string;
34
+ linux?: string;
35
+ };
36
+ /** Config file format */
37
+ configFormat: "json" | "jsonc" | "yaml";
38
+ /** URL to the app's MCP documentation */
39
+ docsUrl: string;
40
+ }
41
+ /**
42
+ * A config generator transforms canonical server configs into
43
+ * app-specific configuration format.
44
+ */
45
+ export interface ConfigGenerator {
46
+ /** The target app metadata */
47
+ app: AppMetadata;
48
+ /**
49
+ * Generate the app-specific config object for a single server.
50
+ * Returns the full config structure including the root key.
51
+ */
52
+ generate(serverName: string, config: LooseServerConfig): Record<string, unknown>;
53
+ /**
54
+ * Generate the app-specific config for multiple servers.
55
+ * Returns the full config structure including the root key.
56
+ */
57
+ generateAll(servers: Record<string, LooseServerConfig>): Record<string, unknown>;
58
+ /**
59
+ * Serialize the config object to a string (JSON, YAML, etc.)
60
+ */
61
+ serialize(config: Record<string, unknown>): string;
62
+ }
63
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,KAAK,EACN,MAAM,cAAc,CAAC;AAMtB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAM1D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,Y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AiB,CAAC,GACzC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC;CACpD"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * TypeScript types inferred from Zod schemas.
3
+ *
4
+ * These types are the single source of truth — derived directly from
5
+ * the schemas so they can never drift out of sync.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Utility functions for working with canonical MCP server configs.
3
+ */
4
+ import type { LooseServerConfig, StdioServerConfig, RemoteServerConfig, TransportType } from "./types.js";
5
+ /**
6
+ * Type guard: checks if a config is a stdio transport config.
7
+ */
8
+ export declare function isStdioConfig(config: LooseServerConfig): config is StdioServerConfig;
9
+ /**
10
+ * Type guard: checks if a config is a remote transport config.
11
+ */
12
+ export declare function isRemoteConfig(config: LooseServerConfig): config is RemoteServerConfig;
13
+ /**
14
+ * Infer the transport type from a server config.
15
+ *
16
+ * For stdio configs, always returns "stdio".
17
+ * For remote configs, uses the explicit `transport` field if set,
18
+ * otherwise infers from the URL (paths containing "/sse" → "sse", else "http").
19
+ */
20
+ export declare function inferTransport(config: LooseServerConfig): TransportType;
21
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE1G;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,iBAAiB,GACxB,MAAM,IAAI,iBAAiB,CAE7B;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,iBAAiB,GACxB,MAAM,IAAI,kBAAkB,CAE9B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,iBAAiB,GAAG,aAAa,CAsBvE"}
package/dist/utils.js ADDED
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Utility functions for working with canonical MCP server configs.
3
+ */
4
+ /**
5
+ * Type guard: checks if a config is a stdio transport config.
6
+ */
7
+ export function isStdioConfig(config) {
8
+ return "command" in config && typeof config.command === "string";
9
+ }
10
+ /**
11
+ * Type guard: checks if a config is a remote transport config.
12
+ */
13
+ export function isRemoteConfig(config) {
14
+ return "url" in config && typeof config.url === "string";
15
+ }
16
+ /**
17
+ * Infer the transport type from a server config.
18
+ *
19
+ * For stdio configs, always returns "stdio".
20
+ * For remote configs, uses the explicit `transport` field if set,
21
+ * otherwise infers from the URL (paths containing "/sse" → "sse", else "http").
22
+ */
23
+ export function inferTransport(config) {
24
+ if (isStdioConfig(config)) {
25
+ return "stdio";
26
+ }
27
+ if (isRemoteConfig(config)) {
28
+ if (config.transport) {
29
+ return config.transport;
30
+ }
31
+ // Infer from URL (matches FastMCP's logic)
32
+ try {
33
+ const url = new URL(config.url);
34
+ if (/\/sse(\/|\?|&|$)/.test(url.pathname)) {
35
+ return "sse";
36
+ }
37
+ }
38
+ catch {
39
+ // Invalid URL, fall through
40
+ }
41
+ return "http";
42
+ }
43
+ return "stdio";
44
+ }
45
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,MAAyB;IAEzB,OAAO,SAAS,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAyB;IAEzB,OAAO,KAAK,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ,CAAC;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,MAAyB;IACtD,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACrB,OAAO,MAAM,CAAC,SAAS,CAAC;QAC1B,CAAC;QACD,2CAA2C;QAC3C,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAChC,IAAI,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC1C,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,4BAA4B;QAC9B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@getmcp/core",
3
+ "version": "0.1.1",
4
+ "description": "Core types, schemas, and validation for getmcp canonical configuration format",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "test": "vitest run",
22
+ "lint": "tsc --noEmit",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "keywords": [
26
+ "mcp",
27
+ "model-context-protocol",
28
+ "ai",
29
+ "config",
30
+ "schema",
31
+ "zod",
32
+ "validation"
33
+ ],
34
+ "license": "MIT",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/RodrigoTomeES/getmcp.git",
38
+ "directory": "packages/core"
39
+ },
40
+ "homepage": "https://github.com/RodrigoTomeES/getmcp/tree/main/packages/core#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/RodrigoTomeES/getmcp/issues"
43
+ },
44
+ "engines": {
45
+ "node": ">=22.0.0"
46
+ },
47
+ "dependencies": {
48
+ "zod": "^3.24.0"
49
+ }
50
+ }