encarapi-mcp 1.6.0 → 1.6.2

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/package.json +1 -1
  3. package/src/server.js +36 -25
package/README.md CHANGED
@@ -13,12 +13,12 @@
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 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "encarapi-mcp",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
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.0";
7
+ export const VERSION = "1.6.2";
8
8
  const MAX_TEXT = 40000;
9
9
 
10
10
  const asText = (data) => {
@@ -32,26 +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
- const koreaItem = (c) => ({
37
- id: c.Id,
38
- source: c.Source || "encar",
39
- make: c.ManufacturerEnglish || c.Manufacturer,
40
- model: c.ModelEnglish || c.Model,
41
- trim: c.BadgeEnglish || c.Badge,
42
- year: c.Year,
43
- priceKRW: typeof c.Price === "number" ? c.Price * 10000 : undefined,
44
- mileageKm: c.Mileage,
45
- fuel: c.FuelTypeEnglish || c.FuelType,
46
- transmission: c.Transmission,
47
- powerPs: c.PowerPs,
48
- color: c.Color,
49
- region: c.Region || undefined,
50
- city: c.City || undefined,
51
- duplicateOf: c.IsDuplicate ? c.DuplicateOf : undefined,
52
- url: c.Url,
53
- photo: firstPhoto(c.Photos),
54
- });
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
+ };
55
61
 
56
62
  const chinaItem = (c) => ({
57
63
  id: c.id,
@@ -169,12 +175,14 @@ export function createServer({ apiKey, chinaKey, fetchImpl, transport = "stdio",
169
175
  sort: z.enum(["newest", "price_asc", "price_desc", "mileage_asc", "mileage_desc", "year_desc", "year_asc"]).optional(),
170
176
  limit: z.number().int().min(1).max(50).optional().describe("Results per page, default 10"),
171
177
  page: z.number().int().min(1).optional(),
178
+ 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"),
172
179
  },
173
180
  annotations: readOnly,
174
181
  },
175
182
  run(async (args) => {
176
- const res = await needKorea().catalog({ ...args, limit: args.limit || 10, lang: "en", count: true });
177
- return { total: res.Count, page: args.page || 1, results: (res.SearchResults || []).map(koreaItem) };
183
+ const lang = args.lang || "en";
184
+ const res = await needKorea().catalog({ ...args, limit: args.limit || 10, lang, count: true });
185
+ return { total: res.Count, page: args.page || 1, results: (res.SearchResults || []).map((c) => koreaItem(c, lang)) };
178
186
  })
179
187
  );
180
188
 
@@ -290,10 +298,13 @@ export function createServer({ apiKey, chinaKey, fetchImpl, transport = "stdio",
290
298
  {
291
299
  title: "Get a Korean car",
292
300
  description: "Full details for one Korean listing: specs, options, photos, price history, seller. Id: Encar id, 'kbc:<id>' or 'kcar:<id>'.",
293
- inputSchema: { id: z.string().describe("Listing id from search_korean_cars") },
301
+ inputSchema: {
302
+ id: z.string().describe("Listing id from search_korean_cars"),
303
+ lang: z.enum(["en", "ru", "de"]).optional().describe("Language of the spec, category and option names: en (default), ru = Russian, de = German"),
304
+ },
294
305
  annotations: readOnly,
295
306
  },
296
- run(({ id }) => needKorea().vehicle(id, { lang: "en" }))
307
+ run(({ id, lang }) => needKorea().vehicle(id, { lang: lang || "en" }))
297
308
  );
298
309
 
299
310
  server.registerTool(