pcbway-mcp-server 0.1.24 → 0.1.25
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/README.md +41 -25
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +15 -15
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -7
- package/dist/config.js.map +1 -1
- package/dist/index.js +276 -209
- package/dist/index.js.map +1 -1
- package/dist/resources/Account.d.ts +2 -2
- package/dist/resources/Account.d.ts.map +1 -1
- package/dist/resources/Account.js +4 -4
- package/dist/resources/Account.js.map +1 -1
- package/dist/resources/CancelOrder.d.ts +2 -2
- package/dist/resources/CancelOrder.js +5 -5
- package/dist/resources/CancelTGroupOrder.d.ts +2 -2
- package/dist/resources/CancelTGroupOrder.js +6 -6
- package/dist/resources/CheckGroupOrder.d.ts +2 -2
- package/dist/resources/CheckGroupOrder.d.ts.map +1 -1
- package/dist/resources/CheckGroupOrder.js +4 -4
- package/dist/resources/CheckGroupOrder.js.map +1 -1
- package/dist/resources/CheckTGroupOrder.d.ts +2 -2
- package/dist/resources/CheckTGroupOrder.d.ts.map +1 -1
- package/dist/resources/CheckTGroupOrder.js +4 -4
- package/dist/resources/CheckTGroupOrder.js.map +1 -1
- package/dist/resources/ConfirmOrder.d.ts +2 -2
- package/dist/resources/ConfirmOrder.d.ts.map +1 -1
- package/dist/resources/ConfirmOrder.js +30 -20
- package/dist/resources/ConfirmOrder.js.map +1 -1
- package/dist/resources/GetCities.d.ts +2 -2
- package/dist/resources/GetCities.d.ts.map +1 -1
- package/dist/resources/GetCities.js +6 -8
- package/dist/resources/GetCities.js.map +1 -1
- package/dist/resources/GetCountries.d.ts +2 -2
- package/dist/resources/GetCountries.d.ts.map +1 -1
- package/dist/resources/GetCountries.js +4 -4
- package/dist/resources/GetCountries.js.map +1 -1
- package/dist/resources/GetStates.d.ts +2 -2
- package/dist/resources/GetStates.d.ts.map +1 -1
- package/dist/resources/GetStates.js +4 -6
- package/dist/resources/GetStates.js.map +1 -1
- package/dist/resources/OrderDetails.d.ts +2 -2
- package/dist/resources/OrderDetails.js +15 -15
- package/dist/resources/OrderProcess.d.ts +2 -2
- package/dist/resources/OrderProcess.js +6 -6
- package/dist/resources/PayTGroupOrder.d.ts +2 -2
- package/dist/resources/PayTGroupOrder.js +7 -7
- package/dist/resources/PayTGroupOrder.js.map +1 -1
- package/dist/resources/PcbQuote.d.ts +2 -2
- package/dist/resources/PcbQuote.d.ts.map +1 -1
- package/dist/resources/PcbQuote.js +59 -41
- package/dist/resources/PcbQuote.js.map +1 -1
- package/dist/resources/PlaceOrder.d.ts +2 -2
- package/dist/resources/PlaceOrder.d.ts.map +1 -1
- package/dist/resources/PlaceOrder.js +38 -35
- package/dist/resources/PlaceOrder.js.map +1 -1
- package/dist/resources/Shipping.d.ts +2 -2
- package/dist/resources/Shipping.js +12 -12
- package/dist/resources/Shipping.js.map +1 -1
- package/dist/resources/SmtQuote.d.ts +2 -2
- package/dist/resources/SmtQuote.d.ts.map +1 -1
- package/dist/resources/SmtQuote.js +21 -22
- package/dist/resources/SmtQuote.js.map +1 -1
- package/dist/resources/common.js +16 -16
- package/dist/types.d.ts +16 -16
- package/package.json +17 -5
package/dist/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { readFileSync } from
|
|
3
|
-
import { Server } from
|
|
4
|
-
import { StdioServerTransport } from
|
|
5
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
6
|
+
import { PcbWayClient } from "./client.js";
|
|
7
|
+
import { loadConfig } from "./config.js";
|
|
8
|
+
import { Account } from "./resources/Account.js";
|
|
9
|
+
import { CancelOrder } from "./resources/CancelOrder.js";
|
|
10
|
+
import { CancelTGroupOrder } from "./resources/CancelTGroupOrder.js";
|
|
11
|
+
import { CheckGroupOrder } from "./resources/CheckGroupOrder.js";
|
|
12
|
+
import { CheckTGroupOrder } from "./resources/CheckTGroupOrder.js";
|
|
13
|
+
import { ConfirmOrder } from "./resources/ConfirmOrder.js";
|
|
14
|
+
import { GetCities } from "./resources/GetCities.js";
|
|
15
|
+
import { GetCountries } from "./resources/GetCountries.js";
|
|
16
|
+
import { GetStates } from "./resources/GetStates.js";
|
|
17
|
+
import { OrderDetails } from "./resources/OrderDetails.js";
|
|
18
|
+
import { OrderProcess } from "./resources/OrderProcess.js";
|
|
19
|
+
import { PayTGroupOrder } from "./resources/PayTGroupOrder.js";
|
|
20
|
+
import { PcbQuote } from "./resources/PcbQuote.js";
|
|
21
|
+
import { PlaceOrder } from "./resources/PlaceOrder.js";
|
|
22
|
+
import { Shipping } from "./resources/Shipping.js";
|
|
23
|
+
import { SmtQuote } from "./resources/SmtQuote.js";
|
|
24
24
|
// ── Help flag ──────────────────────────────────────────────────────
|
|
25
25
|
function printHelp() {
|
|
26
26
|
const help = `
|
|
@@ -109,7 +109,6 @@ SETUP
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
`;
|
|
112
|
-
// eslint-disable-next-line no-console
|
|
113
112
|
console.log(help);
|
|
114
113
|
}
|
|
115
114
|
// ── Tool definitions ───────────────────────────────────────────────
|
|
@@ -117,261 +116,329 @@ SETUP
|
|
|
117
116
|
// version actually published with the package instead of a stale constant.
|
|
118
117
|
const VERSION = (() => {
|
|
119
118
|
try {
|
|
120
|
-
const pkg = JSON.parse(readFileSync(new URL(
|
|
121
|
-
return pkg.version ??
|
|
119
|
+
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
120
|
+
return pkg.version ?? "0.0.0";
|
|
122
121
|
}
|
|
123
122
|
catch {
|
|
124
|
-
return
|
|
123
|
+
return "0.0.0";
|
|
125
124
|
}
|
|
126
125
|
})();
|
|
127
126
|
const tools = [
|
|
128
127
|
{
|
|
129
|
-
name:
|
|
130
|
-
description:
|
|
128
|
+
name: "pcb_quote",
|
|
129
|
+
description: "Get a PCB manufacturing price quote from PCBWay",
|
|
131
130
|
inputSchema: {
|
|
132
|
-
type:
|
|
131
|
+
type: "object",
|
|
133
132
|
properties: {
|
|
134
|
-
Country: { type:
|
|
135
|
-
CountryCode: { type:
|
|
136
|
-
ShipType: {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
133
|
+
Country: { type: "string", description: 'Country name (e.g. "UNITED STATES OF AMERICA")' },
|
|
134
|
+
CountryCode: { type: "string", description: 'Country code (e.g. "US")' },
|
|
135
|
+
ShipType: {
|
|
136
|
+
type: "number",
|
|
137
|
+
description: "Logistics company (1=DHL, 10=FedEx IP, 4=SF Express, etc.)",
|
|
138
|
+
},
|
|
139
|
+
Postalcode: { type: "string", description: "Postal code" },
|
|
140
|
+
City: { type: "string", description: "City" },
|
|
141
|
+
Length: { type: "number", description: "Board length in mm" },
|
|
142
|
+
Width: { type: "number", description: "Board width in mm" },
|
|
143
|
+
Qty: { type: "number", description: "Quantity (5-10000)" },
|
|
144
|
+
Layers: { type: "number", description: "Number of layers (1,2,4,6,8,10,12,14)" },
|
|
145
|
+
BoardType: {
|
|
146
|
+
type: "string",
|
|
147
|
+
description: 'Board type: "Single PCB" (default), "Panel PCB as design", "Panel PCB by Supplier"',
|
|
148
|
+
},
|
|
149
|
+
Material: {
|
|
150
|
+
type: "string",
|
|
151
|
+
description: "PCB material: FR-4 (default), Aluminum, Rogers, HDI, Copper",
|
|
152
|
+
},
|
|
153
|
+
FR4Tg: { type: "string", description: "FR4 Tg grade (default: TG150)" },
|
|
154
|
+
Thickness: { type: "number", description: "Board thickness in mm (default: 1.6)" },
|
|
155
|
+
MinTrackSpacing: { type: "string", description: 'Min track/space (default: "6/6mil")' },
|
|
156
|
+
MinHoleSize: { type: "number", description: "Min hole size in mm (default: 0.3)" },
|
|
157
|
+
SolderMask: { type: "string", description: 'Solder mask color (default: "Green")' },
|
|
158
|
+
Silkscreen: { type: "string", description: 'Silkscreen color (default: "White")' },
|
|
159
|
+
SurfaceFinish: {
|
|
160
|
+
type: "string",
|
|
161
|
+
description: 'Surface finish (default: "HASL with lead")',
|
|
162
|
+
},
|
|
163
|
+
ViaProcess: { type: "string", description: 'Via process (default: "Tenting vias")' },
|
|
164
|
+
FinishedCopper: { type: "string", description: 'Copper weight (default: "1 oz Cu")' },
|
|
165
|
+
Note: { type: "string", description: "Other special requests" },
|
|
155
166
|
},
|
|
156
|
-
required: [
|
|
167
|
+
required: [
|
|
168
|
+
"Country",
|
|
169
|
+
"CountryCode",
|
|
170
|
+
"ShipType",
|
|
171
|
+
"Postalcode",
|
|
172
|
+
"City",
|
|
173
|
+
"Length",
|
|
174
|
+
"Width",
|
|
175
|
+
"Qty",
|
|
176
|
+
"Layers",
|
|
177
|
+
],
|
|
157
178
|
},
|
|
158
179
|
},
|
|
159
180
|
{
|
|
160
|
-
name:
|
|
161
|
-
description:
|
|
181
|
+
name: "smt_quote",
|
|
182
|
+
description: "Get an SMT assembly price quote from PCBWay",
|
|
162
183
|
inputSchema: {
|
|
163
|
-
type:
|
|
184
|
+
type: "object",
|
|
164
185
|
properties: {
|
|
165
|
-
Country: { type:
|
|
166
|
-
CountryCode: { type:
|
|
167
|
-
ShipType: { type:
|
|
168
|
-
Postalcode: { type:
|
|
169
|
-
City: { type:
|
|
170
|
-
FlexibleOption: {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
Country: { type: "string", description: "Country name" },
|
|
187
|
+
CountryCode: { type: "string", description: 'Country code (e.g. "US")' },
|
|
188
|
+
ShipType: { type: "number", description: "Logistics company (1=DHL, 10=FedEx IP, etc.)" },
|
|
189
|
+
Postalcode: { type: "string", description: "Postal code" },
|
|
190
|
+
City: { type: "string", description: "City" },
|
|
191
|
+
FlexibleOption: {
|
|
192
|
+
type: "string",
|
|
193
|
+
enum: ["Turnkey", "Kitted or Consigned", "Combo"],
|
|
194
|
+
description: "Assembly flexible option",
|
|
195
|
+
},
|
|
196
|
+
BoardType: {
|
|
197
|
+
type: "string",
|
|
198
|
+
enum: ["Single pieces", "Panelized PCBs"],
|
|
199
|
+
description: "Board type",
|
|
200
|
+
},
|
|
201
|
+
AssemblySide: {
|
|
202
|
+
type: "string",
|
|
203
|
+
enum: ["Top side", "Bottom side", "Both sides"],
|
|
204
|
+
description: "Assembly side",
|
|
205
|
+
},
|
|
206
|
+
Qty: { type: "number", description: "Quantity to assemble" },
|
|
207
|
+
UniqueParts: { type: "number", description: "Number of unique parts (default: 0)" },
|
|
208
|
+
SMTParts: { type: "number", description: "Number of SMT parts (default: 0)" },
|
|
209
|
+
HoleParts: { type: "number", description: "Number of through-hole parts (default: 0)" },
|
|
177
210
|
},
|
|
178
|
-
required: [
|
|
211
|
+
required: [
|
|
212
|
+
"Country",
|
|
213
|
+
"CountryCode",
|
|
214
|
+
"ShipType",
|
|
215
|
+
"Postalcode",
|
|
216
|
+
"City",
|
|
217
|
+
"FlexibleOption",
|
|
218
|
+
"BoardType",
|
|
219
|
+
"AssemblySide",
|
|
220
|
+
"Qty",
|
|
221
|
+
],
|
|
179
222
|
},
|
|
180
223
|
},
|
|
181
224
|
{
|
|
182
|
-
name:
|
|
183
|
-
description:
|
|
225
|
+
name: "order_process",
|
|
226
|
+
description: "Get fabrication status and completed process steps for a PCBWay order",
|
|
184
227
|
inputSchema: {
|
|
185
|
-
type:
|
|
228
|
+
type: "object",
|
|
186
229
|
properties: {
|
|
187
|
-
OrderNo: { type:
|
|
230
|
+
OrderNo: { type: "string", description: 'PCBWay order number (e.g. "W0002AS1")' },
|
|
188
231
|
},
|
|
189
|
-
required: [
|
|
232
|
+
required: ["OrderNo"],
|
|
190
233
|
},
|
|
191
234
|
},
|
|
192
235
|
{
|
|
193
|
-
name:
|
|
194
|
-
description:
|
|
236
|
+
name: "order_details",
|
|
237
|
+
description: "Get full order details including all PCB parameters",
|
|
195
238
|
inputSchema: {
|
|
196
|
-
type:
|
|
239
|
+
type: "object",
|
|
197
240
|
properties: {
|
|
198
|
-
OrderNo: { type:
|
|
241
|
+
OrderNo: { type: "string", description: 'PCBWay order number (e.g. "W0002AS1")' },
|
|
199
242
|
},
|
|
200
|
-
required: [
|
|
243
|
+
required: ["OrderNo"],
|
|
201
244
|
},
|
|
202
245
|
},
|
|
203
246
|
{
|
|
204
|
-
name:
|
|
205
|
-
description:
|
|
247
|
+
name: "shipping_freight",
|
|
248
|
+
description: "Get shipping cost quote for an order (call before payment)",
|
|
206
249
|
inputSchema: {
|
|
207
|
-
type:
|
|
250
|
+
type: "object",
|
|
208
251
|
properties: {
|
|
209
|
-
OrderNo: {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
252
|
+
OrderNo: {
|
|
253
|
+
type: "string",
|
|
254
|
+
description: "PCBWay order number (or comma-separated for multiple)",
|
|
255
|
+
},
|
|
256
|
+
ShipType: { type: "number", description: "Logistics company (1=DHL, 10=FedEx IP, etc.)" },
|
|
257
|
+
Country: { type: "string", description: "Country name" },
|
|
258
|
+
CountryCode: { type: "string", description: 'Country code (e.g. "US")' },
|
|
259
|
+
Postalcode: { type: "string", description: "Postal code" },
|
|
260
|
+
City: { type: "string", description: "City" },
|
|
261
|
+
State: { type: "string", description: "State/Province/Region (optional)" },
|
|
262
|
+
AddGroupNo: {
|
|
263
|
+
type: "string",
|
|
264
|
+
description: "Order package number when adding to package (optional)",
|
|
265
|
+
},
|
|
217
266
|
},
|
|
218
|
-
required: [
|
|
267
|
+
required: ["OrderNo", "ShipType", "Country", "CountryCode", "Postalcode", "City"],
|
|
219
268
|
},
|
|
220
269
|
},
|
|
221
270
|
{
|
|
222
|
-
name:
|
|
223
|
-
description:
|
|
271
|
+
name: "account_balance",
|
|
272
|
+
description: "Query PCBWay account balance, coupon value, and reward points",
|
|
224
273
|
inputSchema: {
|
|
225
|
-
type:
|
|
274
|
+
type: "object",
|
|
226
275
|
properties: {},
|
|
227
276
|
required: [],
|
|
228
277
|
},
|
|
229
278
|
},
|
|
230
279
|
{
|
|
231
|
-
name:
|
|
232
|
-
description:
|
|
280
|
+
name: "place_order",
|
|
281
|
+
description: "Add a PCB order to cart",
|
|
233
282
|
inputSchema: {
|
|
234
|
-
type:
|
|
283
|
+
type: "object",
|
|
235
284
|
properties: {
|
|
236
|
-
PcbFileName: { type:
|
|
237
|
-
BuildDays: { type:
|
|
238
|
-
Length: { type:
|
|
239
|
-
Width: { type:
|
|
240
|
-
Qty: { type:
|
|
241
|
-
Layers: { type:
|
|
242
|
-
BoardType: { type:
|
|
243
|
-
Material: { type:
|
|
244
|
-
Thickness: { type:
|
|
245
|
-
SolderMask: { type:
|
|
246
|
-
Silkscreen: { type:
|
|
247
|
-
SurfaceFinish: {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
285
|
+
PcbFileName: { type: "string", description: "PCB file name" },
|
|
286
|
+
BuildDays: { type: "number", description: "Production cycle in days (from quote)" },
|
|
287
|
+
Length: { type: "number", description: "Board length in mm" },
|
|
288
|
+
Width: { type: "number", description: "Board width in mm" },
|
|
289
|
+
Qty: { type: "number", description: "Quantity" },
|
|
290
|
+
Layers: { type: "number", description: "Number of layers" },
|
|
291
|
+
BoardType: { type: "string", description: 'Board type (default: "Single PCB")' },
|
|
292
|
+
Material: { type: "string", description: 'PCB material (default: "FR-4")' },
|
|
293
|
+
Thickness: { type: "number", description: "Board thickness in mm (default: 1.6)" },
|
|
294
|
+
SolderMask: { type: "string", description: 'Solder mask color (default: "Green")' },
|
|
295
|
+
Silkscreen: { type: "string", description: 'Silkscreen color (default: "White")' },
|
|
296
|
+
SurfaceFinish: {
|
|
297
|
+
type: "string",
|
|
298
|
+
description: 'Surface finish (default: "HASL with lead")',
|
|
299
|
+
},
|
|
300
|
+
PcbFileUrl: { type: "string", description: "URL to PCB file (optional)" },
|
|
301
|
+
Note: { type: "string", description: "Order notes (optional)" },
|
|
302
|
+
BuyerEmail: { type: "string", description: "Buyer email for contact (optional)" },
|
|
251
303
|
},
|
|
252
|
-
required: [
|
|
304
|
+
required: ["PcbFileName", "BuildDays", "Length", "Width", "Qty", "Layers"],
|
|
253
305
|
},
|
|
254
306
|
},
|
|
255
307
|
{
|
|
256
|
-
name:
|
|
257
|
-
description:
|
|
308
|
+
name: "confirm_order",
|
|
309
|
+
description: "Confirm orders and make payment on PCBWay",
|
|
258
310
|
inputSchema: {
|
|
259
|
-
type:
|
|
311
|
+
type: "object",
|
|
260
312
|
properties: {
|
|
261
|
-
OrderNo: { type:
|
|
262
|
-
PayType: { type:
|
|
263
|
-
AddGroupNo: {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
313
|
+
OrderNo: { type: "string", description: "Order number(s) — comma-separated for multiple" },
|
|
314
|
+
PayType: { type: "number", description: "Payment method (1=AccountPay, 2=PCBWayWebPay)" },
|
|
315
|
+
AddGroupNo: {
|
|
316
|
+
type: "string",
|
|
317
|
+
description: "Order package number when adding to package (optional)",
|
|
318
|
+
},
|
|
319
|
+
ShipType: {
|
|
320
|
+
type: "number",
|
|
321
|
+
description: "Logistics company (required unless adding to package)",
|
|
322
|
+
},
|
|
323
|
+
Country: {
|
|
324
|
+
type: "string",
|
|
325
|
+
description: "Country name (required unless adding to package)",
|
|
326
|
+
},
|
|
327
|
+
CountryCode: {
|
|
328
|
+
type: "string",
|
|
329
|
+
description: "Country code (required unless adding to package)",
|
|
330
|
+
},
|
|
331
|
+
State: { type: "string", description: "State/Province (optional)" },
|
|
332
|
+
Postalcode: { type: "string", description: "Postal code (optional)" },
|
|
333
|
+
City: { type: "string", description: "City (required unless adding to package)" },
|
|
334
|
+
Addr: {
|
|
335
|
+
type: "string",
|
|
336
|
+
description: "Delivery address (required unless adding to package)",
|
|
337
|
+
},
|
|
338
|
+
CompanyName: { type: "string", description: "Company name (optional)" },
|
|
339
|
+
ContactName: { type: "string", description: "Contact person (optional)" },
|
|
340
|
+
Tel: { type: "string", description: "Phone number (required unless adding to package)" },
|
|
341
|
+
BuyerEmail: { type: "string", description: "Buyer email for contact (optional)" },
|
|
342
|
+
Tax: { type: "string", description: "Tax ID (optional)" },
|
|
276
343
|
},
|
|
277
|
-
required: [
|
|
344
|
+
required: ["OrderNo", "PayType"],
|
|
278
345
|
},
|
|
279
346
|
},
|
|
280
347
|
{
|
|
281
|
-
name:
|
|
282
|
-
description:
|
|
348
|
+
name: "cancel_order",
|
|
349
|
+
description: "Cancel an existing PCBWay order",
|
|
283
350
|
inputSchema: {
|
|
284
|
-
type:
|
|
351
|
+
type: "object",
|
|
285
352
|
properties: {
|
|
286
|
-
OrderNo: { type:
|
|
353
|
+
OrderNo: { type: "string", description: "PCBWay order number to cancel" },
|
|
287
354
|
},
|
|
288
|
-
required: [
|
|
355
|
+
required: ["OrderNo"],
|
|
289
356
|
},
|
|
290
357
|
},
|
|
291
358
|
{
|
|
292
|
-
name:
|
|
293
|
-
description:
|
|
359
|
+
name: "check_tgroup_order",
|
|
360
|
+
description: "Check awaiting-payment order package details on PCBWay",
|
|
294
361
|
inputSchema: {
|
|
295
|
-
type:
|
|
362
|
+
type: "object",
|
|
296
363
|
properties: {
|
|
297
|
-
TGroupNo: { type:
|
|
364
|
+
TGroupNo: { type: "string", description: "Awaiting-payment order package number" },
|
|
298
365
|
},
|
|
299
|
-
required: [
|
|
366
|
+
required: ["TGroupNo"],
|
|
300
367
|
},
|
|
301
368
|
},
|
|
302
369
|
{
|
|
303
|
-
name:
|
|
304
|
-
description:
|
|
370
|
+
name: "pay_tgroup_order",
|
|
371
|
+
description: "Pay for an awaiting-payment order package on PCBWay",
|
|
305
372
|
inputSchema: {
|
|
306
|
-
type:
|
|
373
|
+
type: "object",
|
|
307
374
|
properties: {
|
|
308
|
-
TGroupNo: { type:
|
|
309
|
-
PayType: { type:
|
|
375
|
+
TGroupNo: { type: "string", description: "Awaiting-payment order package number" },
|
|
376
|
+
PayType: { type: "number", description: "Payment method (1=AccountPay, 2=PCBWayWebPay)" },
|
|
310
377
|
},
|
|
311
|
-
required: [
|
|
378
|
+
required: ["TGroupNo", "PayType"],
|
|
312
379
|
},
|
|
313
380
|
},
|
|
314
381
|
{
|
|
315
|
-
name:
|
|
316
|
-
description:
|
|
382
|
+
name: "cancel_tgroup_order",
|
|
383
|
+
description: "Cancel an awaiting-payment order package on PCBWay",
|
|
317
384
|
inputSchema: {
|
|
318
|
-
type:
|
|
385
|
+
type: "object",
|
|
319
386
|
properties: {
|
|
320
|
-
TGroupNo: { type:
|
|
387
|
+
TGroupNo: { type: "string", description: "Awaiting-payment order package number" },
|
|
321
388
|
},
|
|
322
|
-
required: [
|
|
389
|
+
required: ["TGroupNo"],
|
|
323
390
|
},
|
|
324
391
|
},
|
|
325
392
|
{
|
|
326
|
-
name:
|
|
327
|
-
description:
|
|
393
|
+
name: "check_group_order",
|
|
394
|
+
description: "Check a confirmed order package details on PCBWay",
|
|
328
395
|
inputSchema: {
|
|
329
|
-
type:
|
|
396
|
+
type: "object",
|
|
330
397
|
properties: {
|
|
331
|
-
GroupNo: { type:
|
|
398
|
+
GroupNo: { type: "string", description: "Order package number" },
|
|
332
399
|
},
|
|
333
|
-
required: [
|
|
400
|
+
required: ["GroupNo"],
|
|
334
401
|
},
|
|
335
402
|
},
|
|
336
403
|
{
|
|
337
|
-
name:
|
|
338
|
-
description:
|
|
404
|
+
name: "get_countries",
|
|
405
|
+
description: "List all supported countries for PCBWay ordering",
|
|
339
406
|
inputSchema: {
|
|
340
|
-
type:
|
|
407
|
+
type: "object",
|
|
341
408
|
properties: {},
|
|
342
409
|
required: [],
|
|
343
410
|
},
|
|
344
411
|
},
|
|
345
412
|
{
|
|
346
|
-
name:
|
|
347
|
-
description:
|
|
413
|
+
name: "get_states",
|
|
414
|
+
description: "List states/provinces for a country",
|
|
348
415
|
inputSchema: {
|
|
349
|
-
type:
|
|
416
|
+
type: "object",
|
|
350
417
|
properties: {
|
|
351
|
-
Country: { type:
|
|
352
|
-
CountryCode: { type:
|
|
418
|
+
Country: { type: "string", description: 'Country name (e.g. "UNITED STATES OF AMERICA")' },
|
|
419
|
+
CountryCode: { type: "string", description: 'Country code (e.g. "US")' },
|
|
353
420
|
},
|
|
354
|
-
required: [
|
|
421
|
+
required: ["Country", "CountryCode"],
|
|
355
422
|
},
|
|
356
423
|
},
|
|
357
424
|
{
|
|
358
|
-
name:
|
|
359
|
-
description:
|
|
425
|
+
name: "get_cities",
|
|
426
|
+
description: "List cities for a country and state",
|
|
360
427
|
inputSchema: {
|
|
361
|
-
type:
|
|
428
|
+
type: "object",
|
|
362
429
|
properties: {
|
|
363
|
-
Country: { type:
|
|
364
|
-
CountryCode: { type:
|
|
365
|
-
State: { type:
|
|
430
|
+
Country: { type: "string", description: 'Country name (e.g. "UNITED STATES OF AMERICA")' },
|
|
431
|
+
CountryCode: { type: "string", description: 'Country code (e.g. "US")' },
|
|
432
|
+
State: { type: "string", description: "State/Province to filter by (optional)" },
|
|
366
433
|
},
|
|
367
|
-
required: [
|
|
434
|
+
required: ["Country", "CountryCode"],
|
|
368
435
|
},
|
|
369
436
|
},
|
|
370
437
|
];
|
|
371
438
|
// ── Server bootstrap ───────────────────────────────────────────────
|
|
372
439
|
async function main() {
|
|
373
440
|
// Handle --help before anything else
|
|
374
|
-
if (process.argv.includes(
|
|
441
|
+
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
375
442
|
printHelp();
|
|
376
443
|
process.exit(0);
|
|
377
444
|
}
|
|
@@ -402,7 +469,7 @@ async function main() {
|
|
|
402
469
|
const getStates = new GetStates(client);
|
|
403
470
|
const getCities = new GetCities(client);
|
|
404
471
|
const server = new Server({
|
|
405
|
-
name:
|
|
472
|
+
name: "pcbway-mcp-server",
|
|
406
473
|
version: VERSION,
|
|
407
474
|
}, {
|
|
408
475
|
capabilities: {
|
|
@@ -416,89 +483,89 @@ async function main() {
|
|
|
416
483
|
const { name, arguments: args } = request.params;
|
|
417
484
|
try {
|
|
418
485
|
switch (name) {
|
|
419
|
-
case
|
|
486
|
+
case "pcb_quote": {
|
|
420
487
|
const parsed = PcbQuote.inputSchema.parse(args);
|
|
421
488
|
const text = await pcbQuote.getQuote(parsed);
|
|
422
|
-
return { content: [{ type:
|
|
489
|
+
return { content: [{ type: "text", text }] };
|
|
423
490
|
}
|
|
424
|
-
case
|
|
491
|
+
case "smt_quote": {
|
|
425
492
|
const parsed = SmtQuote.inputSchema.parse(args);
|
|
426
493
|
const text = await smtQuote.getQuote(parsed);
|
|
427
|
-
return { content: [{ type:
|
|
494
|
+
return { content: [{ type: "text", text }] };
|
|
428
495
|
}
|
|
429
|
-
case
|
|
496
|
+
case "order_process": {
|
|
430
497
|
const parsed = OrderProcess.inputSchema.parse(args);
|
|
431
498
|
const text = await orderProcess.getStatus(parsed);
|
|
432
|
-
return { content: [{ type:
|
|
499
|
+
return { content: [{ type: "text", text }] };
|
|
433
500
|
}
|
|
434
|
-
case
|
|
501
|
+
case "order_details": {
|
|
435
502
|
const parsed = OrderDetails.inputSchema.parse(args);
|
|
436
503
|
const text = await orderDetails.getDetails(parsed);
|
|
437
|
-
return { content: [{ type:
|
|
504
|
+
return { content: [{ type: "text", text }] };
|
|
438
505
|
}
|
|
439
|
-
case
|
|
506
|
+
case "shipping_freight": {
|
|
440
507
|
const parsed = Shipping.inputSchema.parse(args);
|
|
441
508
|
const text = await shipping.getFreight(parsed);
|
|
442
|
-
return { content: [{ type:
|
|
509
|
+
return { content: [{ type: "text", text }] };
|
|
443
510
|
}
|
|
444
|
-
case
|
|
511
|
+
case "account_balance": {
|
|
445
512
|
const parsed = Account.inputSchema.parse(args ?? {});
|
|
446
513
|
const text = await account.getBalance(parsed);
|
|
447
|
-
return { content: [{ type:
|
|
514
|
+
return { content: [{ type: "text", text }] };
|
|
448
515
|
}
|
|
449
|
-
case
|
|
516
|
+
case "place_order": {
|
|
450
517
|
const parsed = PlaceOrder.inputSchema.parse(args);
|
|
451
518
|
const text = await placeOrder.place(parsed);
|
|
452
|
-
return { content: [{ type:
|
|
519
|
+
return { content: [{ type: "text", text }] };
|
|
453
520
|
}
|
|
454
|
-
case
|
|
521
|
+
case "confirm_order": {
|
|
455
522
|
const parsed = ConfirmOrder.inputSchema.parse(args);
|
|
456
523
|
const text = await confirmOrder.confirm(parsed);
|
|
457
|
-
return { content: [{ type:
|
|
524
|
+
return { content: [{ type: "text", text }] };
|
|
458
525
|
}
|
|
459
|
-
case
|
|
526
|
+
case "cancel_order": {
|
|
460
527
|
const parsed = CancelOrder.inputSchema.parse(args);
|
|
461
528
|
const text = await cancelOrder.cancel(parsed);
|
|
462
|
-
return { content: [{ type:
|
|
529
|
+
return { content: [{ type: "text", text }] };
|
|
463
530
|
}
|
|
464
|
-
case
|
|
531
|
+
case "check_tgroup_order": {
|
|
465
532
|
const parsed = CheckTGroupOrder.inputSchema.parse(args);
|
|
466
533
|
const text = await checkTGroupOrder.check(parsed);
|
|
467
|
-
return { content: [{ type:
|
|
534
|
+
return { content: [{ type: "text", text }] };
|
|
468
535
|
}
|
|
469
|
-
case
|
|
536
|
+
case "pay_tgroup_order": {
|
|
470
537
|
const parsed = PayTGroupOrder.inputSchema.parse(args);
|
|
471
538
|
const text = await payTGroupOrder.pay(parsed);
|
|
472
|
-
return { content: [{ type:
|
|
539
|
+
return { content: [{ type: "text", text }] };
|
|
473
540
|
}
|
|
474
|
-
case
|
|
541
|
+
case "cancel_tgroup_order": {
|
|
475
542
|
const parsed = CancelTGroupOrder.inputSchema.parse(args);
|
|
476
543
|
const text = await cancelTGroupOrder.cancel(parsed);
|
|
477
|
-
return { content: [{ type:
|
|
544
|
+
return { content: [{ type: "text", text }] };
|
|
478
545
|
}
|
|
479
|
-
case
|
|
546
|
+
case "check_group_order": {
|
|
480
547
|
const parsed = CheckGroupOrder.inputSchema.parse(args);
|
|
481
548
|
const text = await checkGroupOrder.check(parsed);
|
|
482
|
-
return { content: [{ type:
|
|
549
|
+
return { content: [{ type: "text", text }] };
|
|
483
550
|
}
|
|
484
|
-
case
|
|
551
|
+
case "get_countries": {
|
|
485
552
|
const parsed = GetCountries.inputSchema.parse(args ?? {});
|
|
486
553
|
const text = await getCountries.get(parsed);
|
|
487
|
-
return { content: [{ type:
|
|
554
|
+
return { content: [{ type: "text", text }] };
|
|
488
555
|
}
|
|
489
|
-
case
|
|
556
|
+
case "get_states": {
|
|
490
557
|
const parsed = GetStates.inputSchema.parse(args);
|
|
491
558
|
const text = await getStates.get(parsed);
|
|
492
|
-
return { content: [{ type:
|
|
559
|
+
return { content: [{ type: "text", text }] };
|
|
493
560
|
}
|
|
494
|
-
case
|
|
561
|
+
case "get_cities": {
|
|
495
562
|
const parsed = GetCities.inputSchema.parse(args);
|
|
496
563
|
const text = await getCities.get(parsed);
|
|
497
|
-
return { content: [{ type:
|
|
564
|
+
return { content: [{ type: "text", text }] };
|
|
498
565
|
}
|
|
499
566
|
default:
|
|
500
567
|
return {
|
|
501
|
-
content: [{ type:
|
|
568
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
502
569
|
isError: true,
|
|
503
570
|
};
|
|
504
571
|
}
|
|
@@ -506,7 +573,7 @@ async function main() {
|
|
|
506
573
|
catch (err) {
|
|
507
574
|
const message = err instanceof Error ? err.message : String(err);
|
|
508
575
|
return {
|
|
509
|
-
content: [{ type:
|
|
576
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
510
577
|
isError: true,
|
|
511
578
|
};
|
|
512
579
|
}
|
|
@@ -515,7 +582,7 @@ async function main() {
|
|
|
515
582
|
await server.connect(transport);
|
|
516
583
|
}
|
|
517
584
|
main().catch((err) => {
|
|
518
|
-
console.error(
|
|
585
|
+
console.error("Fatal error:", err);
|
|
519
586
|
process.exit(1);
|
|
520
587
|
});
|
|
521
588
|
//# sourceMappingURL=index.js.map
|