national-stats-mcp 1.0.0 → 1.0.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.
- package/dist/api-client.js +4 -7
- package/package.json +4 -1
package/dist/api-client.js
CHANGED
|
@@ -169,22 +169,19 @@ class StatsApiClient {
|
|
|
169
169
|
async getData(zb, dbcode, sj = 'LAST30') {
|
|
170
170
|
const wds = JSON.stringify([{ "wdcode": "zb", "valuecode": zb }]);
|
|
171
171
|
const dfwds = JSON.stringify([{ "wdcode": "sj", "valuecode": sj }]);
|
|
172
|
+
// 使用axios的params选项,让axios自动处理参数编码(避免双重编码问题)
|
|
172
173
|
const params = {
|
|
173
174
|
m: 'QueryData',
|
|
174
175
|
dbcode,
|
|
175
176
|
rowcode: 'zb',
|
|
176
177
|
colcode: 'sj',
|
|
177
|
-
//
|
|
178
|
-
|
|
179
|
-
dfwds: encodeURIComponent(dfwds),
|
|
178
|
+
wds, // 不进行手动URL编码,交给axios处理
|
|
179
|
+
dfwds, // 不进行手动URL编码,交给axios处理
|
|
180
180
|
k1: Date.now(), // 添加时间戳防止缓存
|
|
181
181
|
h: 1
|
|
182
182
|
};
|
|
183
|
-
const paramStr = Object.entries(params)
|
|
184
|
-
.map(([k, v]) => `${k}=${v}`)
|
|
185
|
-
.join('&');
|
|
186
183
|
try {
|
|
187
|
-
const response = await axios_1.default.get(`${this.baseUrl}/easyquery.htm
|
|
184
|
+
const response = await axios_1.default.get(`${this.baseUrl}/easyquery.htm`, { params });
|
|
188
185
|
return response.data;
|
|
189
186
|
}
|
|
190
187
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "national-stats-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "MCP server for accessing National Bureau of Statistics data",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"national-stats-mcp": "dist/index.js"
|
|
8
|
+
},
|
|
6
9
|
"scripts": {
|
|
7
10
|
"build": "tsc",
|
|
8
11
|
"start": "node dist/index.js",
|