taiwan-data-mcp 0.6.0 → 0.7.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/README.md CHANGED
@@ -12,7 +12,7 @@
12
12
  | `taiwan_company_search` | 用公司名搜尋,拿統一編號與負責人 | [inc.com.tw](https://inc.com.tw)(經濟部公司登記) |
13
13
  | `taiwan_company_profile` | 用統編查公司完整登記資料(含董監事) | inc.com.tw |
14
14
  | `taiwan_person_companies` | 用人名查他擔任負責人/董監事的公司 | inc.com.tw |
15
- | `taiwan_company_risk` | 公司風險查核:拒絕往來/勞動/環保裁罰紅旗 | inc.com.tw |
15
+ | `taiwan_company_risk` | 公司風險查核(統編或公司名):解散/拒絕往來/國際制裁/金管會/司法/勞動/環保紅旗+上市櫃即時股價 | inc.com.tw |
16
16
  | `taiwan_realprice_search` | 搜尋實價登錄的地址 / 路段 / 行政區 | [housetw.com](https://housetw.com)(內政部實價登錄) |
17
17
  | `taiwan_realprice_locate` | 用經緯度反查行政區與行情頁 | housetw.com |
18
18
  | `taiwan_realprice_area` | 查某縣市 / 行政區成交行情統計 | housetw.com |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taiwan-data-mcp",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "MCP server for Taiwan public data — 實價登錄、公司登記查核、165 防詐、藥品查詢、政府標案、農產行情。Query real Taiwan data from Claude, Cursor, etc.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/server.mjs CHANGED
@@ -58,13 +58,15 @@ const TOOLS = [
58
58
  {
59
59
  name: 'taiwan_company_risk',
60
60
  description:
61
- '公司風險查核(盡職調查紅旗):用 8 位統編查該公司有無政府採購拒絕往來、勞動法令裁罰、環保裁罰,回傳風險等級與紅旗清單。資料來源:inc.com.tw(聚合政府公開資料)。',
61
+ '公司風險查核(盡職調查紅旗):用 8 位統編或公司名稱(簡稱如「台積電」自動解析成正主)查該公司有無解散、政府採購拒絕往來、國際制裁名單(OFAC/UN)、金管會重大裁罰、司法案件、勞動法令裁罰、環保裁罰,回傳風險等級、紅旗清單與負責人,上市櫃並附即時股價。資料來源:inc.com.tw(聚合政府公開資料)。',
62
62
  inputSchema: {
63
63
  type: 'object',
64
- properties: { unified_business_no: { type: 'string', description: '8 位統一編號,例如 22099131' } },
65
- required: ['unified_business_no'],
64
+ properties: {
65
+ unified_business_no: { type: 'string', description: '8 位統一編號(與 name 二擇一),例如 22099131' },
66
+ name: { type: 'string', description: '公司名稱或簡稱(與統編二擇一),例如「台積電」「鴻海」' },
67
+ },
66
68
  },
67
- run: (a) => companyRisk(a.unified_business_no),
69
+ run: (a) => companyRisk(a.unified_business_no || a.name),
68
70
  },
69
71
  {
70
72
  name: 'taiwan_realprice_search',
@@ -201,7 +203,7 @@ const TOOLS = [
201
203
  ];
202
204
 
203
205
  const server = new Server(
204
- { name: 'taiwan-data-mcp', version: '0.1.0' },
206
+ { name: 'taiwan-data-mcp', version: '0.7.0' },
205
207
  { capabilities: { tools: {} } }
206
208
  );
207
209
 
package/src/sources.mjs CHANGED
@@ -77,32 +77,51 @@ export async function personCompanies(name) {
77
77
  source: '台灣公司登記網 inc.com.tw' };
78
78
  }
79
79
 
80
- export async function companyRisk(id) {
81
- const tin = String(id || '').replace(/\D/g, '');
82
- if (tin.length !== 8) return { error: '統一編號必須是 8 位數字' };
83
- const { ok, status, body } = await fetchJson(`https://inc.com.tw/api/company/${tin}`, { timeout: 20000 });
84
- if (status === 404) return { error: `查無此統一編號 ${tin}` };
85
- if (!ok || !body) return { error: '查詢失敗(inc.com.tw)', unified_business_no: tin };
80
+ // 風險查核:用統編或公司名(簡稱會自動解析成正主,如「台積電」→台積電本尊)。
81
+ // inc.com.tw/api/card:比 /api/company flags 更完整(含解散/金管裁罰/司法/國際制裁),上市櫃並附即時股價。
82
+ export async function companyRisk(idOrName) {
83
+ const raw = String(idOrName || '').trim();
84
+ if (!raw) return { error: '請提供統一編號或公司名稱' };
85
+ const tin = raw.replace(/\D/g, '');
86
+ const url = /^\d{8}$/.test(tin)
87
+ ? `https://inc.com.tw/api/card/${tin}`
88
+ : `https://inc.com.tw/api/card?name=${encodeURIComponent(raw)}`;
89
+ const { ok, status, body } = await fetchJson(url, { timeout: 20000 });
90
+ if (status === 404) return { error: `查無公司:${raw}` };
91
+ if (!ok || !body || body.error) return { error: '查詢失敗(inc.com.tw)', query: raw };
86
92
  const f = body.flags || {};
87
93
  const redFlags = [];
88
- if (f.government_debarment) redFlags.push('政府採購拒絕往來');
89
- if (f.labor_penalties) redFlags.push(`勞動法令裁罰 ${f.labor_penalties} 筆`);
90
- if (f.environmental_penalties) redFlags.push(`環保裁罰 ${f.environmental_penalties} 筆`);
91
- const level = f.government_debarment ? 'high' : redFlags.length ? 'medium' : 'low';
94
+ if (f.dissolved) redFlags.push(`登記狀態:${body.status}`);
95
+ if (f.reject) redFlags.push('政府採購拒絕往來');
96
+ if (f.sanction) redFlags.push(`命中國際制裁名單 ${f.sanction} 筆(OFAC/UN 等)`);
97
+ if (f.fsc) redFlags.push(`金管會重大裁罰 ${f.fsc} 件`);
98
+ if (f.judicial) redFlags.push(`司法案件 ${f.judicial} 筆`);
99
+ if (f.labor) redFlags.push(`勞動法令裁罰 ${f.labor} 筆`);
100
+ if (f.env) redFlags.push(`環保裁罰 ${f.env} 筆`);
101
+ // 重大紅旗(解散/拒往/制裁/司法/金管)→ high;僅勞動或環保 → medium;皆無 → low
102
+ const major = f.dissolved || f.reject || f.sanction || f.judicial || f.fsc;
103
+ const level = major ? 'high' : (f.labor || f.env) ? 'medium' : 'low';
92
104
  return {
93
- unified_business_no: tin,
105
+ unified_business_no: body.id,
94
106
  name: body.name,
107
+ representative: body.rep || null,
95
108
  status: body.status,
96
- listing: body.listing || null,
109
+ capital: body.capital ?? null,
110
+ listing: body.listed || null,
111
+ stock_price: body.price || null,
97
112
  risk_level: level,
98
113
  red_flags: redFlags,
99
114
  detail: {
100
- government_debarment: !!f.government_debarment,
101
- labor_penalties: f.labor_penalties || 0,
102
- environmental_penalties: f.environmental_penalties || 0,
115
+ dissolved: !!f.dissolved,
116
+ government_debarment: f.reject || 0,
117
+ international_sanction: f.sanction || 0,
118
+ fsc_major_penalty: f.fsc || 0,
119
+ judicial_cases: f.judicial || 0,
120
+ labor_penalties: f.labor || 0,
121
+ environmental_penalties: f.env || 0,
103
122
  },
104
- note: '裁罰以公司名稱比對,可能含同名同稱;僅供參考,以政府原始公告為準',
105
- profile_url: `https://inc.com.tw/c/${tin}`,
123
+ note: '裁罰/名單以公司名稱比對,可能含同名同稱;僅供參考,以政府原始公告為準',
124
+ profile_url: body.url || `https://inc.com.tw/c/${body.id}`,
106
125
  source: '台灣公司登記網 inc.com.tw',
107
126
  };
108
127
  }