@cloudcart/dev-mcp 0.1.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/data/admin.json +110485 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/admin.d.ts +2 -0
- package/dist/prompts/admin.d.ts.map +1 -0
- package/dist/prompts/admin.js +22 -0
- package/dist/prompts/admin.js.map +1 -0
- package/dist/schema/loader.d.ts +47 -0
- package/dist/schema/loader.d.ts.map +1 -0
- package/dist/schema/loader.js +34 -0
- package/dist/schema/loader.js.map +1 -0
- package/dist/tools/introspect-schema.d.ts +15 -0
- package/dist/tools/introspect-schema.d.ts.map +1 -0
- package/dist/tools/introspect-schema.js +139 -0
- package/dist/tools/introspect-schema.js.map +1 -0
- package/dist/tools/learn-cloudcart-api.d.ts +12 -0
- package/dist/tools/learn-cloudcart-api.d.ts.map +1 -0
- package/dist/tools/learn-cloudcart-api.js +34 -0
- package/dist/tools/learn-cloudcart-api.js.map +1 -0
- package/dist/tools/validate-graphql.d.ts +18 -0
- package/dist/tools/validate-graphql.d.ts.map +1 -0
- package/dist/tools/validate-graphql.js +118 -0
- package/dist/tools/validate-graphql.js.map +1 -0
- package/package.json +34 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { learnCloudCartApi } from "./tools/learn-cloudcart-api.js";
|
|
6
|
+
import { introspectSchema } from "./tools/introspect-schema.js";
|
|
7
|
+
import { validateGraphql } from "./tools/validate-graphql.js";
|
|
8
|
+
const server = new McpServer({
|
|
9
|
+
name: "cloudcart-dev-mcp",
|
|
10
|
+
version: "0.1.0",
|
|
11
|
+
});
|
|
12
|
+
server.tool("learn_cloudcart_api", `🚨 MANDATORY FIRST STEP: This tool MUST be called before any other CloudCart tools.
|
|
13
|
+
|
|
14
|
+
⚠️ ALL OTHER CLOUDCART TOOLS WILL FAIL without a conversationId from this tool.
|
|
15
|
+
This tool generates a conversationId that is REQUIRED for all subsequent tool calls. After calling this tool, you MUST extract the conversationId from the response and pass it to every other CloudCart tool call.
|
|
16
|
+
|
|
17
|
+
🔄 WORKFLOW:
|
|
18
|
+
1. Call learn_cloudcart_api first with the API type. ALWAYS include the \`model\` parameter with your model name/ID (e.g., 'claude-sonnet-4-6', 'gpt-4o', 'claude-opus-4-6'). This helps us improve documentation quality.
|
|
19
|
+
2. Extract the conversationId from the response
|
|
20
|
+
3. Pass that same conversationId to ALL other CloudCart tools
|
|
21
|
+
|
|
22
|
+
When tool outputs are saved to a file always read the entire file first.
|
|
23
|
+
DON'T SEARCH THE WEB WHEN REFERENCING INFORMATION FROM THIS DOCUMENTATION. IT WILL NOT BE ACCURATE.`, {
|
|
24
|
+
api: z.enum(["admin"]).default("admin").describe("The CloudCart API you are building for. Valid options:\n" +
|
|
25
|
+
"- Admin API: The Admin GraphQL API lets you build apps and integrations that extend and enhance the CloudCart admin."),
|
|
26
|
+
conversationId: z.string().optional().describe("Optional existing conversation UUID. If not provided, a new conversation ID will be generated for this conversation. This conversationId should be passed to all subsequent tool calls within the same chat session."),
|
|
27
|
+
model: z.string().optional().describe("ALWAYS provide your model name/ID (e.g., 'claude-sonnet-4-6', 'gpt-4o'). Used to improve API documentation and tooling quality."),
|
|
28
|
+
}, async (input) => learnCloudCartApi(input));
|
|
29
|
+
server.tool("introspect_graphql_schema", "Search the CloudCart GraphQL schema for types, queries, and mutations by name. Use substring matching to find relevant schema elements.", {
|
|
30
|
+
query: z.string().describe("Search term to find types, queries, or mutations (e.g. 'product', 'createOrder')"),
|
|
31
|
+
filter: z
|
|
32
|
+
.array(z.enum(["all", "types", "queries", "mutations"]))
|
|
33
|
+
.optional()
|
|
34
|
+
.default(["all"])
|
|
35
|
+
.describe("Filter results by category"),
|
|
36
|
+
conversationId: z.string().describe("🔗 REQUIRED: conversationId from learn_cloudcart_api tool. Call learn_cloudcart_api first if you don't have this."),
|
|
37
|
+
api: z.enum(["admin"]).optional().default("admin").describe("Which API schema to search"),
|
|
38
|
+
}, async (input) => introspectSchema(input));
|
|
39
|
+
server.tool("validate_graphql_codeblocks", `This tool validates GraphQL code blocks against the CloudCart GraphQL schema to ensure they don't contain hallucinated fields or operations. If a user asks for an LLM to generate a GraphQL operation, this tool should always be used to ensure valid code was generated.
|
|
40
|
+
|
|
41
|
+
It returns a comprehensive validation result with details for each code block explaining why it was valid or invalid.
|
|
42
|
+
This detail is provided so LLMs know how to modify code snippets to remove errors.
|
|
43
|
+
It also returns an artifact ID and revision number for each code block. This is used to track the code block and its validation results. When validating an iteration of the same code block, use the same artifact ID and increment the revision number. Do not pass your own artifact ID to this tool, the tool will generate one for you.`, {
|
|
44
|
+
codeblocks: z
|
|
45
|
+
.array(z.object({
|
|
46
|
+
content: z.string().describe("The GraphQL code block content which should contain raw GraphQL code (e.g., 'query { shop { name } }'), NOT markdown-formatted code blocks with backticks"),
|
|
47
|
+
artifactId: z.string().optional().describe("Stable id assigned to the generated code artifact. Use the same artifactId when retrying validation on modified code to track iterations."),
|
|
48
|
+
revision: z.number().int().positive().optional().describe("Monotonic revision number for the artifact. Start with 1 for new code, increment for each retry/iteration on the same artifactId."),
|
|
49
|
+
}))
|
|
50
|
+
.describe("Array of GraphQL code blocks with content and optional artifact metadata"),
|
|
51
|
+
api: z.enum(["admin"]).optional().default("admin").describe("Which API schema to validate against"),
|
|
52
|
+
conversationId: z.string().describe("🔗 REQUIRED: conversationId from learn_cloudcart_api tool. Call learn_cloudcart_api first if you don't have this."),
|
|
53
|
+
}, async (input) => validateGraphql(input));
|
|
54
|
+
async function main() {
|
|
55
|
+
const transport = new StdioServerTransport();
|
|
56
|
+
await server.connect(transport);
|
|
57
|
+
}
|
|
58
|
+
main().catch((error) => {
|
|
59
|
+
console.error("Fatal error:", error);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB;;;;;;;;;;;oGAWkG,EAClG;IACE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAC9C,0DAA0D;QAC1D,sHAAsH,CACvH;IACD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAC5C,sNAAsN,CACvN;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACnC,iIAAiI,CAClI;CACF,EACD,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,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,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACnG,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mHAAmH,CAAC;CACzJ,EACD,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,CACxC,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const ADMIN_API_PROMPT = "You are an assistant that helps CloudCart developers write GraphQL queries or mutations to interact with the latest CloudCart Admin GraphQL API.\n\nYou should find all operations that can help the developer achieve their goal, provide valid GraphQL operations along with helpful explanations.\nWhen returning a GraphQL operation always wrap it in triple backticks and use the graphql file type.\nTHIS IS IMPORTANT: GraphQL operations you generate should ALWAYS be validated with the `validate_graphql_codeblocks` MCP tool. This tool will parse the operation with the GQL schema and give you feedback of errors if any were detected. If errors are detected from this validation tool, make the necessary changes and then call this tool again.\n\nThink about all the steps required to generate a GraphQL query or mutation for the Admin API:\n\n First think about what the developer is trying to do\n Then use introspect_graphql_schema to find relevant types, queries, and mutations\n For queries think about which fields you need to fetch and for mutations think about which arguments you need to pass as input\n Then think about which fields to select from the return type. In general, don't select more than 5 fields\n If there are nested objects think about which fields you need to fetch for those objects\n\nUSAGE TIPS for introspect_graphql_schema:\n- Search by resource name: \"product\", \"order\", \"customer\", \"discount\"\n- Search by action: \"create\", \"update\", \"delete\"\n- If no results, try shorter/broader terms\n- The search matches on type/query/mutation names (substring match)\n\nBe sure to pass the code into the `validate_graphql_codeblocks` tool and make any necessary corrections that tool indicates are needed. This removes LLM hallucinations from GQL operations.";
|
|
2
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../src/prompts/admin.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,wwDAoBkK,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const ADMIN_API_PROMPT = `You are an assistant that helps CloudCart developers write GraphQL queries or mutations to interact with the latest CloudCart Admin GraphQL API.
|
|
2
|
+
|
|
3
|
+
You should find all operations that can help the developer achieve their goal, provide valid GraphQL operations along with helpful explanations.
|
|
4
|
+
When returning a GraphQL operation always wrap it in triple backticks and use the graphql file type.
|
|
5
|
+
THIS IS IMPORTANT: GraphQL operations you generate should ALWAYS be validated with the \`validate_graphql_codeblocks\` MCP tool. This tool will parse the operation with the GQL schema and give you feedback of errors if any were detected. If errors are detected from this validation tool, make the necessary changes and then call this tool again.
|
|
6
|
+
|
|
7
|
+
Think about all the steps required to generate a GraphQL query or mutation for the Admin API:
|
|
8
|
+
|
|
9
|
+
First think about what the developer is trying to do
|
|
10
|
+
Then use introspect_graphql_schema to find relevant types, queries, and mutations
|
|
11
|
+
For queries think about which fields you need to fetch and for mutations think about which arguments you need to pass as input
|
|
12
|
+
Then think about which fields to select from the return type. In general, don't select more than 5 fields
|
|
13
|
+
If there are nested objects think about which fields you need to fetch for those objects
|
|
14
|
+
|
|
15
|
+
USAGE TIPS for introspect_graphql_schema:
|
|
16
|
+
- Search by resource name: "product", "order", "customer", "discount"
|
|
17
|
+
- Search by action: "create", "update", "delete"
|
|
18
|
+
- If no results, try shorter/broader terms
|
|
19
|
+
- The search matches on type/query/mutation names (substring match)
|
|
20
|
+
|
|
21
|
+
Be sure to pass the code into the \`validate_graphql_codeblocks\` tool and make any necessary corrections that tool indicates are needed. This removes LLM hallucinations from GQL operations.`;
|
|
22
|
+
//# sourceMappingURL=admin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../src/prompts/admin.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;+LAoB+J,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type GraphQLSchema, type IntrospectionQuery } from "graphql";
|
|
2
|
+
interface SchemaCache {
|
|
3
|
+
raw: IntrospectionQuery;
|
|
4
|
+
schema: GraphQLSchema;
|
|
5
|
+
types: IntrospectionType[];
|
|
6
|
+
queries: IntrospectionField[];
|
|
7
|
+
mutations: IntrospectionField[];
|
|
8
|
+
}
|
|
9
|
+
export interface IntrospectionType {
|
|
10
|
+
name: string;
|
|
11
|
+
kind: string;
|
|
12
|
+
description?: string | null;
|
|
13
|
+
fields?: IntrospectionField[] | null;
|
|
14
|
+
inputFields?: IntrospectionInputField[] | null;
|
|
15
|
+
enumValues?: IntrospectionEnumValue[] | null;
|
|
16
|
+
interfaces?: IntrospectionTypeRef[] | null;
|
|
17
|
+
}
|
|
18
|
+
export interface IntrospectionField {
|
|
19
|
+
name: string;
|
|
20
|
+
description?: string | null;
|
|
21
|
+
args?: IntrospectionArg[];
|
|
22
|
+
type: IntrospectionTypeRef;
|
|
23
|
+
}
|
|
24
|
+
interface IntrospectionInputField {
|
|
25
|
+
name: string;
|
|
26
|
+
description?: string | null;
|
|
27
|
+
type: IntrospectionTypeRef;
|
|
28
|
+
defaultValue?: string | null;
|
|
29
|
+
}
|
|
30
|
+
interface IntrospectionEnumValue {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string | null;
|
|
33
|
+
}
|
|
34
|
+
interface IntrospectionArg {
|
|
35
|
+
name: string;
|
|
36
|
+
description?: string | null;
|
|
37
|
+
type: IntrospectionTypeRef;
|
|
38
|
+
defaultValue?: string | null;
|
|
39
|
+
}
|
|
40
|
+
interface IntrospectionTypeRef {
|
|
41
|
+
kind: string;
|
|
42
|
+
name?: string | null;
|
|
43
|
+
ofType?: IntrospectionTypeRef | null;
|
|
44
|
+
}
|
|
45
|
+
export declare function loadSchema(api: string): SchemaCache;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/schema/loader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,KAAK,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIzF,UAAU,WAAW;IACnB,GAAG,EAAE,kBAAkB,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC;IACrC,WAAW,CAAC,EAAE,uBAAuB,EAAE,GAAG,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,sBAAsB,EAAE,GAAG,IAAI,CAAC;IAC7C,UAAU,CAAC,EAAE,oBAAoB,EAAE,GAAG,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC1B,IAAI,EAAE,oBAAoB,CAAC;CAC5B;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,UAAU,oBAAoB;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACtC;AAQD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CA8BnD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { buildClientSchema } from "graphql";
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const cache = new Map();
|
|
7
|
+
function getSchemaPath(api) {
|
|
8
|
+
return join(__dirname, "..", "..", "data", `${api}.json`);
|
|
9
|
+
}
|
|
10
|
+
export function loadSchema(api) {
|
|
11
|
+
const existing = cache.get(api);
|
|
12
|
+
if (existing)
|
|
13
|
+
return existing;
|
|
14
|
+
const path = getSchemaPath(api);
|
|
15
|
+
const raw = JSON.parse(readFileSync(path, "utf-8"));
|
|
16
|
+
const introspection = raw.data;
|
|
17
|
+
const schema = buildClientSchema(introspection);
|
|
18
|
+
const schemaType = introspection.__schema;
|
|
19
|
+
const allTypes = schemaType.types.filter((t) => !t.name.startsWith("__"));
|
|
20
|
+
const queryTypeName = schemaType.queryType?.name ?? "Query";
|
|
21
|
+
const mutationTypeName = schemaType.mutationType?.name ?? "Mutation";
|
|
22
|
+
const queryType = allTypes.find((t) => t.name === queryTypeName);
|
|
23
|
+
const mutationType = allTypes.find((t) => t.name === mutationTypeName);
|
|
24
|
+
const result = {
|
|
25
|
+
raw: introspection,
|
|
26
|
+
schema,
|
|
27
|
+
types: allTypes.filter((t) => t.name !== queryTypeName && t.name !== mutationTypeName),
|
|
28
|
+
queries: queryType?.fields ?? [],
|
|
29
|
+
mutations: mutationType?.fields ?? [],
|
|
30
|
+
};
|
|
31
|
+
cache.set(api, result);
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/schema/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAA+C,MAAM,SAAS,CAAC;AAEzF,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAoD1D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAuB,CAAC;AAE7C,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;I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KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type FilterKind = "all" | "types" | "queries" | "mutations";
|
|
2
|
+
export interface IntrospectInput {
|
|
3
|
+
query: string;
|
|
4
|
+
filter?: FilterKind[];
|
|
5
|
+
conversationId: string;
|
|
6
|
+
api?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function introspectSchema(input: IntrospectInput): {
|
|
9
|
+
content: {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=introspect-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"introspect-schema.d.ts","sourceRoot":"","sources":["../../src/tools/introspect-schema.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAwGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe;;;;;EAuEtD"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { loadSchema } from "../schema/loader.js";
|
|
2
|
+
function resolveTypeRef(typeRef) {
|
|
3
|
+
if (typeRef.kind === "NON_NULL") {
|
|
4
|
+
return `${resolveTypeRef(typeRef.ofType)}!`;
|
|
5
|
+
}
|
|
6
|
+
if (typeRef.kind === "LIST") {
|
|
7
|
+
return `[${resolveTypeRef(typeRef.ofType)}]`;
|
|
8
|
+
}
|
|
9
|
+
return typeRef.name ?? "Unknown";
|
|
10
|
+
}
|
|
11
|
+
function formatField(field) {
|
|
12
|
+
const parts = [];
|
|
13
|
+
let signature = field.name;
|
|
14
|
+
if (field.args && field.args.length > 0) {
|
|
15
|
+
const argStr = field.args
|
|
16
|
+
.map((a) => {
|
|
17
|
+
let s = `${a.name}: ${resolveTypeRef(a.type)}`;
|
|
18
|
+
if (a.defaultValue != null)
|
|
19
|
+
s += ` = ${a.defaultValue}`;
|
|
20
|
+
return s;
|
|
21
|
+
})
|
|
22
|
+
.join(", ");
|
|
23
|
+
signature += `(${argStr})`;
|
|
24
|
+
}
|
|
25
|
+
signature += `: ${resolveTypeRef(field.type)}`;
|
|
26
|
+
parts.push(signature);
|
|
27
|
+
if (field.description) {
|
|
28
|
+
parts.push(` # ${field.description}`);
|
|
29
|
+
}
|
|
30
|
+
return parts.join("\n");
|
|
31
|
+
}
|
|
32
|
+
function formatType(type) {
|
|
33
|
+
const lines = [];
|
|
34
|
+
// Header with kind and name
|
|
35
|
+
let header = `${type.kind} ${type.name}`;
|
|
36
|
+
lines.push(header);
|
|
37
|
+
if (type.description) {
|
|
38
|
+
lines.push(` Description: ${type.description}`);
|
|
39
|
+
}
|
|
40
|
+
// Show implements (interfaces)
|
|
41
|
+
if (type.interfaces && type.interfaces.length > 0) {
|
|
42
|
+
const ifaceNames = type.interfaces.map((i) => i.name ?? resolveTypeRef(i)).filter(Boolean);
|
|
43
|
+
if (ifaceNames.length > 0) {
|
|
44
|
+
lines.push(` Implements: ${ifaceNames.join(", ")}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (type.fields && type.fields.length > 0) {
|
|
48
|
+
lines.push("");
|
|
49
|
+
lines.push(" Fields:");
|
|
50
|
+
lines.push("");
|
|
51
|
+
for (const f of type.fields.slice(0, 20)) {
|
|
52
|
+
lines.push(` ${formatField(f)}`);
|
|
53
|
+
lines.push("");
|
|
54
|
+
}
|
|
55
|
+
if (type.fields.length > 20) {
|
|
56
|
+
lines.push(` ... and ${type.fields.length - 20} more fields`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (type.inputFields && type.inputFields.length > 0) {
|
|
60
|
+
lines.push("");
|
|
61
|
+
lines.push(" Input Fields:");
|
|
62
|
+
lines.push("");
|
|
63
|
+
for (const f of type.inputFields.slice(0, 20)) {
|
|
64
|
+
lines.push(` ${f.name}: ${resolveTypeRef(f.type)}`);
|
|
65
|
+
if (f.description) {
|
|
66
|
+
lines.push(` # ${f.description}`);
|
|
67
|
+
}
|
|
68
|
+
lines.push("");
|
|
69
|
+
}
|
|
70
|
+
if (type.inputFields.length > 20) {
|
|
71
|
+
lines.push(` ... and ${type.inputFields.length - 20} more fields`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (type.enumValues && type.enumValues.length > 0) {
|
|
75
|
+
lines.push("");
|
|
76
|
+
for (const v of type.enumValues) {
|
|
77
|
+
lines.push(` ${v.name}${v.description ? ` — ${v.description}` : ""}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return lines.join("\n");
|
|
81
|
+
}
|
|
82
|
+
const RESULTS_LIMIT = 10;
|
|
83
|
+
export function introspectSchema(input) {
|
|
84
|
+
const api = input.api ?? "admin";
|
|
85
|
+
const filters = input.filter ?? ["all"];
|
|
86
|
+
const includeAll = filters.includes("all");
|
|
87
|
+
let schema;
|
|
88
|
+
try {
|
|
89
|
+
schema = loadSchema(api);
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
return {
|
|
93
|
+
content: [{ type: "text", text: `Failed to load schema for "${api}": ${e.message}` }],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
// Normalize query: trim, strip trailing 's', remove whitespace, lowercase
|
|
97
|
+
let normalized = input.query.trim().toLowerCase().replace(/\s+/g, "");
|
|
98
|
+
if (normalized.endsWith("s") && normalized.length > 1) {
|
|
99
|
+
normalized = normalized.slice(0, -1);
|
|
100
|
+
}
|
|
101
|
+
const sections = [];
|
|
102
|
+
if (includeAll || filters.includes("types")) {
|
|
103
|
+
const matched = schema.types
|
|
104
|
+
.filter((t) => t.name.toLowerCase().includes(normalized))
|
|
105
|
+
.sort((a, b) => a.name.length - b.name.length)
|
|
106
|
+
.slice(0, RESULTS_LIMIT);
|
|
107
|
+
if (matched.length > 0) {
|
|
108
|
+
sections.push(`## Matching GraphQL Types:\n(Results limited to ${RESULTS_LIMIT} items. Refine your search for more specific results.)\n\n` +
|
|
109
|
+
matched.map(formatType).join("\n\n"));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (includeAll || filters.includes("queries")) {
|
|
113
|
+
const matched = schema.queries
|
|
114
|
+
.filter((q) => q.name.toLowerCase().includes(normalized))
|
|
115
|
+
.sort((a, b) => a.name.length - b.name.length)
|
|
116
|
+
.slice(0, RESULTS_LIMIT);
|
|
117
|
+
if (matched.length > 0) {
|
|
118
|
+
sections.push(`## Matching GraphQL Queries:\n(Results limited to ${RESULTS_LIMIT} items. Refine your search for more specific results.)\n\n` +
|
|
119
|
+
matched.map((f) => formatField(f)).join("\n\n"));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (includeAll || filters.includes("mutations")) {
|
|
123
|
+
const matched = schema.mutations
|
|
124
|
+
.filter((m) => m.name.toLowerCase().includes(normalized))
|
|
125
|
+
.sort((a, b) => a.name.length - b.name.length)
|
|
126
|
+
.slice(0, RESULTS_LIMIT);
|
|
127
|
+
if (matched.length > 0) {
|
|
128
|
+
sections.push(`## Matching GraphQL Mutations:\n(Results limited to ${RESULTS_LIMIT} items. Refine your search for more specific results.)\n\n` +
|
|
129
|
+
matched.map((f) => formatField(f)).join("\n\n"));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
const text = sections.length > 0
|
|
133
|
+
? sections.join("\n\n")
|
|
134
|
+
: `No results found for "${input.query}" in the ${api} API schema. Try a broader search term.`;
|
|
135
|
+
return {
|
|
136
|
+
content: [{ type: "text", text }],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=introspect-sch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E,CAAC;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface LearnApiInput {
|
|
2
|
+
api: string;
|
|
3
|
+
conversationId?: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function learnCloudCartApi(input: LearnApiInput): {
|
|
7
|
+
content: {
|
|
8
|
+
type: "text";
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=learn-cloudcart-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learn-cloudcart-api.d.ts","sourceRoot":"","sources":["../../src/tools/learn-cloudcart-api.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa;;;;;EA8BrD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { ADMIN_API_PROMPT } from "../prompts/admin.js";
|
|
3
|
+
const PROMPTS = {
|
|
4
|
+
admin: ADMIN_API_PROMPT,
|
|
5
|
+
};
|
|
6
|
+
export function learnCloudCartApi(input) {
|
|
7
|
+
const api = input.api ?? "admin";
|
|
8
|
+
const conversationId = input.conversationId ?? randomUUID();
|
|
9
|
+
const prompt = PROMPTS[api];
|
|
10
|
+
if (!prompt) {
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
type: "text",
|
|
15
|
+
text: `Unknown API: "${api}". Available APIs: ${Object.keys(PROMPTS).join(", ")}`,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const text = `**IMPORTANT - SAVE THIS CONVERSATION ID:** ${conversationId}
|
|
21
|
+
**CRITICAL:** You MUST use this exact conversationId in ALL subsequent CloudCart tool calls in this conversation.
|
|
22
|
+
All other CloudCart tools WILL RETURN ERRORS if you don't provide this conversationId.
|
|
23
|
+
---
|
|
24
|
+
${prompt}`;
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
type: "text",
|
|
29
|
+
text,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=learn-cloudcart-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learn-cloudcart-api.js","sourceRoot":"","sources":["../../src/tools/learn-cloudcart-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,OAAO,GAA2B;IACtC,KAAK,EAAE,gBAAgB;CACxB,CAAC;AAQF,MAAM,UAAU,iBAAiB,CAAC,KAAoB;IACpD,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC;IACjC,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,IAAI,UAAU,EAAE,CAAC;IAE5D,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iBAAiB,GAAG,sBAAsB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;iBAClF;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,8CAA8C,cAAc;;;;EAIzE,MAAM,EAAE,CAAC;IAET,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI;aACL;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface Codeblock {
|
|
2
|
+
content: string;
|
|
3
|
+
artifactId?: string;
|
|
4
|
+
revision?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ValidateInput {
|
|
7
|
+
codeblocks: Codeblock[];
|
|
8
|
+
api?: string;
|
|
9
|
+
conversationId: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function validateGraphql(input: ValidateInput): {
|
|
12
|
+
content: {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=validate-graphql.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-graphql.d.ts","sourceRoot":"","sources":["../../src/tools/validate-graphql.ts"],"names":[],"mappings":"AAcA,UAAU,SAAS;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;CACxB;AAuDD,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa;;;;;EA0FnD"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { parse, validate, Kind, TypeInfo, visit, visitWithTypeInfo, } from "graphql";
|
|
3
|
+
import { loadSchema } from "../schema/loader.js";
|
|
4
|
+
function formatGraphQLError(error) {
|
|
5
|
+
return error.message;
|
|
6
|
+
}
|
|
7
|
+
function detectOperationType(document) {
|
|
8
|
+
for (const def of document.definitions) {
|
|
9
|
+
if (def.kind === Kind.OPERATION_DEFINITION) {
|
|
10
|
+
return def.operation; // "query", "mutation", "subscription"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return "query";
|
|
14
|
+
}
|
|
15
|
+
function findDeprecatedUsages(schema, document) {
|
|
16
|
+
const warnings = [];
|
|
17
|
+
const typeInfo = new TypeInfo(schema);
|
|
18
|
+
visit(document, visitWithTypeInfo(typeInfo, {
|
|
19
|
+
Field() {
|
|
20
|
+
const fieldDef = typeInfo.getFieldDef();
|
|
21
|
+
if (fieldDef && fieldDef.deprecationReason) {
|
|
22
|
+
warnings.push(`The field ${typeInfo.getParentType()?.name}.${fieldDef.name} is deprecated. ${fieldDef.deprecationReason}`);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
EnumValue(node) {
|
|
26
|
+
const enumValue = typeInfo.getEnumValue();
|
|
27
|
+
if (enumValue && enumValue.deprecationReason != null) {
|
|
28
|
+
warnings.push(`The enum value ${node.value} is deprecated. ${enumValue.deprecationReason ?? ""}`);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
}));
|
|
32
|
+
return warnings;
|
|
33
|
+
}
|
|
34
|
+
export function validateGraphql(input) {
|
|
35
|
+
const api = input.api ?? "admin";
|
|
36
|
+
let schema;
|
|
37
|
+
try {
|
|
38
|
+
schema = loadSchema(api);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
return {
|
|
42
|
+
content: [{ type: "text", text: `Failed to load schema for "${api}": ${e.message}` }],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const results = [];
|
|
46
|
+
for (let i = 0; i < input.codeblocks.length; i++) {
|
|
47
|
+
const block = input.codeblocks[i];
|
|
48
|
+
const artifactId = block.artifactId ?? `artifact-${randomUUID()}`;
|
|
49
|
+
const revision = block.revision ?? 1;
|
|
50
|
+
const result = {
|
|
51
|
+
artifactId,
|
|
52
|
+
revision,
|
|
53
|
+
status: "failed",
|
|
54
|
+
operationType: "query",
|
|
55
|
+
};
|
|
56
|
+
try {
|
|
57
|
+
const document = parse(block.content);
|
|
58
|
+
result.operationType = detectOperationType(document);
|
|
59
|
+
const errors = validate(schema.schema, document);
|
|
60
|
+
if (errors.length === 0) {
|
|
61
|
+
// Check for deprecated field/enum usage
|
|
62
|
+
const deprecationWarnings = findDeprecatedUsages(schema.schema, document);
|
|
63
|
+
if (deprecationWarnings.length > 0) {
|
|
64
|
+
result.status = "inform";
|
|
65
|
+
result.warnings = deprecationWarnings;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
result.status = "success";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
result.status = "failed";
|
|
73
|
+
result.errors = errors.map(formatGraphQLError);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
result.errors = [e.message];
|
|
78
|
+
}
|
|
79
|
+
results.push(result);
|
|
80
|
+
}
|
|
81
|
+
const allValid = results.every((r) => r.status !== "failed");
|
|
82
|
+
const overallStatus = allValid ? "VALID" : "INVALID";
|
|
83
|
+
const lines = [
|
|
84
|
+
`## Validation Summary\n`,
|
|
85
|
+
`**Overall Status:** ${allValid ? "✅" : "❌"} ${overallStatus}`,
|
|
86
|
+
`**Total Code Blocks:** ${results.length}\n`,
|
|
87
|
+
`## Detailed Results\n`,
|
|
88
|
+
];
|
|
89
|
+
for (let i = 0; i < results.length; i++) {
|
|
90
|
+
const r = results[i];
|
|
91
|
+
lines.push(`### Code Block ${i + 1}`);
|
|
92
|
+
lines.push(`**Artifact ID:** ${r.artifactId}`);
|
|
93
|
+
lines.push(`**Revision:** ${r.revision}`);
|
|
94
|
+
lines.push(`*Use same ID & increment revision when retrying on an improvement of this artifact*\n`);
|
|
95
|
+
if (r.status === "success") {
|
|
96
|
+
lines.push(`**Status:** ✅ SUCCESS`);
|
|
97
|
+
lines.push(`**Details:** Successfully validated GraphQL ${r.operationType} against schema.\n`);
|
|
98
|
+
}
|
|
99
|
+
else if (r.status === "inform") {
|
|
100
|
+
lines.push(`**Status:** ⚠️ INFORM`);
|
|
101
|
+
const warningText = r.warnings.map((w) => `Note: ${w}`).join(" ");
|
|
102
|
+
lines.push(`**Details:** Successfully validated GraphQL ${r.operationType} against schema. ${warningText}\n`);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
lines.push(`**Status:** ❌ FAILED`);
|
|
106
|
+
lines.push(`**Details:** GraphQL validation errors: ${r.errors.join("; ")}\n`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
type: "text",
|
|
113
|
+
text: lines.join("\n"),
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=validate-graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-graphql.js","sourceRoot":"","sources":["../../src/tools/validate-graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,iBAAiB,GAIlB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAyBjD,SAAS,kBAAkB,CAAC,KAAmB;IAC7C,OAAO,KAAK,CAAC,OAAO,CAAC;AACvB,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAsB;IACjD,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC3C,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,sCAAsC;QAC9D,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAqB,EAAE,QAAsB;IACzE,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM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C,CAAC;YACpC,MAAM,WAAW,GAAG,CAAC,CAAC,QAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnE,KAAK,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC,aAAa,oBAAoB,WAAW,IAAI,CAAC,CAAC;QAChH,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;YACnC,KAAK,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC,MAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClF,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;aACvB;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cloudcart/dev-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for CloudCart GraphQL APIs — helps AI assistants write correct queries and mutations",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"cloudcart-dev-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"generate-schema": "tsx scripts/generate-schema.ts",
|
|
14
|
+
"start": "node dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"data"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
22
|
+
"graphql": "^16.13.0",
|
|
23
|
+
"zod": "^3.24.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^22.0.0",
|
|
27
|
+
"tsx": "^4.19.0",
|
|
28
|
+
"typescript": "^5.7.0"
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
},
|
|
33
|
+
"license": "MIT"
|
|
34
|
+
}
|