graphql-agent-toolkit 1.0.0

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/dist/cli.cjs ADDED
@@ -0,0 +1,574 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // src/cli.ts
5
+ var import_commander = require("commander");
6
+
7
+ // src/introspection/fetcher.ts
8
+ var import_graphql = require("graphql");
9
+ var import_graphql_request = require("graphql-request");
10
+ async function fetchSchema(options) {
11
+ const client = new import_graphql_request.GraphQLClient(options.endpoint, {
12
+ headers: options.headers
13
+ });
14
+ const query = (0, import_graphql.getIntrospectionQuery)();
15
+ try {
16
+ const result = await client.request(query);
17
+ return result;
18
+ } catch (error) {
19
+ if (error instanceof Error) {
20
+ throw new Error(`Failed to fetch schema from ${options.endpoint}: ${error.message}`);
21
+ }
22
+ throw new Error(`Failed to fetch schema from ${options.endpoint}: Unknown error`);
23
+ }
24
+ }
25
+
26
+ // src/introspection/parser.ts
27
+ function convertTypeRef(introspectionType) {
28
+ return {
29
+ kind: introspectionType.kind,
30
+ name: introspectionType.name ?? null,
31
+ ofType: introspectionType.ofType ? convertTypeRef(
32
+ introspectionType.ofType
33
+ ) : null
34
+ };
35
+ }
36
+ function convertArgument(arg) {
37
+ return {
38
+ name: arg.name,
39
+ description: arg.description ?? null,
40
+ type: convertTypeRef(arg.type),
41
+ defaultValue: arg.defaultValue ?? null
42
+ };
43
+ }
44
+ function convertField(field) {
45
+ return {
46
+ name: field.name,
47
+ description: field.description ?? null,
48
+ type: convertTypeRef(field.type),
49
+ args: (field.args ?? []).map(convertArgument),
50
+ isDeprecated: field.isDeprecated ?? false
51
+ };
52
+ }
53
+ function parseSchema(introspectionResult) {
54
+ const schema = introspectionResult.__schema;
55
+ const types = /* @__PURE__ */ new Map();
56
+ for (const type of schema.types) {
57
+ if (type.name.startsWith("__")) {
58
+ continue;
59
+ }
60
+ const schemaType = {
61
+ name: type.name,
62
+ kind: type.kind,
63
+ description: type.description ?? null,
64
+ fields: "fields" in type && type.fields ? type.fields.map(convertField) : [],
65
+ inputFields: "inputFields" in type && type.inputFields ? type.inputFields.map(convertArgument) : [],
66
+ enumValues: "enumValues" in type && type.enumValues ? type.enumValues.map((v) => ({
67
+ name: v.name,
68
+ description: v.description ?? null
69
+ })) : [],
70
+ interfaces: "interfaces" in type && type.interfaces ? type.interfaces.map((i) => i.name) : [],
71
+ possibleTypes: "possibleTypes" in type && type.possibleTypes ? type.possibleTypes.map((t) => t.name) : []
72
+ };
73
+ types.set(type.name, schemaType);
74
+ }
75
+ return {
76
+ queryType: schema.queryType.name,
77
+ mutationType: schema.mutationType?.name ?? null,
78
+ subscriptionType: schema.subscriptionType?.name ?? null,
79
+ types
80
+ };
81
+ }
82
+
83
+ // src/cli/init.ts
84
+ var import_node_fs = require("fs");
85
+ function parseHeaders(headerArgs) {
86
+ const headers = {};
87
+ if (!headerArgs) return headers;
88
+ for (const h of headerArgs) {
89
+ const colonIdx = h.indexOf(":");
90
+ if (colonIdx === -1) {
91
+ console.warn(`Warning: Invalid header format "${h}". Expected "Key: Value".`);
92
+ continue;
93
+ }
94
+ const key = h.slice(0, colonIdx).trim();
95
+ const value = h.slice(colonIdx + 1).trim();
96
+ headers[key] = value;
97
+ }
98
+ return headers;
99
+ }
100
+ async function runInit(options) {
101
+ const headers = parseHeaders(options.header);
102
+ console.log(`Introspecting GraphQL endpoint: ${options.endpoint}...`);
103
+ try {
104
+ const introspectionResult = await fetchSchema({
105
+ endpoint: options.endpoint,
106
+ headers
107
+ });
108
+ const schema = parseSchema(introspectionResult);
109
+ const queryType = schema.types.get(schema.queryType);
110
+ const mutationType = schema.mutationType ? schema.types.get(schema.mutationType) : null;
111
+ const queryCount = queryType?.fields.length ?? 0;
112
+ const mutationCount = mutationType?.fields.length ?? 0;
113
+ const typeCount = Array.from(schema.types.values()).filter(
114
+ (t) => t.kind !== "SCALAR"
115
+ ).length;
116
+ console.log(`
117
+ Schema Summary:`);
118
+ console.log(` Types: ${typeCount}`);
119
+ console.log(` Queries: ${queryCount}`);
120
+ console.log(` Mutations: ${mutationCount}`);
121
+ const config = {
122
+ endpoint: options.endpoint,
123
+ ...Object.keys(headers).length > 0 ? { headers } : {},
124
+ operationDepth: 2,
125
+ includeDeprecated: false
126
+ };
127
+ if (options.output) {
128
+ (0, import_node_fs.writeFileSync)(options.output, JSON.stringify(config, null, 2) + "\n");
129
+ console.log(`
130
+ Config written to: ${options.output}`);
131
+ } else {
132
+ console.log(`
133
+ Config:`);
134
+ console.log(JSON.stringify(config, null, 2));
135
+ }
136
+ return config;
137
+ } catch (error) {
138
+ const message = error instanceof Error ? error.message : "Unknown error";
139
+ console.error(`Error: ${message}`);
140
+ throw error;
141
+ }
142
+ }
143
+
144
+ // src/cli/serve.ts
145
+ var import_node_fs2 = require("fs");
146
+ var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
147
+
148
+ // src/mcp/server.ts
149
+ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
150
+ var import_zod2 = require("zod");
151
+
152
+ // src/mcp/executor.ts
153
+ var import_graphql_request2 = require("graphql-request");
154
+ var GraphQLExecutor = class {
155
+ client;
156
+ constructor(endpoint, headers) {
157
+ this.client = new import_graphql_request2.GraphQLClient(endpoint, { headers });
158
+ }
159
+ async execute(operation, variables, additionalHeaders) {
160
+ try {
161
+ const result = await this.client.request(operation, variables, additionalHeaders);
162
+ return JSON.stringify(result, null, 2);
163
+ } catch (error) {
164
+ if (error instanceof Error) {
165
+ throw new Error(`GraphQL execution failed: ${error.message}`);
166
+ }
167
+ throw new Error("GraphQL execution failed: Unknown error");
168
+ }
169
+ }
170
+ };
171
+
172
+ // src/mcp/tool-factory.ts
173
+ var import_zod = require("zod");
174
+
175
+ // src/operations/variables.ts
176
+ function typeRefToString(typeRef) {
177
+ if (typeRef.kind === "NON_NULL") {
178
+ if (!typeRef.ofType) {
179
+ return "Unknown!";
180
+ }
181
+ return `${typeRefToString(typeRef.ofType)}!`;
182
+ }
183
+ if (typeRef.kind === "LIST") {
184
+ if (!typeRef.ofType) {
185
+ return "[Unknown]";
186
+ }
187
+ return `[${typeRefToString(typeRef.ofType)}]`;
188
+ }
189
+ return typeRef.name ?? "Unknown";
190
+ }
191
+ function isRequired(typeRef) {
192
+ return typeRef.kind === "NON_NULL";
193
+ }
194
+ function unwrapType(typeRef) {
195
+ if (typeRef.kind === "NON_NULL" || typeRef.kind === "LIST") {
196
+ if (typeRef.ofType) {
197
+ return unwrapType(typeRef.ofType);
198
+ }
199
+ }
200
+ return typeRef;
201
+ }
202
+
203
+ // src/operations/builder.ts
204
+ var SCALAR_KINDS = /* @__PURE__ */ new Set(["SCALAR", "ENUM"]);
205
+ function isScalarLike(schema, field) {
206
+ const unwrapped = unwrapType(field.type);
207
+ if (SCALAR_KINDS.has(unwrapped.kind)) {
208
+ return true;
209
+ }
210
+ if (unwrapped.name) {
211
+ const namedType = schema.types.get(unwrapped.name);
212
+ if (namedType && SCALAR_KINDS.has(namedType.kind)) {
213
+ return true;
214
+ }
215
+ }
216
+ return false;
217
+ }
218
+ function buildSelectionSet(schema, typeName, currentDepth, maxDepth, visited, includeDeprecated, indentLevel = 2) {
219
+ if (currentDepth >= maxDepth) {
220
+ return "";
221
+ }
222
+ const type = schema.types.get(typeName);
223
+ if (!type || type.fields.length === 0) {
224
+ return "";
225
+ }
226
+ const fieldIndent = " ".repeat(indentLevel + 1);
227
+ const closingIndent = " ".repeat(indentLevel);
228
+ if (visited.has(typeName)) {
229
+ const scalarFields = type.fields.filter((f) => !f.isDeprecated || includeDeprecated).filter((f) => isScalarLike(schema, f));
230
+ if (scalarFields.length === 0) {
231
+ return "";
232
+ }
233
+ return `{
234
+ ${scalarFields.map((f) => `${fieldIndent}${f.name}`).join("\n")}
235
+ ${closingIndent}}`;
236
+ }
237
+ visited.add(typeName);
238
+ const fields = type.fields.filter((f) => !f.isDeprecated || includeDeprecated);
239
+ const lines = [];
240
+ for (const field of fields) {
241
+ const unwrapped = unwrapType(field.type);
242
+ if (isScalarLike(schema, field)) {
243
+ lines.push(`${fieldIndent}${field.name}`);
244
+ } else if (unwrapped.name) {
245
+ const nestedSelection = buildSelectionSet(
246
+ schema,
247
+ unwrapped.name,
248
+ currentDepth + 1,
249
+ maxDepth,
250
+ new Set(visited),
251
+ includeDeprecated,
252
+ indentLevel + 1
253
+ );
254
+ if (nestedSelection) {
255
+ lines.push(`${fieldIndent}${field.name} ${nestedSelection}`);
256
+ }
257
+ }
258
+ }
259
+ visited.delete(typeName);
260
+ if (lines.length === 0) {
261
+ return "";
262
+ }
263
+ return `{
264
+ ${lines.join("\n")}
265
+ ${closingIndent}}`;
266
+ }
267
+ function capitalize(str) {
268
+ return str.charAt(0).toUpperCase() + str.slice(1);
269
+ }
270
+ function buildOperation(schema, rootFieldName, options) {
271
+ const maxDepth = options?.maxDepth ?? 2;
272
+ const includeDeprecated = options?.includeDeprecated ?? false;
273
+ let operationType = "query";
274
+ let rootField;
275
+ const queryType = schema.types.get(schema.queryType);
276
+ if (queryType) {
277
+ rootField = queryType.fields.find((f) => f.name === rootFieldName);
278
+ }
279
+ if (!rootField && schema.mutationType) {
280
+ const mutationType = schema.types.get(schema.mutationType);
281
+ if (mutationType) {
282
+ rootField = mutationType.fields.find((f) => f.name === rootFieldName);
283
+ if (rootField) {
284
+ operationType = "mutation";
285
+ }
286
+ }
287
+ }
288
+ if (!rootField) {
289
+ throw new Error(`Field "${rootFieldName}" not found in schema query or mutation types`);
290
+ }
291
+ const operationName = `${capitalize(rootFieldName)}${capitalize(operationType)}`;
292
+ const variables = rootField.args.map((arg) => ({
293
+ name: arg.name,
294
+ type: typeRefToString(arg.type),
295
+ required: isRequired(arg.type),
296
+ description: arg.description
297
+ }));
298
+ const varDefs = variables.length > 0 ? `(${variables.map((v) => `$${v.name}: ${v.type}`).join(", ")})` : "";
299
+ const argsPassing = rootField.args.length > 0 ? `(${rootField.args.map((a) => `${a.name}: $${a.name}`).join(", ")})` : "";
300
+ const unwrapped = unwrapType(rootField.type);
301
+ let selectionSet = "";
302
+ if (!isScalarLike(schema, rootField) && unwrapped.name) {
303
+ selectionSet = ` ${buildSelectionSet(
304
+ schema,
305
+ unwrapped.name,
306
+ 0,
307
+ maxDepth,
308
+ /* @__PURE__ */ new Set(),
309
+ includeDeprecated,
310
+ 1
311
+ )}`;
312
+ }
313
+ const operation = `${operationType} ${operationName}${varDefs} {
314
+ ${rootFieldName}${argsPassing}${selectionSet}
315
+ }`;
316
+ return {
317
+ operation,
318
+ operationName,
319
+ variables,
320
+ operationType
321
+ };
322
+ }
323
+
324
+ // src/mcp/tool-factory.ts
325
+ function typeRefToZod(typeRef, schema) {
326
+ if (typeRef.kind === "NON_NULL") {
327
+ if (!typeRef.ofType) return import_zod.z.unknown();
328
+ return typeRefToZod(typeRef.ofType, schema);
329
+ }
330
+ if (typeRef.kind === "LIST") {
331
+ if (!typeRef.ofType) return import_zod.z.array(import_zod.z.unknown());
332
+ return import_zod.z.array(typeRefToZod(typeRef.ofType, schema)).optional();
333
+ }
334
+ const unwrapped = unwrapType(typeRef);
335
+ const typeName = unwrapped.name;
336
+ if (typeName) {
337
+ const namedType = schema.types.get(typeName);
338
+ if (namedType && namedType.kind === "ENUM" && namedType.enumValues.length > 0) {
339
+ const values = namedType.enumValues.map((v) => v.name);
340
+ return import_zod.z.enum(values).optional();
341
+ }
342
+ if (namedType && namedType.kind === "INPUT_OBJECT") {
343
+ const shape = {};
344
+ for (const field of namedType.inputFields) {
345
+ const fieldSchema = typeRefToZod(field.type, schema);
346
+ if (field.type.kind === "NON_NULL") {
347
+ shape[field.name] = fieldSchema;
348
+ } else {
349
+ shape[field.name] = fieldSchema.optional();
350
+ }
351
+ }
352
+ return import_zod.z.object(shape);
353
+ }
354
+ }
355
+ switch (typeName) {
356
+ case "String":
357
+ return import_zod.z.string().optional();
358
+ case "Int":
359
+ return import_zod.z.number().int().optional();
360
+ case "Float":
361
+ return import_zod.z.number().optional();
362
+ case "Boolean":
363
+ return import_zod.z.boolean().optional();
364
+ case "ID":
365
+ return import_zod.z.string().optional();
366
+ default:
367
+ return import_zod.z.unknown().optional();
368
+ }
369
+ }
370
+ function buildInputSchema(field, schema) {
371
+ const shape = {};
372
+ for (const arg of field.args) {
373
+ const zodType = typeRefToZod(arg.type, schema);
374
+ if (arg.type.kind === "NON_NULL") {
375
+ shape[arg.name] = zodType;
376
+ } else {
377
+ shape[arg.name] = zodType.optional();
378
+ }
379
+ }
380
+ return shape;
381
+ }
382
+ function createToolsFromSchema(schema, executor, options) {
383
+ const maxDepth = options?.maxDepth ?? 2;
384
+ const includeDeprecated = options?.includeDeprecated ?? false;
385
+ const tools = [];
386
+ const queryType = schema.types.get(schema.queryType);
387
+ if (queryType) {
388
+ for (const field of queryType.fields) {
389
+ if (field.isDeprecated && !includeDeprecated) continue;
390
+ const toolName = `query_${field.name}`;
391
+ const description = field.description || `Query ${field.name}`;
392
+ const inputSchema = buildInputSchema(field, schema);
393
+ tools.push({
394
+ name: toolName,
395
+ description,
396
+ inputSchema,
397
+ execute: async (args) => {
398
+ const op = buildOperation(schema, field.name, { maxDepth, includeDeprecated });
399
+ return executor.execute(op.operation, args);
400
+ }
401
+ });
402
+ }
403
+ }
404
+ if (schema.mutationType) {
405
+ const mutationType = schema.types.get(schema.mutationType);
406
+ if (mutationType) {
407
+ for (const field of mutationType.fields) {
408
+ if (field.isDeprecated && !includeDeprecated) continue;
409
+ const toolName = `mutate_${field.name}`;
410
+ const description = field.description || `Mutation ${field.name}`;
411
+ const inputSchema = buildInputSchema(field, schema);
412
+ tools.push({
413
+ name: toolName,
414
+ description,
415
+ inputSchema,
416
+ execute: async (args) => {
417
+ const op = buildOperation(schema, field.name, { maxDepth, includeDeprecated });
418
+ return executor.execute(op.operation, args);
419
+ }
420
+ });
421
+ }
422
+ }
423
+ }
424
+ return tools;
425
+ }
426
+
427
+ // src/mcp/server.ts
428
+ var packageVersion = "1.0.0";
429
+ async function createAgentToolkitServer(config, options) {
430
+ const serverName = options?.serverName ?? "graphql-agent-toolkit";
431
+ const serverVersion = options?.serverVersion ?? packageVersion;
432
+ const introspectionResult = await fetchSchema({
433
+ endpoint: config.endpoint,
434
+ headers: config.headers
435
+ });
436
+ const schema = parseSchema(introspectionResult);
437
+ const executor = new GraphQLExecutor(config.endpoint, config.headers);
438
+ const tools = createToolsFromSchema(schema, executor, {
439
+ maxDepth: config.operationDepth ?? 2,
440
+ includeDeprecated: config.includeDeprecated ?? false
441
+ });
442
+ const server = new import_mcp.McpServer({
443
+ name: serverName,
444
+ version: serverVersion
445
+ });
446
+ for (const tool of tools) {
447
+ const inputSchema = Object.keys(tool.inputSchema).length > 0 ? tool.inputSchema : void 0;
448
+ if (inputSchema) {
449
+ server.tool(
450
+ tool.name,
451
+ tool.description,
452
+ inputSchema,
453
+ async (args) => {
454
+ try {
455
+ const result = await tool.execute(args);
456
+ return {
457
+ content: [{ type: "text", text: result }]
458
+ };
459
+ } catch (error) {
460
+ const message = error instanceof Error ? error.message : "Unknown error";
461
+ return {
462
+ content: [{ type: "text", text: `Error: ${message}` }],
463
+ isError: true
464
+ };
465
+ }
466
+ }
467
+ );
468
+ } else {
469
+ server.tool(
470
+ tool.name,
471
+ tool.description,
472
+ async () => {
473
+ try {
474
+ const result = await tool.execute({});
475
+ return {
476
+ content: [{ type: "text", text: result }]
477
+ };
478
+ } catch (error) {
479
+ const message = error instanceof Error ? error.message : "Unknown error";
480
+ return {
481
+ content: [{ type: "text", text: `Error: ${message}` }],
482
+ isError: true
483
+ };
484
+ }
485
+ }
486
+ );
487
+ }
488
+ }
489
+ server.tool(
490
+ "explore_schema",
491
+ "Explore the GraphQL schema \u2014 list types, fields, and arguments",
492
+ {
493
+ typeName: import_zod2.z.string().optional().describe("Type name to explore. If omitted, lists all types.")
494
+ },
495
+ async (args) => {
496
+ if (args.typeName) {
497
+ const type = schema.types.get(args.typeName);
498
+ if (!type) {
499
+ return {
500
+ content: [{ type: "text", text: `Type "${args.typeName}" not found.` }]
501
+ };
502
+ }
503
+ return {
504
+ content: [{ type: "text", text: JSON.stringify(type, null, 2) }]
505
+ };
506
+ }
507
+ const typeList = Array.from(schema.types.values()).filter((t) => !["SCALAR"].includes(t.kind)).map((t) => `${t.kind} ${t.name}${t.description ? ` \u2014 ${t.description}` : ""}`);
508
+ return {
509
+ content: [{ type: "text", text: typeList.join("\n") }]
510
+ };
511
+ }
512
+ );
513
+ return server;
514
+ }
515
+
516
+ // src/cli/serve.ts
517
+ async function runServe(options) {
518
+ let config;
519
+ if (options.config) {
520
+ try {
521
+ const raw = (0, import_node_fs2.readFileSync)(options.config, "utf-8");
522
+ config = JSON.parse(raw);
523
+ } catch (error) {
524
+ const message = error instanceof Error ? error.message : "Unknown error";
525
+ console.error(`Error reading config file: ${message}`);
526
+ process.exit(1);
527
+ }
528
+ } else if (options.endpoint) {
529
+ const headers = {};
530
+ if (options.header) {
531
+ for (const h of options.header) {
532
+ const colonIdx = h.indexOf(":");
533
+ if (colonIdx !== -1) {
534
+ headers[h.slice(0, colonIdx).trim()] = h.slice(colonIdx + 1).trim();
535
+ }
536
+ }
537
+ }
538
+ config = {
539
+ endpoint: options.endpoint,
540
+ ...Object.keys(headers).length > 0 ? { headers } : {}
541
+ };
542
+ } else {
543
+ console.error("Error: Either --config or --endpoint must be specified.");
544
+ process.exit(1);
545
+ }
546
+ console.error(`Starting MCP server for endpoint: ${config.endpoint}`);
547
+ try {
548
+ const server = await createAgentToolkitServer(config);
549
+ const transport = new import_stdio.StdioServerTransport();
550
+ await server.connect(transport);
551
+ console.error("MCP server running on stdio");
552
+ } catch (error) {
553
+ const message = error instanceof Error ? error.message : "Unknown error";
554
+ console.error(`Error starting server: ${message}`);
555
+ process.exit(1);
556
+ }
557
+ }
558
+
559
+ // src/cli.ts
560
+ var version = "1.0.0";
561
+ var program = new import_commander.Command();
562
+ program.name("graphql-agent-toolkit").description("Turn any GraphQL API into AI-agent-ready tools").version(version);
563
+ program.command("init").description("Introspect a GraphQL endpoint and generate a config file").requiredOption("--endpoint <url>", "GraphQL endpoint URL").option("--header <headers...>", 'HTTP headers in "Key: Value" format').option("--output <file>", "Output file path for the config").action(async (options) => {
564
+ try {
565
+ await runInit(options);
566
+ } catch {
567
+ process.exit(1);
568
+ }
569
+ });
570
+ program.command("serve").description("Start an MCP server for a GraphQL endpoint").option("--config <file>", "Path to config JSON file").option("--endpoint <url>", "GraphQL endpoint URL (alternative to --config)").option("--header <headers...>", 'HTTP headers in "Key: Value" format').action(async (options) => {
571
+ await runServe(options);
572
+ });
573
+ program.parse();
574
+ //# sourceMappingURL=cli.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli.ts","../src/introspection/fetcher.ts","../src/introspection/parser.ts","../src/cli/init.ts","../src/cli/serve.ts","../src/mcp/server.ts","../src/mcp/executor.ts","../src/mcp/tool-factory.ts","../src/operations/variables.ts","../src/operations/builder.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport { runInit } from './cli/init.js';\nimport { runServe } from './cli/serve.js';\n\nconst version = process.env.PACKAGE_VERSION || '0.1.0';\n\nconst program = new Command();\n\nprogram\n .name('graphql-agent-toolkit')\n .description('Turn any GraphQL API into AI-agent-ready tools')\n .version(version);\n\nprogram\n .command('init')\n .description('Introspect a GraphQL endpoint and generate a config file')\n .requiredOption('--endpoint <url>', 'GraphQL endpoint URL')\n .option('--header <headers...>', 'HTTP headers in \"Key: Value\" format')\n .option('--output <file>', 'Output file path for the config')\n .action(async (options) => {\n try {\n await runInit(options);\n } catch {\n process.exit(1);\n }\n });\n\nprogram\n .command('serve')\n .description('Start an MCP server for a GraphQL endpoint')\n .option('--config <file>', 'Path to config JSON file')\n .option('--endpoint <url>', 'GraphQL endpoint URL (alternative to --config)')\n .option('--header <headers...>', 'HTTP headers in \"Key: Value\" format')\n .action(async (options) => {\n await runServe(options);\n });\n\nprogram.parse();\n","import { getIntrospectionQuery, type IntrospectionQuery } from 'graphql';\nimport { GraphQLClient } from 'graphql-request';\n\nexport interface FetchSchemaOptions {\n endpoint: string;\n headers?: Record<string, string>;\n}\n\nexport async function fetchSchema(options: FetchSchemaOptions): Promise<IntrospectionQuery> {\n const client = new GraphQLClient(options.endpoint, {\n headers: options.headers,\n });\n\n const query = getIntrospectionQuery();\n\n try {\n const result = await client.request<IntrospectionQuery>(query);\n return result;\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Failed to fetch schema from ${options.endpoint}: ${error.message}`);\n }\n throw new Error(`Failed to fetch schema from ${options.endpoint}: Unknown error`);\n }\n}\n","import type { IntrospectionQuery } from 'graphql';\nimport type { ParsedSchema, SchemaType, SchemaField, SchemaArgument, TypeRef } from '../types/index.js';\n\nfunction convertTypeRef(introspectionType: {\n kind: string;\n name?: string | null;\n ofType?: unknown;\n}): TypeRef {\n return {\n kind: introspectionType.kind as TypeRef['kind'],\n name: introspectionType.name ?? null,\n ofType: introspectionType.ofType\n ? convertTypeRef(\n introspectionType.ofType as { kind: string; name?: string | null; ofType?: unknown },\n )\n : null,\n };\n}\n\nfunction convertArgument(arg: {\n name: string;\n description?: string | null;\n type: { kind: string; name?: string | null; ofType?: unknown };\n defaultValue?: string | null;\n}): SchemaArgument {\n return {\n name: arg.name,\n description: arg.description ?? null,\n type: convertTypeRef(arg.type),\n defaultValue: arg.defaultValue ?? null,\n };\n}\n\nfunction convertField(field: {\n name: string;\n description?: string | null;\n type: { kind: string; name?: string | null; ofType?: unknown };\n args?: readonly {\n name: string;\n description?: string | null;\n type: { kind: string; name?: string | null; ofType?: unknown };\n defaultValue?: string | null;\n }[];\n isDeprecated?: boolean;\n}): SchemaField {\n return {\n name: field.name,\n description: field.description ?? null,\n type: convertTypeRef(field.type),\n args: (field.args ?? []).map(convertArgument),\n isDeprecated: field.isDeprecated ?? false,\n };\n}\n\nexport function parseSchema(introspectionResult: IntrospectionQuery): ParsedSchema {\n const schema = introspectionResult.__schema;\n\n const types = new Map<string, SchemaType>();\n\n for (const type of schema.types) {\n // Filter out built-in types (prefixed with __)\n if (type.name.startsWith('__')) {\n continue;\n }\n\n const schemaType: SchemaType = {\n name: type.name,\n kind: type.kind as TypeRef['kind'],\n description: type.description ?? null,\n fields: ('fields' in type && type.fields ? type.fields.map(convertField) : []),\n inputFields: (\n 'inputFields' in type && type.inputFields\n ? (type.inputFields as Array<{\n name: string;\n description?: string | null;\n type: { kind: string; name?: string | null; ofType?: unknown };\n defaultValue?: string | null;\n }>).map(convertArgument)\n : []\n ),\n enumValues: (\n 'enumValues' in type && type.enumValues\n ? type.enumValues.map((v: { name: string; description?: string | null }) => ({\n name: v.name,\n description: v.description ?? null,\n }))\n : []\n ),\n interfaces: (\n 'interfaces' in type && type.interfaces\n ? type.interfaces.map((i: { name: string }) => i.name)\n : []\n ),\n possibleTypes: (\n 'possibleTypes' in type && type.possibleTypes\n ? type.possibleTypes.map((t: { name: string }) => t.name)\n : []\n ),\n };\n\n types.set(type.name, schemaType);\n }\n\n return {\n queryType: schema.queryType.name,\n mutationType: schema.mutationType?.name ?? null,\n subscriptionType: schema.subscriptionType?.name ?? null,\n types,\n };\n}\n","import { fetchSchema } from '../introspection/fetcher.js';\nimport { parseSchema } from '../introspection/parser.js';\nimport type { AgentToolkitConfig } from '../types/index.js';\nimport { writeFileSync } from 'node:fs';\n\nexport interface InitOptions {\n endpoint: string;\n header?: string[];\n output?: string;\n}\n\nfunction parseHeaders(headerArgs?: string[]): Record<string, string> {\n const headers: Record<string, string> = {};\n if (!headerArgs) return headers;\n\n for (const h of headerArgs) {\n const colonIdx = h.indexOf(':');\n if (colonIdx === -1) {\n console.warn(`Warning: Invalid header format \"${h}\". Expected \"Key: Value\".`);\n continue;\n }\n const key = h.slice(0, colonIdx).trim();\n const value = h.slice(colonIdx + 1).trim();\n headers[key] = value;\n }\n\n return headers;\n}\n\nexport async function runInit(options: InitOptions): Promise<AgentToolkitConfig> {\n const headers = parseHeaders(options.header);\n\n console.log(`Introspecting GraphQL endpoint: ${options.endpoint}...`);\n\n try {\n const introspectionResult = await fetchSchema({\n endpoint: options.endpoint,\n headers,\n });\n\n const schema = parseSchema(introspectionResult);\n\n const queryType = schema.types.get(schema.queryType);\n const mutationType = schema.mutationType ? schema.types.get(schema.mutationType) : null;\n\n const queryCount = queryType?.fields.length ?? 0;\n const mutationCount = mutationType?.fields.length ?? 0;\n const typeCount = Array.from(schema.types.values()).filter(\n (t) => t.kind !== 'SCALAR',\n ).length;\n\n console.log(`\\nSchema Summary:`);\n console.log(` Types: ${typeCount}`);\n console.log(` Queries: ${queryCount}`);\n console.log(` Mutations: ${mutationCount}`);\n\n const config: AgentToolkitConfig = {\n endpoint: options.endpoint,\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n operationDepth: 2,\n includeDeprecated: false,\n };\n\n if (options.output) {\n writeFileSync(options.output, JSON.stringify(config, null, 2) + '\\n');\n console.log(`\\nConfig written to: ${options.output}`);\n } else {\n console.log(`\\nConfig:`);\n console.log(JSON.stringify(config, null, 2));\n }\n\n return config;\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error(`Error: ${message}`);\n throw error;\n }\n}\n","import { readFileSync } from 'node:fs';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { createAgentToolkitServer } from '../mcp/server.js';\nimport type { AgentToolkitConfig } from '../types/index.js';\n\nexport interface ServeOptions {\n config?: string;\n endpoint?: string;\n header?: string[];\n}\n\nexport async function runServe(options: ServeOptions): Promise<void> {\n let config: AgentToolkitConfig;\n\n if (options.config) {\n try {\n const raw = readFileSync(options.config, 'utf-8');\n config = JSON.parse(raw) as AgentToolkitConfig;\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error(`Error reading config file: ${message}`);\n process.exit(1);\n }\n } else if (options.endpoint) {\n const headers: Record<string, string> = {};\n if (options.header) {\n for (const h of options.header) {\n const colonIdx = h.indexOf(':');\n if (colonIdx !== -1) {\n headers[h.slice(0, colonIdx).trim()] = h.slice(colonIdx + 1).trim();\n }\n }\n }\n config = {\n endpoint: options.endpoint,\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n };\n } else {\n console.error('Error: Either --config or --endpoint must be specified.');\n process.exit(1);\n }\n\n console.error(`Starting MCP server for endpoint: ${config.endpoint}`);\n\n try {\n const server = await createAgentToolkitServer(config);\n const transport = new StdioServerTransport();\n await server.connect(transport);\n console.error('MCP server running on stdio');\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n console.error(`Error starting server: ${message}`);\n process.exit(1);\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport type { AgentToolkitConfig } from '../types/index.js';\nimport { fetchSchema } from '../introspection/fetcher.js';\nimport { parseSchema } from '../introspection/parser.js';\nimport { GraphQLExecutor } from './executor.js';\nimport { createToolsFromSchema } from './tool-factory.js';\n\nconst packageVersion = process.env.PACKAGE_VERSION || '0.1.0';\n\nexport interface AgentToolkitServerOptions {\n serverName?: string;\n serverVersion?: string;\n}\n\n/**\n * Creates a fully configured MCP server from a GraphQL endpoint configuration.\n */\nexport async function createAgentToolkitServer(\n config: AgentToolkitConfig,\n options?: AgentToolkitServerOptions,\n): Promise<McpServer> {\n const serverName = options?.serverName ?? 'graphql-agent-toolkit';\n const serverVersion = options?.serverVersion ?? packageVersion;\n\n // Fetch and parse schema\n const introspectionResult = await fetchSchema({\n endpoint: config.endpoint,\n headers: config.headers,\n });\n const schema = parseSchema(introspectionResult);\n\n // Create executor\n const executor = new GraphQLExecutor(config.endpoint, config.headers);\n\n // Create tools\n const tools = createToolsFromSchema(schema, executor, {\n maxDepth: config.operationDepth ?? 2,\n includeDeprecated: config.includeDeprecated ?? false,\n });\n\n // Create MCP server\n const server = new McpServer({\n name: serverName,\n version: serverVersion,\n });\n\n // Register tools\n for (const tool of tools) {\n const inputSchema = Object.keys(tool.inputSchema).length > 0 ? tool.inputSchema : undefined;\n\n if (inputSchema) {\n server.tool(\n tool.name,\n tool.description,\n inputSchema,\n async (args) => {\n try {\n const result = await tool.execute(args as Record<string, unknown>);\n return {\n content: [{ type: 'text' as const, text: result }],\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n return {\n content: [{ type: 'text' as const, text: `Error: ${message}` }],\n isError: true,\n };\n }\n },\n );\n } else {\n server.tool(\n tool.name,\n tool.description,\n async () => {\n try {\n const result = await tool.execute({});\n return {\n content: [{ type: 'text' as const, text: result }],\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n return {\n content: [{ type: 'text' as const, text: `Error: ${message}` }],\n isError: true,\n };\n }\n },\n );\n }\n }\n\n // Register a schema explorer resource\n server.tool(\n 'explore_schema',\n 'Explore the GraphQL schema — list types, fields, and arguments',\n {\n typeName: z.string().optional().describe('Type name to explore. If omitted, lists all types.'),\n },\n async (args) => {\n if (args.typeName) {\n const type = schema.types.get(args.typeName);\n if (!type) {\n return {\n content: [{ type: 'text' as const, text: `Type \"${args.typeName}\" not found.` }],\n };\n }\n return {\n content: [{ type: 'text' as const, text: JSON.stringify(type, null, 2) }],\n };\n }\n\n const typeList = Array.from(schema.types.values())\n .filter((t) => !['SCALAR'].includes(t.kind))\n .map((t) => `${t.kind} ${t.name}${t.description ? ` — ${t.description}` : ''}`);\n\n return {\n content: [{ type: 'text' as const, text: typeList.join('\\n') }],\n };\n },\n );\n\n return server;\n}\n","import { GraphQLClient } from 'graphql-request';\n\nexport class GraphQLExecutor {\n private client: GraphQLClient;\n\n constructor(endpoint: string, headers?: Record<string, string>) {\n this.client = new GraphQLClient(endpoint, { headers });\n }\n\n async execute(\n operation: string,\n variables?: Record<string, unknown>,\n additionalHeaders?: Record<string, string>,\n ): Promise<string> {\n try {\n const result = await this.client.request(operation, variables, additionalHeaders);\n return JSON.stringify(result, null, 2);\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`GraphQL execution failed: ${error.message}`);\n }\n throw new Error('GraphQL execution failed: Unknown error');\n }\n }\n}\n","import { z } from 'zod';\nimport type { ParsedSchema, SchemaField, TypeRef } from '../types/index.js';\nimport { buildOperation } from '../operations/index.js';\nimport { unwrapType } from '../operations/variables.js';\nimport type { GraphQLExecutor } from './executor.js';\n\nexport interface McpToolDefinition {\n name: string;\n description: string;\n inputSchema: Record<string, z.ZodType>;\n execute: (args: Record<string, unknown>) => Promise<string>;\n}\n\nexport interface CreateToolsOptions {\n maxDepth?: number;\n includeDeprecated?: boolean;\n}\n\n/**\n * Maps a GraphQL TypeRef to a Zod schema for validation.\n */\nfunction typeRefToZod(typeRef: TypeRef, schema: ParsedSchema): z.ZodType {\n if (typeRef.kind === 'NON_NULL') {\n if (!typeRef.ofType) return z.unknown();\n return typeRefToZod(typeRef.ofType, schema);\n }\n\n if (typeRef.kind === 'LIST') {\n if (!typeRef.ofType) return z.array(z.unknown());\n return z.array(typeRefToZod(typeRef.ofType, schema)).optional();\n }\n\n const unwrapped = unwrapType(typeRef);\n const typeName = unwrapped.name;\n\n if (typeName) {\n // Check if it's an enum\n const namedType = schema.types.get(typeName);\n if (namedType && namedType.kind === 'ENUM' && namedType.enumValues.length > 0) {\n const values = namedType.enumValues.map((v) => v.name) as [string, ...string[]];\n return z.enum(values).optional();\n }\n\n // Check if it's an input object\n if (namedType && namedType.kind === 'INPUT_OBJECT') {\n const shape: Record<string, z.ZodType> = {};\n for (const field of namedType.inputFields) {\n const fieldSchema = typeRefToZod(field.type, schema);\n if (field.type.kind === 'NON_NULL') {\n shape[field.name] = fieldSchema;\n } else {\n shape[field.name] = fieldSchema.optional();\n }\n }\n return z.object(shape);\n }\n }\n\n // Map scalars\n switch (typeName) {\n case 'String':\n return z.string().optional();\n case 'Int':\n return z.number().int().optional();\n case 'Float':\n return z.number().optional();\n case 'Boolean':\n return z.boolean().optional();\n case 'ID':\n return z.string().optional();\n default:\n return z.unknown().optional();\n }\n}\n\n/**\n * Builds the Zod input schema object for a tool from a field's arguments.\n */\nfunction buildInputSchema(\n field: SchemaField,\n schema: ParsedSchema,\n): Record<string, z.ZodType> {\n const shape: Record<string, z.ZodType> = {};\n\n for (const arg of field.args) {\n const zodType = typeRefToZod(arg.type, schema);\n if (arg.type.kind === 'NON_NULL') {\n shape[arg.name] = zodType;\n } else {\n shape[arg.name] = zodType.optional();\n }\n }\n\n return shape;\n}\n\n/**\n * Creates MCP tool definitions from a parsed GraphQL schema.\n */\nexport function createToolsFromSchema(\n schema: ParsedSchema,\n executor: GraphQLExecutor,\n options?: CreateToolsOptions,\n): McpToolDefinition[] {\n const maxDepth = options?.maxDepth ?? 2;\n const includeDeprecated = options?.includeDeprecated ?? false;\n const tools: McpToolDefinition[] = [];\n\n // Process query fields\n const queryType = schema.types.get(schema.queryType);\n if (queryType) {\n for (const field of queryType.fields) {\n if (field.isDeprecated && !includeDeprecated) continue;\n\n const toolName = `query_${field.name}`;\n const description = field.description || `Query ${field.name}`;\n const inputSchema = buildInputSchema(field, schema);\n\n tools.push({\n name: toolName,\n description,\n inputSchema,\n execute: async (args: Record<string, unknown>) => {\n const op = buildOperation(schema, field.name, { maxDepth, includeDeprecated });\n return executor.execute(op.operation, args);\n },\n });\n }\n }\n\n // Process mutation fields\n if (schema.mutationType) {\n const mutationType = schema.types.get(schema.mutationType);\n if (mutationType) {\n for (const field of mutationType.fields) {\n if (field.isDeprecated && !includeDeprecated) continue;\n\n const toolName = `mutate_${field.name}`;\n const description = field.description || `Mutation ${field.name}`;\n const inputSchema = buildInputSchema(field, schema);\n\n tools.push({\n name: toolName,\n description,\n inputSchema,\n execute: async (args: Record<string, unknown>) => {\n const op = buildOperation(schema, field.name, { maxDepth, includeDeprecated });\n return executor.execute(op.operation, args);\n },\n });\n }\n }\n }\n\n return tools;\n}\n","import type { TypeRef } from '../types/index.js';\n\n/**\n * Converts a TypeRef to a GraphQL type string.\n * e.g. NON_NULL(LIST(NON_NULL(OBJECT(\"User\")))) → \"[User!]!\"\n */\nexport function typeRefToString(typeRef: TypeRef): string {\n if (typeRef.kind === 'NON_NULL') {\n if (!typeRef.ofType) {\n return 'Unknown!';\n }\n return `${typeRefToString(typeRef.ofType)}!`;\n }\n\n if (typeRef.kind === 'LIST') {\n if (!typeRef.ofType) {\n return '[Unknown]';\n }\n return `[${typeRefToString(typeRef.ofType)}]`;\n }\n\n return typeRef.name ?? 'Unknown';\n}\n\n/**\n * Checks if a TypeRef is required (NON_NULL at top level).\n */\nexport function isRequired(typeRef: TypeRef): boolean {\n return typeRef.kind === 'NON_NULL';\n}\n\n/**\n * Unwraps a TypeRef to get the underlying named type.\n */\nexport function unwrapType(typeRef: TypeRef): TypeRef {\n if (typeRef.kind === 'NON_NULL' || typeRef.kind === 'LIST') {\n if (typeRef.ofType) {\n return unwrapType(typeRef.ofType);\n }\n }\n return typeRef;\n}\n","import type { ParsedSchema, SchemaField } from '../types/index.js';\nimport { typeRefToString, isRequired, unwrapType } from './variables.js';\n\nexport interface VariableDefinition {\n name: string;\n type: string;\n required: boolean;\n description: string | null;\n}\n\nexport interface GeneratedOperation {\n operation: string;\n operationName: string;\n variables: VariableDefinition[];\n operationType: 'query' | 'mutation';\n}\n\nexport interface BuildOperationOptions {\n maxDepth?: number;\n includeDeprecated?: boolean;\n}\n\nconst SCALAR_KINDS = new Set(['SCALAR', 'ENUM']);\n\nfunction isScalarLike(schema: ParsedSchema, field: SchemaField): boolean {\n const unwrapped = unwrapType(field.type);\n if (SCALAR_KINDS.has(unwrapped.kind)) {\n return true;\n }\n // Check if the named type exists and is scalar/enum\n if (unwrapped.name) {\n const namedType = schema.types.get(unwrapped.name);\n if (namedType && SCALAR_KINDS.has(namedType.kind)) {\n return true;\n }\n }\n return false;\n}\n\nfunction buildSelectionSet(\n schema: ParsedSchema,\n typeName: string,\n currentDepth: number,\n maxDepth: number,\n visited: Set<string>,\n includeDeprecated: boolean,\n indentLevel: number = 2,\n): string {\n if (currentDepth >= maxDepth) {\n return '';\n }\n\n const type = schema.types.get(typeName);\n if (!type || type.fields.length === 0) {\n return '';\n }\n\n const fieldIndent = ' '.repeat(indentLevel + 1);\n const closingIndent = ' '.repeat(indentLevel);\n\n // Prevent infinite recursion\n if (visited.has(typeName)) {\n // Only include scalar fields to break the cycle\n const scalarFields = type.fields\n .filter((f) => !f.isDeprecated || includeDeprecated)\n .filter((f) => isScalarLike(schema, f));\n\n if (scalarFields.length === 0) {\n return '';\n }\n\n return `{\\n${scalarFields.map((f) => `${fieldIndent}${f.name}`).join('\\n')}\\n${closingIndent}}`;\n }\n\n visited.add(typeName);\n\n const fields = type.fields.filter((f) => !f.isDeprecated || includeDeprecated);\n const lines: string[] = [];\n\n for (const field of fields) {\n const unwrapped = unwrapType(field.type);\n\n if (isScalarLike(schema, field)) {\n lines.push(`${fieldIndent}${field.name}`);\n } else if (unwrapped.name) {\n const nestedSelection = buildSelectionSet(\n schema,\n unwrapped.name,\n currentDepth + 1,\n maxDepth,\n new Set(visited),\n includeDeprecated,\n indentLevel + 1,\n );\n if (nestedSelection) {\n lines.push(`${fieldIndent}${field.name} ${nestedSelection}`);\n }\n }\n }\n\n visited.delete(typeName);\n\n if (lines.length === 0) {\n return '';\n }\n\n return `{\\n${lines.join('\\n')}\\n${closingIndent}}`;\n}\n\nfunction capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function buildOperation(\n schema: ParsedSchema,\n rootFieldName: string,\n options?: BuildOperationOptions,\n): GeneratedOperation {\n const maxDepth = options?.maxDepth ?? 2;\n const includeDeprecated = options?.includeDeprecated ?? false;\n\n // Look up the field in query type first, then mutation type\n let operationType: 'query' | 'mutation' = 'query';\n let rootField: SchemaField | undefined;\n\n const queryType = schema.types.get(schema.queryType);\n if (queryType) {\n rootField = queryType.fields.find((f) => f.name === rootFieldName);\n }\n\n if (!rootField && schema.mutationType) {\n const mutationType = schema.types.get(schema.mutationType);\n if (mutationType) {\n rootField = mutationType.fields.find((f) => f.name === rootFieldName);\n if (rootField) {\n operationType = 'mutation';\n }\n }\n }\n\n if (!rootField) {\n throw new Error(`Field \"${rootFieldName}\" not found in schema query or mutation types`);\n }\n\n const operationName = `${capitalize(rootFieldName)}${capitalize(operationType)}`;\n\n // Build variable definitions from arguments\n const variables: VariableDefinition[] = rootField.args.map((arg) => ({\n name: arg.name,\n type: typeRefToString(arg.type),\n required: isRequired(arg.type),\n description: arg.description,\n }));\n\n // Build the variable definitions string for the operation\n const varDefs = variables.length > 0\n ? `(${variables.map((v) => `$${v.name}: ${v.type}`).join(', ')})`\n : '';\n\n // Build argument passing string\n const argsPassing = rootField.args.length > 0\n ? `(${rootField.args.map((a) => `${a.name}: $${a.name}`).join(', ')})`\n : '';\n\n // Build selection set based on return type\n const unwrapped = unwrapType(rootField.type);\n let selectionSet = '';\n\n if (!isScalarLike(schema, rootField) && unwrapped.name) {\n selectionSet = ` ${buildSelectionSet(\n schema,\n unwrapped.name,\n 0,\n maxDepth,\n new Set(),\n includeDeprecated,\n 1,\n )}`;\n }\n\n const operation = `${operationType} ${operationName}${varDefs} {\\n ${rootFieldName}${argsPassing}${selectionSet}\\n}`;\n\n return {\n operation,\n operationName,\n variables,\n operationType,\n };\n}\n"],"mappings":";;;;AAEA,uBAAwB;;;ACFxB,qBAA+D;AAC/D,6BAA8B;AAO9B,eAAsB,YAAY,SAA0D;AAC1F,QAAM,SAAS,IAAI,qCAAc,QAAQ,UAAU;AAAA,IACjD,SAAS,QAAQ;AAAA,EACnB,CAAC;AAED,QAAM,YAAQ,sCAAsB;AAEpC,MAAI;AACF,UAAM,SAAS,MAAM,OAAO,QAA4B,KAAK;AAC7D,WAAO;AAAA,EACT,SAAS,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,IAAI,MAAM,+BAA+B,QAAQ,QAAQ,KAAK,MAAM,OAAO,EAAE;AAAA,IACrF;AACA,UAAM,IAAI,MAAM,+BAA+B,QAAQ,QAAQ,iBAAiB;AAAA,EAClF;AACF;;;ACrBA,SAAS,eAAe,mBAIZ;AACV,SAAO;AAAA,IACL,MAAM,kBAAkB;AAAA,IACxB,MAAM,kBAAkB,QAAQ;AAAA,IAChC,QAAQ,kBA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