taiwan-data-mcp 0.6.0 → 0.8.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 +4 -1
- package/package.json +1 -1
- package/src/server.mjs +40 -4
- package/src/sources.mjs +67 -17
package/README.md
CHANGED
|
@@ -12,7 +12,10 @@
|
|
|
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` |
|
|
15
|
+
| `taiwan_company_risk` | 公司風險查核(統編或公司名):解散/拒絕往來/國際制裁/金管會/司法/勞動/環保紅旗+上市櫃即時股價 | inc.com.tw |
|
|
16
|
+
| `taiwan_company_relations` | 公司關係圖譜:法人股東/轉投資子公司/最終母公司/集團規模/共同董監事人脈 | inc.com.tw |
|
|
17
|
+
| `taiwan_company_name_check` | 公司名稱預查/撞名查重(創業命名用) | inc.com.tw |
|
|
18
|
+
| `taiwan_company_verify` | 經濟部商工登記 OpenAPI 即時官方登記狀態 | inc.com.tw |
|
|
16
19
|
| `taiwan_realprice_search` | 搜尋實價登錄的地址 / 路段 / 行政區 | [housetw.com](https://housetw.com)(內政部實價登錄) |
|
|
17
20
|
| `taiwan_realprice_locate` | 用經緯度反查行政區與行情頁 | housetw.com |
|
|
18
21
|
| `taiwan_realprice_area` | 查某縣市 / 行政區成交行情統計 | housetw.com |
|
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
4
4
|
import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import {
|
|
6
6
|
scamCheck, companySearch, companyProfile, personCompanies, companyRisk,
|
|
7
|
+
companyRelations, companyNameCheck, companyVerify,
|
|
7
8
|
realpriceSearch, realpriceLocate, realpriceArea, realpriceEstimate, realpriceRoad,
|
|
8
9
|
drugSearch, drugInfo,
|
|
9
10
|
tenderByCompany, tenderSearch,
|
|
@@ -58,13 +59,48 @@ const TOOLS = [
|
|
|
58
59
|
{
|
|
59
60
|
name: 'taiwan_company_risk',
|
|
60
61
|
description:
|
|
61
|
-
'公司風險查核(盡職調查紅旗):用 8
|
|
62
|
+
'公司風險查核(盡職調查紅旗):用 8 位統編或公司名稱(簡稱如「台積電」自動解析成正主)查該公司有無解散、政府採購拒絕往來、國際制裁名單(OFAC/UN)、金管會重大裁罰、司法案件、勞動法令裁罰、環保裁罰,回傳風險等級、紅旗清單與負責人,上市櫃並附即時股價。資料來源:inc.com.tw(聚合政府公開資料)。',
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
unified_business_no: { type: 'string', description: '8 位統一編號(與 name 二擇一),例如 22099131' },
|
|
67
|
+
name: { type: 'string', description: '公司名稱或簡稱(與統編二擇一),例如「台積電」「鴻海」' },
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
run: (a) => companyRisk(a.unified_business_no || a.name),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'taiwan_company_relations',
|
|
74
|
+
description:
|
|
75
|
+
'公司關係圖譜(盡職調查/天眼查式):用 8 位統編查該公司的法人股東(誰持有它)、轉投資子公司(它持有誰)、推估最終母公司、整個集團規模,以及共同董監事連到的其他公司(人脈)。查母子公司、集團版圖、關係人用。資料來源:inc.com.tw。',
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: 'object',
|
|
78
|
+
properties: { unified_business_no: { type: 'string', description: '8 位統一編號,例如 04541302(鴻海)' } },
|
|
79
|
+
required: ['unified_business_no'],
|
|
80
|
+
},
|
|
81
|
+
run: (a) => companyRelations(a.unified_business_no),
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'taiwan_company_name_check',
|
|
85
|
+
description:
|
|
86
|
+
'公司名稱預查/撞名查重:給一個想取的公司名稱,回傳是否已有相同或近似的既有公司(含統編)。創業命名或盡調辨識用。回傳 core(特取名稱)、exact(完全相同)、similar(近似)。資料來源:inc.com.tw。',
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: { name: { type: 'string', description: '想查的公司名稱,例如「台積電」「方圓科技」' } },
|
|
90
|
+
required: ['name'],
|
|
91
|
+
},
|
|
92
|
+
run: (a) => companyNameCheck(a.name),
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'taiwan_company_verify',
|
|
96
|
+
description:
|
|
97
|
+
'用 8 位統編向經濟部商工登記公示 OpenAPI 取「即時」官方登記狀態(名稱/狀態/資本/實收/負責人/所在地/登記機關)。比一般資料庫更即時,適合確認某公司目前是否仍存續、是否已解散撤銷。資料來源:經濟部商工登記公示資料。',
|
|
62
98
|
inputSchema: {
|
|
63
99
|
type: 'object',
|
|
64
100
|
properties: { unified_business_no: { type: 'string', description: '8 位統一編號,例如 22099131' } },
|
|
65
101
|
required: ['unified_business_no'],
|
|
66
102
|
},
|
|
67
|
-
run: (a) =>
|
|
103
|
+
run: (a) => companyVerify(a.unified_business_no),
|
|
68
104
|
},
|
|
69
105
|
{
|
|
70
106
|
name: 'taiwan_realprice_search',
|
|
@@ -201,7 +237,7 @@ const TOOLS = [
|
|
|
201
237
|
];
|
|
202
238
|
|
|
203
239
|
const server = new Server(
|
|
204
|
-
{ name: 'taiwan-data-mcp', version: '0.
|
|
240
|
+
{ name: 'taiwan-data-mcp', version: '0.8.0' },
|
|
205
241
|
{ capabilities: { tools: {} } }
|
|
206
242
|
);
|
|
207
243
|
|
|
@@ -222,4 +258,4 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
222
258
|
|
|
223
259
|
const transport = new StdioServerTransport();
|
|
224
260
|
await server.connect(transport);
|
|
225
|
-
console.error('taiwan-data-mcp running (stdio) —
|
|
261
|
+
console.error('taiwan-data-mcp running (stdio) — 18 tools: 防詐 / 公司登記·關係·盡調 / 實價登錄 / 藥品健康 / 政府標案 / 農產行情');
|
package/src/sources.mjs
CHANGED
|
@@ -77,36 +77,86 @@ export async function personCompanies(name) {
|
|
|
77
77
|
source: '台灣公司登記網 inc.com.tw' };
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
|
|
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.
|
|
89
|
-
if (f.
|
|
90
|
-
if (f.
|
|
91
|
-
|
|
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:
|
|
105
|
+
unified_business_no: body.id,
|
|
94
106
|
name: body.name,
|
|
107
|
+
representative: body.rep || null,
|
|
95
108
|
status: body.status,
|
|
96
|
-
|
|
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
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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/${
|
|
123
|
+
note: '裁罰/名單以公司名稱比對,可能含同名同稱;僅供參考,以政府原始公告為準',
|
|
124
|
+
profile_url: body.url || `https://inc.com.tw/c/${body.id}`,
|
|
106
125
|
source: '台灣公司登記網 inc.com.tw',
|
|
107
126
|
};
|
|
108
127
|
}
|
|
109
128
|
|
|
129
|
+
// 公司關係圖譜(天眼查式):法人股東/轉投資子公司/最終母公司/集團規模/共同董監事人脈。
|
|
130
|
+
export async function companyRelations(id) {
|
|
131
|
+
const tin = String(id || '').replace(/\D/g, '');
|
|
132
|
+
if (tin.length !== 8) return { error: '統一編號必須是 8 位數字' };
|
|
133
|
+
const { ok, status, body } = await fetchJson(`https://inc.com.tw/api/relations/${tin}`, { timeout: 20000 });
|
|
134
|
+
if (status === 404) return { error: `查無此統一編號 ${tin}` };
|
|
135
|
+
if (!ok || !body) return { error: '查詢失敗(inc.com.tw)', unified_business_no: tin };
|
|
136
|
+
return body; // 已自帶 source / profile_url / note
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 公司名稱預查/撞名查重(創業命名、盡調辨識用)。
|
|
140
|
+
export async function companyNameCheck(name) {
|
|
141
|
+
const q = String(name || '').trim();
|
|
142
|
+
if (q.length < 2) return { error: '公司名稱至少 2 個字' };
|
|
143
|
+
const { ok, body } = await fetchJson(`https://inc.com.tw/api/namecheck?name=${encodeURIComponent(q)}`);
|
|
144
|
+
if (!ok || !body) return { error: '查詢失敗(inc.com.tw)', query: q };
|
|
145
|
+
return { query: q, ...body, note: '名稱比對僅供命名參考;正式設立以經濟部名稱預查核准為準', source: '台灣公司登記網 inc.com.tw' };
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 官方即時查證:經濟部商工登記公示 OpenAPI 的「目前」登記狀態(比快取更即時)。
|
|
149
|
+
export async function companyVerify(id) {
|
|
150
|
+
const tin = String(id || '').replace(/\D/g, '');
|
|
151
|
+
if (tin.length !== 8) return { error: '統一編號必須是 8 位數字' };
|
|
152
|
+
const { ok, body } = await fetchJson(`https://inc.com.tw/api/verify?id=${tin}`, { timeout: 15000 });
|
|
153
|
+
if (!ok || !body) return { error: '查詢失敗(inc.com.tw)', unified_business_no: tin };
|
|
154
|
+
if (!body.ok) return { unified_business_no: tin, verified: false, note: body.note || '官方查證暫時無回應', source: '經濟部商工登記公示資料' };
|
|
155
|
+
return { unified_business_no: tin, verified: true, name: body.name, status: body.status, capital: body.capital,
|
|
156
|
+
paid_in_capital: body.paid, representative: body.responsible, location: body.location, register_organization: body.regOrg,
|
|
157
|
+
source: body.src || '經濟部商工登記公示資料' };
|
|
158
|
+
}
|
|
159
|
+
|
|
110
160
|
// ── 農產批發行情 MOA(農業部農產品交易行情)──────────────────────
|
|
111
161
|
function _rocToAd(s) {
|
|
112
162
|
const m = String(s || '').match(/^(\d{2,3})\.(\d{2})\.(\d{2})$/);
|