taiwan-data-mcp 0.7.0 → 0.10.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 +3 -0
- package/package.json +1 -1
- package/src/server.mjs +61 -2
- package/src/sources.mjs +54 -4
package/README.md
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
| `taiwan_company_profile` | 用統編查公司完整登記資料(含董監事) | inc.com.tw |
|
|
14
14
|
| `taiwan_person_companies` | 用人名查他擔任負責人/董監事的公司 | inc.com.tw |
|
|
15
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, validateTaxId, findConnection,
|
|
7
8
|
realpriceSearch, realpriceLocate, realpriceArea, realpriceEstimate, realpriceRoad,
|
|
8
9
|
drugSearch, drugInfo,
|
|
9
10
|
tenderByCompany, tenderSearch,
|
|
@@ -68,6 +69,64 @@ const TOOLS = [
|
|
|
68
69
|
},
|
|
69
70
|
run: (a) => companyRisk(a.unified_business_no || a.name),
|
|
70
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 取「即時」官方登記狀態(名稱/狀態/資本/實收/負責人/所在地/登記機關)。比一般資料庫更即時,適合確認某公司目前是否仍存續、是否已解散撤銷。資料來源:經濟部商工登記公示資料。',
|
|
98
|
+
inputSchema: {
|
|
99
|
+
type: 'object',
|
|
100
|
+
properties: { unified_business_no: { type: 'string', description: '8 位統一編號,例如 22099131' } },
|
|
101
|
+
required: ['unified_business_no'],
|
|
102
|
+
},
|
|
103
|
+
run: (a) => companyVerify(a.unified_business_no),
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'taiwan_validate_tax_id',
|
|
107
|
+
description:
|
|
108
|
+
'驗證台灣統一編號(8 碼)檢查碼是否正確(財政部統編邏輯,純演算法、不查資料庫)。資料清理、表單驗證、判斷一組號碼是否為有效統編格式用。回傳 valid 與說明。資料來源:inc.com.tw。',
|
|
109
|
+
inputSchema: {
|
|
110
|
+
type: 'object',
|
|
111
|
+
properties: { unified_business_no: { type: 'string', description: '8 位統一編號,例如 22099131' } },
|
|
112
|
+
required: ['unified_business_no'],
|
|
113
|
+
},
|
|
114
|
+
run: (a) => validateTaxId(a.unified_business_no),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'taiwan_find_connection',
|
|
118
|
+
description:
|
|
119
|
+
'查兩家公司/兩個人之間的最短關係鏈(天眼查式盡職調查):透過共同負責人/董監事一層層串接,回傳中間的人與公司節點與相隔層數。用於「這兩家公司/這兩個人有沒有關係、怎麼牽上線」。a、b 可填公司名、8 位統編或人名。資料來源:inc.com.tw。',
|
|
120
|
+
inputSchema: {
|
|
121
|
+
type: 'object',
|
|
122
|
+
properties: {
|
|
123
|
+
a: { type: 'string', description: '起點:公司名/統編/人名,例如「鴻海精密工業」' },
|
|
124
|
+
b: { type: 'string', description: '終點:公司名/統編/人名,例如「三創數位」' },
|
|
125
|
+
},
|
|
126
|
+
required: ['a', 'b'],
|
|
127
|
+
},
|
|
128
|
+
run: (a) => findConnection(a.a, a.b),
|
|
129
|
+
},
|
|
71
130
|
{
|
|
72
131
|
name: 'taiwan_realprice_search',
|
|
73
132
|
description:
|
|
@@ -203,7 +262,7 @@ const TOOLS = [
|
|
|
203
262
|
];
|
|
204
263
|
|
|
205
264
|
const server = new Server(
|
|
206
|
-
{ name: 'taiwan-data-mcp', version: '0.
|
|
265
|
+
{ name: 'taiwan-data-mcp', version: '0.10.0' },
|
|
207
266
|
{ capabilities: { tools: {} } }
|
|
208
267
|
);
|
|
209
268
|
|
|
@@ -224,4 +283,4 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
224
283
|
|
|
225
284
|
const transport = new StdioServerTransport();
|
|
226
285
|
await server.connect(transport);
|
|
227
|
-
console.error('taiwan-data-mcp running (stdio) —
|
|
286
|
+
console.error('taiwan-data-mcp running (stdio) — 20 tools: 防詐 / 公司登記·關係·盡調 / 實價登錄 / 藥品健康 / 政府標案 / 農產行情');
|
package/src/sources.mjs
CHANGED
|
@@ -95,12 +95,13 @@ export async function companyRisk(idOrName) {
|
|
|
95
95
|
if (f.reject) redFlags.push('政府採購拒絕往來');
|
|
96
96
|
if (f.sanction) redFlags.push(`命中國際制裁名單 ${f.sanction} 筆(OFAC/UN 等)`);
|
|
97
97
|
if (f.fsc) redFlags.push(`金管會重大裁罰 ${f.fsc} 件`);
|
|
98
|
-
if (f.judicial) redFlags.push(`司法案件 ${f.judicial}
|
|
98
|
+
if (f.judicial) redFlags.push(`司法案件 ${f.judicial} 筆(以名稱比對,含一般民事/被列名,未必為違法,僅供參考)`);
|
|
99
99
|
if (f.labor) redFlags.push(`勞動法令裁罰 ${f.labor} 筆`);
|
|
100
100
|
if (f.env) redFlags.push(`環保裁罰 ${f.env} 筆`);
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
const
|
|
101
|
+
// 重大紅旗(解散/拒絕往來/國際制裁/金管會重大裁罰)→ high。
|
|
102
|
+
// 司法案件以名稱比對且噪訊高(大公司常被列為當事人),與勞動/環保同列 medium,不單獨拉到 high。
|
|
103
|
+
const major = f.dissolved || f.reject || f.sanction || f.fsc;
|
|
104
|
+
const level = major ? 'high' : (f.judicial || f.labor || f.env) ? 'medium' : 'low';
|
|
104
105
|
return {
|
|
105
106
|
unified_business_no: body.id,
|
|
106
107
|
name: body.name,
|
|
@@ -126,6 +127,55 @@ export async function companyRisk(idOrName) {
|
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
129
|
|
|
130
|
+
// 公司關係圖譜(天眼查式):法人股東/轉投資子公司/最終母公司/集團規模/共同董監事人脈。
|
|
131
|
+
export async function companyRelations(id) {
|
|
132
|
+
const tin = String(id || '').replace(/\D/g, '');
|
|
133
|
+
if (tin.length !== 8) return { error: '統一編號必須是 8 位數字' };
|
|
134
|
+
const { ok, status, body } = await fetchJson(`https://inc.com.tw/api/relations/${tin}`, { timeout: 20000 });
|
|
135
|
+
if (status === 404) return { error: `查無此統一編號 ${tin}` };
|
|
136
|
+
if (!ok || !body) return { error: '查詢失敗(inc.com.tw)', unified_business_no: tin };
|
|
137
|
+
return body; // 已自帶 source / profile_url / note
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// 公司名稱預查/撞名查重(創業命名、盡調辨識用)。
|
|
141
|
+
export async function companyNameCheck(name) {
|
|
142
|
+
const q = String(name || '').trim();
|
|
143
|
+
if (q.length < 2) return { error: '公司名稱至少 2 個字' };
|
|
144
|
+
const { ok, body } = await fetchJson(`https://inc.com.tw/api/namecheck?name=${encodeURIComponent(q)}`);
|
|
145
|
+
if (!ok || !body) return { error: '查詢失敗(inc.com.tw)', query: q };
|
|
146
|
+
return { query: q, ...body, note: '名稱比對僅供命名參考;正式設立以經濟部名稱預查核准為準', source: '台灣公司登記網 inc.com.tw' };
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// 官方即時查證:經濟部商工登記公示 OpenAPI 的「目前」登記狀態(比快取更即時)。
|
|
150
|
+
export async function companyVerify(id) {
|
|
151
|
+
const tin = String(id || '').replace(/\D/g, '');
|
|
152
|
+
if (tin.length !== 8) return { error: '統一編號必須是 8 位數字' };
|
|
153
|
+
const { ok, body } = await fetchJson(`https://inc.com.tw/api/verify?id=${tin}`, { timeout: 15000 });
|
|
154
|
+
if (!ok || !body) return { error: '查詢失敗(inc.com.tw)', unified_business_no: tin };
|
|
155
|
+
if (!body.ok) return { unified_business_no: tin, verified: false, note: body.note || '官方查證暫時無回應', source: '經濟部商工登記公示資料' };
|
|
156
|
+
return { unified_business_no: tin, verified: true, name: body.name, status: body.status, capital: body.capital,
|
|
157
|
+
paid_in_capital: body.paid, representative: body.responsible, location: body.location, register_organization: body.regOrg,
|
|
158
|
+
source: body.src || '經濟部商工登記公示資料' };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 統一編號檢查碼驗證(純演算法,資料清理/表單檢核用)。
|
|
162
|
+
export async function validateTaxId(id) {
|
|
163
|
+
const tin = String(id || '').replace(/\D/g, '');
|
|
164
|
+
if (tin.length !== 8) return { input: String(id || ''), valid: false, reason: '統一編號必須是 8 位數字' };
|
|
165
|
+
const { ok, body } = await fetchJson(`https://inc.com.tw/api/taxid?id=${tin}`, { timeout: 10000 });
|
|
166
|
+
if (!ok || !body) return { input: tin, valid: false, reason: '查詢失敗(inc.com.tw)' };
|
|
167
|
+
return body;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// 關係路徑:兩家公司/兩人之間透過共同負責人/董監事串接的最短關係鏈(天眼查式盡調)。
|
|
171
|
+
export async function findConnection(a, b) {
|
|
172
|
+
const qa = String(a || '').trim(), qb = String(b || '').trim();
|
|
173
|
+
if (!qa || !qb) return { error: '請提供 a 與 b(公司名/統編/人名)' };
|
|
174
|
+
const { ok, body } = await fetchJson(`https://inc.com.tw/api/path?a=${encodeURIComponent(qa)}&b=${encodeURIComponent(qb)}`, { timeout: 25000 });
|
|
175
|
+
if (!ok || !body) return { error: '查詢失敗(inc.com.tw)', a: qa, b: qb };
|
|
176
|
+
return body; // 已自帶 from/to/path/note/source
|
|
177
|
+
}
|
|
178
|
+
|
|
129
179
|
// ── 農產批發行情 MOA(農業部農產品交易行情)──────────────────────
|
|
130
180
|
function _rocToAd(s) {
|
|
131
181
|
const m = String(s || '').match(/^(\d{2,3})\.(\d{2})\.(\d{2})$/);
|