finhay-mcp-server 1.1.1 → 1.1.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/install.js +22 -18
- package/package.json +1 -1
package/dist/install.js
CHANGED
|
@@ -127,9 +127,13 @@ function updateClaudeConfig() {
|
|
|
127
127
|
}
|
|
128
128
|
async function main() {
|
|
129
129
|
console.log('\n Finhay MCP Server — Cai dat cho Claude Desktop\n');
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
// --- Step 1: Node.js — checked by the wrapper / npx; nothing to do here ---
|
|
131
|
+
// --- Step 2: Claude Desktop config ---
|
|
132
|
+
const configPath = updateClaudeConfig();
|
|
133
|
+
console.log();
|
|
134
|
+
console.log(`Cai dat config Finhay MCP Claude Desktop thanh cong ${configPath}`);
|
|
135
|
+
console.log();
|
|
136
|
+
let credsAction = 'create';
|
|
133
137
|
if (fs.existsSync(CREDENTIALS_PATH)) {
|
|
134
138
|
const content = fs.readFileSync(CREDENTIALS_PATH, 'utf-8');
|
|
135
139
|
const keyMatch = content.match(/FINHAY_API_KEY=(.+)/);
|
|
@@ -139,29 +143,23 @@ async function main() {
|
|
|
139
143
|
console.log(` Tim thay credentials tai ${CREDENTIALS_PATH}`);
|
|
140
144
|
console.log(` API Key: ${maskedKey}\n`);
|
|
141
145
|
const replace = await ask('Ban co muon thay the khong? (y/n): ');
|
|
142
|
-
|
|
143
|
-
overwroteCreds = true;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
apiKey = keyMatch[1].trim();
|
|
147
|
-
apiSecret = secretMatch[1].trim();
|
|
148
|
-
}
|
|
146
|
+
credsAction = replace.toLowerCase() === 'y' ? 'update' : 'reuse';
|
|
149
147
|
console.log();
|
|
150
148
|
}
|
|
151
149
|
}
|
|
152
|
-
if (
|
|
153
|
-
apiKey =
|
|
150
|
+
if (credsAction === 'create' || credsAction === 'update') {
|
|
151
|
+
const apiKey = credsAction === 'update'
|
|
154
152
|
? await ask('Nhap API Key moi: ')
|
|
155
153
|
: await ask('Nhap API Key: ');
|
|
156
154
|
if (!apiKey) {
|
|
157
155
|
console.error('\n Loi: API Key khong duoc de trong.\n');
|
|
158
156
|
process.exit(1);
|
|
159
157
|
}
|
|
160
|
-
apiSecret =
|
|
158
|
+
const apiSecret = credsAction === 'update'
|
|
161
159
|
? await askMasked('Nhap Secret Key moi: ')
|
|
162
160
|
: await askMasked('Nhap Secret Key: ');
|
|
163
161
|
if (!apiSecret) {
|
|
164
|
-
console.error('\n Loi:
|
|
162
|
+
console.error('\n Loi: Secret Key khong duoc de trong.\n');
|
|
165
163
|
process.exit(1);
|
|
166
164
|
}
|
|
167
165
|
upsertEnvFile(CREDENTIALS_PATH, {
|
|
@@ -170,11 +168,17 @@ async function main() {
|
|
|
170
168
|
FINHAY_BASE_URL: 'https://open-api.fhsc.com.vn',
|
|
171
169
|
});
|
|
172
170
|
}
|
|
173
|
-
const configPath = updateClaudeConfig();
|
|
174
171
|
console.log();
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
172
|
+
if (credsAction === 'create') {
|
|
173
|
+
console.log(`Tao Credentials thanh cong tai ${CREDENTIALS_PATH}`);
|
|
174
|
+
}
|
|
175
|
+
else if (credsAction === 'update') {
|
|
176
|
+
console.log(`Cap nhat Credentials thanh cong tai ${CREDENTIALS_PATH}`);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
console.log(`Su dung credentials hien co tai ${CREDENTIALS_PATH}`);
|
|
180
|
+
}
|
|
181
|
+
console.log();
|
|
178
182
|
console.log('Hay khoi dong lai ung dung de su dung');
|
|
179
183
|
console.log();
|
|
180
184
|
}
|