taiwan-data-mcp 0.3.0 → 0.4.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 +2 -2
- package/src/server.mjs +24 -1
- package/src/sources.mjs +33 -0
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
| `taiwan_realprice_area` | 查某縣市 / 行政區成交行情統計 | housetw.com |
|
|
19
19
|
| `taiwan_realprice_estimate` | 自動估價:單價區間與推估總價 | housetw.com |
|
|
20
20
|
| `taiwan_realprice_road` | 查某路段成交行情與逐年走勢 | housetw.com |
|
|
21
|
+
| `taiwan_drug_search` | 用中文藥名搜尋核准藥品、取許可證字號 | [health-hub](https://health-hub-epx.pages.dev)(衛福部食藥署) |
|
|
22
|
+
| `taiwan_drug_info` | 用許可證字號查藥品主要成分 | health-hub |
|
|
21
23
|
|
|
22
24
|
跨工具串接是重點:例如「查這家公司 → 看它登記地址那區的房價 → 查它官網是不是詐騙」,一次問答內 AI 自己串起來。
|
|
23
25
|
|
|
@@ -72,6 +74,7 @@ node test/e2e.mjs # MCP 協定層測試
|
|
|
72
74
|
- 實價登錄行情 — **[housetw.com](https://housetw.com)**(實價雷達)
|
|
73
75
|
- 公司登記查核 — **[inc.com.tw](https://inc.com.tw)**(台灣公司登記網)
|
|
74
76
|
- 165 防詐查詢 — **[fraud.tw](https://fraud.tw)**(防詐雷達)
|
|
77
|
+
- 藥品/健康查詢 — **[health-hub](https://health-hub-epx.pages.dev)**(衛福部食藥署資料)
|
|
75
78
|
|
|
76
79
|
三站皆為聚合台灣政府開放資料的免費查詢服務。
|
|
77
80
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taiwan-data-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP server for Taiwan public data — 實價登錄行情、公司登記查核、165
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "MCP server for Taiwan public data — 實價登錄行情、公司登記查核、165 防詐查詢、藥品成分查詢。Lets AI assistants (Claude, Cursor, etc.) query real Taiwan data.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"taiwan-data-mcp": "src/server.mjs"
|
package/src/server.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { ListToolsRequestSchema, CallToolRequestSchema } from '@modelcontextprot
|
|
|
5
5
|
import {
|
|
6
6
|
scamCheck, companySearch, companyProfile, personCompanies, companyRisk,
|
|
7
7
|
realpriceSearch, realpriceLocate, realpriceArea, realpriceEstimate, realpriceRoad,
|
|
8
|
+
drugSearch, drugInfo,
|
|
8
9
|
} from './sources.mjs';
|
|
9
10
|
|
|
10
11
|
const TOOLS = [
|
|
@@ -134,6 +135,28 @@ const TOOLS = [
|
|
|
134
135
|
},
|
|
135
136
|
run: (a) => realpriceRoad(a.county, a.district, a.road),
|
|
136
137
|
},
|
|
138
|
+
{
|
|
139
|
+
name: 'taiwan_drug_search',
|
|
140
|
+
description:
|
|
141
|
+
'搜尋台灣核准的藥品(用中文藥名關鍵字),回傳符合的藥品與其衛福部許可證字號。要看成分請接著用 taiwan_drug_info。資料來源:衛福部食藥署 · health-hub。',
|
|
142
|
+
inputSchema: {
|
|
143
|
+
type: 'object',
|
|
144
|
+
properties: { name: { type: 'string', description: '藥品中文名關鍵字,例如「普拿疼」「斯斯」' } },
|
|
145
|
+
required: ['name'],
|
|
146
|
+
},
|
|
147
|
+
run: (a) => drugSearch(a.name),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: 'taiwan_drug_info',
|
|
151
|
+
description:
|
|
152
|
+
'用藥品許可證字號查該藥的主要成分。資料來源:衛福部食藥署藥品許可證 · health-hub。用藥請依醫師、藥師指示。',
|
|
153
|
+
inputSchema: {
|
|
154
|
+
type: 'object',
|
|
155
|
+
properties: { license_no: { type: 'string', description: '藥品許可證字號,例如「衛署藥輸字第024600號」(可先用 taiwan_drug_search 取得)' } },
|
|
156
|
+
required: ['license_no'],
|
|
157
|
+
},
|
|
158
|
+
run: (a) => drugInfo(a.license_no),
|
|
159
|
+
},
|
|
137
160
|
];
|
|
138
161
|
|
|
139
162
|
const server = new Server(
|
|
@@ -158,4 +181,4 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
158
181
|
|
|
159
182
|
const transport = new StdioServerTransport();
|
|
160
183
|
await server.connect(transport);
|
|
161
|
-
console.error('taiwan-data-mcp running (stdio) —
|
|
184
|
+
console.error('taiwan-data-mcp running (stdio) — 12 tools: 防詐 / 公司登記 / 實價登錄 / 藥品健康');
|
package/src/sources.mjs
CHANGED
|
@@ -107,6 +107,39 @@ export async function companyRisk(id) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// ── 藥品/健康 health-hub ───────────────────────────────────────
|
|
111
|
+
const HEALTH_BASE = 'https://health-hub-epx.pages.dev';
|
|
112
|
+
|
|
113
|
+
export async function drugSearch(name) {
|
|
114
|
+
const q = String(name || '').trim();
|
|
115
|
+
if (q.length < 1) return { error: '請提供藥品名稱關鍵字' };
|
|
116
|
+
const { ok, body } = await fetchJson(`${HEALTH_BASE}/api/suggest?q=${encodeURIComponent(q)}`);
|
|
117
|
+
if (!ok || !Array.isArray(body)) return { error: '查詢失敗(health-hub)', query: q };
|
|
118
|
+
const drugs = body.map((d) => {
|
|
119
|
+
let lic = '';
|
|
120
|
+
try { lic = decodeURIComponent((d.href || '').replace(/^\/drug\//, '')); } catch { lic = (d.href || '').replace(/^\/drug\//, ''); }
|
|
121
|
+
return { name: d.name, license_no: lic, detail: d.href ? `${HEALTH_BASE}${d.href}` : undefined };
|
|
122
|
+
});
|
|
123
|
+
return { query: q, count: drugs.length, drugs,
|
|
124
|
+
source: '衛福部食藥署藥品許可證 · 健康查詢 health-hub' };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export async function drugInfo(licenseNo) {
|
|
128
|
+
const lic = String(licenseNo || '').trim();
|
|
129
|
+
if (!lic) return { error: '請提供藥品許可證字號(license_no),可先用 taiwan_drug_search 取得' };
|
|
130
|
+
const { ok, body } = await fetchJson(`${HEALTH_BASE}/api/drug-ingredients?lic=${encodeURIComponent(lic)}`);
|
|
131
|
+
if (!ok || !body) return { error: '查詢失敗(health-hub)', license_no: lic };
|
|
132
|
+
if (!body.name) return { error: `查無此許可證字號 ${lic}`, license_no: lic };
|
|
133
|
+
return {
|
|
134
|
+
license_no: lic,
|
|
135
|
+
name: body.name,
|
|
136
|
+
active_ingredients: body.ingredients || [],
|
|
137
|
+
detail: `${HEALTH_BASE}/drug/${encodeURIComponent(lic)}`,
|
|
138
|
+
note: '藥品資訊僅供參考,用藥請依醫師、藥師指示',
|
|
139
|
+
source: '衛福部食藥署藥品許可證 · 健康查詢 health-hub',
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
110
143
|
// ── 實價登錄 housetw.com ───────────────────────────────────────
|
|
111
144
|
export async function realpriceSearch(q) {
|
|
112
145
|
const query = String(q || '').trim();
|