encarapi-mcp 1.6.1 → 1.6.3
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 +9 -5
- package/package.json +1 -1
- package/src/server.js +52 -31
package/README.md
CHANGED
|
@@ -13,24 +13,28 @@
|
|
|
13
13
|
|
|
14
14
|
| Tool | What it does |
|
|
15
15
|
|---|---|
|
|
16
|
-
| `search_korean_cars` | Search Korean listings (brand, model, year, price in 10,000 KRW, mileage, fuel, accident-free, seller region and city, source: encar / kbc / kcar / all) |
|
|
16
|
+
| `search_korean_cars` | Search Korean listings (brand, model, year, price in 10,000 KRW, mileage, fuel, accident-free, seller region and city, source: encar / kbc / kcar / all; `lang`: en, ru or de for English, Russian or German values) |
|
|
17
17
|
| `search_korean_excavators` | Search Korean used excavators (maker, model, operating hours, weight class, region; Business/Scale key) |
|
|
18
18
|
| `search_korean_trucks` | Search Korean trucks, buses and special vehicles (body type, payload in tons, use, region; Business/Scale key) |
|
|
19
19
|
| `find_korean_car_by_vin` | All Encar / K Car listings of one VIN, incl. removed ones (Business/Scale key) |
|
|
20
20
|
| `get_korean_truck` | Full record for one truck: detail, inspection report, cargo box, VIN and plate (Business/Scale key) |
|
|
21
|
-
| `get_korean_car` | Full detail for one listing (specs, options, photos, price history, seller) |
|
|
21
|
+
| `get_korean_car` | Full detail for one listing (specs, options, photos, price history, seller; `lang`: en, ru or de) |
|
|
22
22
|
| `get_korean_inspection` | Official Korean inspection report |
|
|
23
23
|
| `get_korean_accident_record` | Insurance accident history and ownership changes |
|
|
24
24
|
| `find_korean_models` | Model name autocomplete across brands |
|
|
25
25
|
| `korean_filter_values` | Valid filter values |
|
|
26
|
-
| `search_chinese_cars` | Search Chinese listings (brand, model, model year, registration year, price in CNY, mileage, power, city, fuel, source, export-ready) |
|
|
27
|
-
| `get_chinese_car` | Full record for one Chinese listing |
|
|
28
|
-
| `get_chinese_car_by_url` | Full record by Che168/Dongchedi listing link (desktop, mobile or app) |
|
|
26
|
+
| `search_chinese_cars` | Search Chinese listings (brand, model, model year, registration year, price in CNY, mileage, power, city, fuel, source, export-ready; `lang`: en, zh or ru) |
|
|
27
|
+
| `get_chinese_car` | Full record for one Chinese listing (`lang`: en, zh or ru) |
|
|
28
|
+
| `get_chinese_car_by_url` | Full record by Che168/Dongchedi listing link (desktop, mobile or app; `lang`: en, zh or ru) |
|
|
29
29
|
| `get_chinese_inspection` | Chinese inspection report (accident, flood, fire, EV battery) |
|
|
30
30
|
| `get_chinese_specs` | Autohome specification sheet of a Che168 trim (cc, kW, hp, torque, emission standard, weights, EV battery) |
|
|
31
31
|
| `chinese_filter_values` | Valid makes, fuels, cities and sources with listing counts |
|
|
32
32
|
| `chinese_models` | Models of a brand with listing counts |
|
|
33
33
|
|
|
34
|
+
Chinese `lang`: `zh` returns the original Chinese values, `ru` Russian values for the fixed fields (fuel,
|
|
35
|
+
transmission, drivetrain, colours, seller type, condition, vehicle class), city names and equipment names;
|
|
36
|
+
make, model and trim names stay Latin.
|
|
37
|
+
|
|
34
38
|
All tools are read-only.
|
|
35
39
|
|
|
36
40
|
## Option 1: hosted (no install)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "encarapi-mcp",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "MCP server for EnCarAPI and ChinaCarAPI: live Korean (Encar, KB Chachacha, K Car) and Chinese (Dongchedi, Che168) used car listings for Claude, Cursor and other AI assistants.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/server.js",
|
package/src/server.js
CHANGED
|
@@ -4,7 +4,7 @@ import encarapi from "encarapi";
|
|
|
4
4
|
|
|
5
5
|
const { KoreaClient, ChinaClient } = encarapi;
|
|
6
6
|
|
|
7
|
-
export const VERSION = "1.6.
|
|
7
|
+
export const VERSION = "1.6.3";
|
|
8
8
|
const MAX_TEXT = 40000;
|
|
9
9
|
|
|
10
10
|
const asText = (data) => {
|
|
@@ -32,27 +32,32 @@ const firstPhoto = (photos) => {
|
|
|
32
32
|
return typeof p === "string" ? p : p.url || p.location || p.Url || undefined;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
// Compact, English-first view of a Korean catalog item for LLM context.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
// Compact, English-first view of a Korean catalog item for LLM context. With
|
|
36
|
+
// lang "ru" / "de" the API puts the Russian / German values into the main
|
|
37
|
+
// fields, so those win over the *English twins.
|
|
38
|
+
const koreaItem = (c, lang = "en") => {
|
|
39
|
+
const pick = (en, main) => (lang === "en" ? en || main : main ?? en);
|
|
40
|
+
return {
|
|
41
|
+
id: c.Id,
|
|
42
|
+
source: c.Source || "encar",
|
|
43
|
+
make: c.ManufacturerEnglish || c.Manufacturer,
|
|
44
|
+
model: pick(c.ModelEnglish, c.Model),
|
|
45
|
+
trim: pick(c.BadgeEnglish, c.Badge),
|
|
46
|
+
year: c.Year,
|
|
47
|
+
priceKRW: typeof c.Price === "number" ? c.Price * 10000 : undefined,
|
|
48
|
+
mileageKm: c.Mileage,
|
|
49
|
+
fuel: pick(c.FuelTypeEnglish, c.FuelType),
|
|
50
|
+
transmission: c.Transmission,
|
|
51
|
+
powerPs: c.PowerPs,
|
|
52
|
+
displacementCc: c.DisplacementCc,
|
|
53
|
+
color: c.Color,
|
|
54
|
+
region: c.Region || undefined,
|
|
55
|
+
city: c.City || undefined,
|
|
56
|
+
duplicateOf: c.IsDuplicate ? c.DuplicateOf : undefined,
|
|
57
|
+
url: c.Url,
|
|
58
|
+
photo: firstPhoto(c.Photos),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
56
61
|
|
|
57
62
|
const chinaItem = (c) => ({
|
|
58
63
|
id: c.id,
|
|
@@ -75,6 +80,17 @@ const chinaItem = (c) => ({
|
|
|
75
80
|
|
|
76
81
|
const readOnly = { readOnlyHint: true, openWorldHint: true };
|
|
77
82
|
|
|
83
|
+
// China response language. "ru" (API since 2026-10-22) translates the fixed fields,
|
|
84
|
+
// city names and equipment names; make, model and trim names stay Latin.
|
|
85
|
+
const chinaLang = z
|
|
86
|
+
.enum(["en", "zh", "ru"])
|
|
87
|
+
.optional()
|
|
88
|
+
.describe(
|
|
89
|
+
"Language of the returned values: en (default), zh = the original Chinese values, ru = Russian values for the fixed fields " +
|
|
90
|
+
"(fuel, transmission, drivetrain, colours, seller type, condition, vehicle class), city names and equipment names; " +
|
|
91
|
+
"make, model and trim names stay Latin"
|
|
92
|
+
);
|
|
93
|
+
|
|
78
94
|
const chinaSource = z
|
|
79
95
|
.enum(["dongchedi", "che168"])
|
|
80
96
|
.optional()
|
|
@@ -170,12 +186,14 @@ export function createServer({ apiKey, chinaKey, fetchImpl, transport = "stdio",
|
|
|
170
186
|
sort: z.enum(["newest", "price_asc", "price_desc", "mileage_asc", "mileage_desc", "year_desc", "year_asc"]).optional(),
|
|
171
187
|
limit: z.number().int().min(1).max(50).optional().describe("Results per page, default 10"),
|
|
172
188
|
page: z.number().int().min(1).optional(),
|
|
189
|
+
lang: z.enum(["en", "ru", "de"]).optional().describe("Language of the returned values (fuel, colors, regions, options; with 'de' also model and trim names): en (default), ru = Russian, de = German. Filters stay English"),
|
|
173
190
|
},
|
|
174
191
|
annotations: readOnly,
|
|
175
192
|
},
|
|
176
193
|
run(async (args) => {
|
|
177
|
-
const
|
|
178
|
-
|
|
194
|
+
const lang = args.lang || "en";
|
|
195
|
+
const res = await needKorea().catalog({ ...args, limit: args.limit || 10, lang, count: true });
|
|
196
|
+
return { total: res.Count, page: args.page || 1, results: (res.SearchResults || []).map((c) => koreaItem(c, lang)) };
|
|
179
197
|
})
|
|
180
198
|
);
|
|
181
199
|
|
|
@@ -291,10 +309,13 @@ export function createServer({ apiKey, chinaKey, fetchImpl, transport = "stdio",
|
|
|
291
309
|
{
|
|
292
310
|
title: "Get a Korean car",
|
|
293
311
|
description: "Full details for one Korean listing: specs, options, photos, price history, seller. Id: Encar id, 'kbc:<id>' or 'kcar:<id>'.",
|
|
294
|
-
inputSchema: {
|
|
312
|
+
inputSchema: {
|
|
313
|
+
id: z.string().describe("Listing id from search_korean_cars"),
|
|
314
|
+
lang: z.enum(["en", "ru", "de"]).optional().describe("Language of the spec, category and option names: en (default), ru = Russian, de = German"),
|
|
315
|
+
},
|
|
295
316
|
annotations: readOnly,
|
|
296
317
|
},
|
|
297
|
-
run(({ id }) => needKorea().vehicle(id, { lang: "en" }))
|
|
318
|
+
run(({ id, lang }) => needKorea().vehicle(id, { lang: lang || "en" }))
|
|
298
319
|
);
|
|
299
320
|
|
|
300
321
|
server.registerTool(
|
|
@@ -376,7 +397,7 @@ export function createServer({ apiKey, chinaKey, fetchImpl, transport = "stdio",
|
|
|
376
397
|
export_ready: z.boolean().optional().describe("Only cars that can be exported now"),
|
|
377
398
|
has_report: z.boolean().optional().describe("Only cars with an inspection report"),
|
|
378
399
|
sort: z.enum(["newest", "price_asc", "price_desc", "mileage_asc", "year_desc"]).optional(),
|
|
379
|
-
lang:
|
|
400
|
+
lang: chinaLang,
|
|
380
401
|
limit: z.number().int().min(1).max(50).optional().describe("Results per page, default 10"),
|
|
381
402
|
page: z.number().int().min(1).optional(),
|
|
382
403
|
},
|
|
@@ -393,10 +414,10 @@ export function createServer({ apiKey, chinaKey, fetchImpl, transport = "stdio",
|
|
|
393
414
|
{
|
|
394
415
|
title: "Get a Chinese car",
|
|
395
416
|
description: "Full record for one Chinese listing: price history, photos, seller, export status, same car on the other marketplace.",
|
|
396
|
-
inputSchema: { id: z.string().describe("Listing id from search_chinese_cars"), source: chinaSource },
|
|
417
|
+
inputSchema: { id: z.string().describe("Listing id from search_chinese_cars"), source: chinaSource, lang: chinaLang },
|
|
397
418
|
annotations: readOnly,
|
|
398
419
|
},
|
|
399
|
-
run(({ id, source }) => needChina().vehicle(id, { source }))
|
|
420
|
+
run(({ id, source, lang }) => needChina().vehicle(id, { source, lang }))
|
|
400
421
|
);
|
|
401
422
|
|
|
402
423
|
server.registerTool(
|
|
@@ -404,10 +425,10 @@ export function createServer({ apiKey, chinaKey, fetchImpl, transport = "stdio",
|
|
|
404
425
|
{
|
|
405
426
|
title: "Get a Chinese car by link",
|
|
406
427
|
description: "Same full record as get_chinese_car, looked up by a Che168 or Dongchedi listing link (desktop, mobile site or app, also inside a pasted share text). Short links are not resolved.",
|
|
407
|
-
inputSchema: { url: z.string().describe("Listing link, e.g. https://m.che168.com/cardetail/index?infoid=60234085") },
|
|
428
|
+
inputSchema: { url: z.string().describe("Listing link, e.g. https://m.che168.com/cardetail/index?infoid=60234085"), lang: chinaLang },
|
|
408
429
|
annotations: readOnly,
|
|
409
430
|
},
|
|
410
|
-
run(({ url }) => needChina().vehicleByUrl(url))
|
|
431
|
+
run(({ url, lang }) => needChina().vehicleByUrl(url, { lang }))
|
|
411
432
|
);
|
|
412
433
|
|
|
413
434
|
server.registerTool(
|