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.
Files changed (2) hide show
  1. package/dist/install.js +22 -18
  2. 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
- let apiKey = '';
131
- let apiSecret = '';
132
- let overwroteCreds = false;
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
- if (replace.toLowerCase() === 'y') {
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 (!apiKey) {
153
- apiKey = overwroteCreds
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 = overwroteCreds
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: API Secret khong duoc de trong.\n');
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
- console.log(overwroteCreds ? 'Da Cap nhat Credentials thanh cong!' : 'Da cai dat thanh cong!');
176
- console.log(` - Credentials: ${CREDENTIALS_PATH}`);
177
- console.log(` - Claude Desktop config: ${configPath}`);
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "finhay-mcp-server",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "mcpName": "io.github.finhay/mcp-server",
5
5
  "description": "Finhay MCP Server — xem gia co phieu, danh muc dau tu qua Claude AI",
6
6
  "type": "module",