finhay-mcp-server 1.1.1 → 1.1.3

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 +26 -20
  2. package/package.json +1 -1
package/dist/install.js CHANGED
@@ -127,41 +127,41 @@ 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';
137
+ console.log('Xac thuc ket noi tai khoan FHSC');
133
138
  if (fs.existsSync(CREDENTIALS_PATH)) {
134
139
  const content = fs.readFileSync(CREDENTIALS_PATH, 'utf-8');
135
140
  const keyMatch = content.match(/FINHAY_API_KEY=(.+)/);
136
141
  const secretMatch = content.match(/FINHAY_API_SECRET=(.+)/);
137
142
  if (keyMatch && secretMatch) {
138
143
  const maskedKey = keyMatch[1].trim().slice(0, 8) + '***';
139
- console.log(` Tim thay credentials tai ${CREDENTIALS_PATH}`);
140
- console.log(` API Key: ${maskedKey}\n`);
144
+ console.log(`Tim thay thong tin Credentials ${CREDENTIALS_PATH}`);
145
+ console.log(`API Key: ${maskedKey}`);
146
+ console.log('Secret Key: ******\n');
141
147
  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
- }
148
+ credsAction = replace.toLowerCase() === 'y' ? 'update' : 'reuse';
149
149
  console.log();
150
150
  }
151
151
  }
152
- if (!apiKey) {
153
- apiKey = overwroteCreds
152
+ if (credsAction === 'create' || credsAction === 'update') {
153
+ const apiKey = credsAction === 'update'
154
154
  ? await ask('Nhap API Key moi: ')
155
155
  : await ask('Nhap API Key: ');
156
156
  if (!apiKey) {
157
157
  console.error('\n Loi: API Key khong duoc de trong.\n');
158
158
  process.exit(1);
159
159
  }
160
- apiSecret = overwroteCreds
160
+ const apiSecret = credsAction === 'update'
161
161
  ? await askMasked('Nhap Secret Key moi: ')
162
162
  : await askMasked('Nhap Secret Key: ');
163
163
  if (!apiSecret) {
164
- console.error('\n Loi: API Secret khong duoc de trong.\n');
164
+ console.error('\n Loi: Secret Key khong duoc de trong.\n');
165
165
  process.exit(1);
166
166
  }
167
167
  upsertEnvFile(CREDENTIALS_PATH, {
@@ -169,12 +169,18 @@ async function main() {
169
169
  FINHAY_API_SECRET: apiSecret,
170
170
  FINHAY_BASE_URL: 'https://open-api.fhsc.com.vn',
171
171
  });
172
+ console.log();
173
+ }
174
+ if (credsAction === 'create') {
175
+ console.log(`Tao Credentials thanh cong tai ${CREDENTIALS_PATH}`);
176
+ }
177
+ else if (credsAction === 'update') {
178
+ console.log(`Cap nhat Credentials thanh cong tai ${CREDENTIALS_PATH}`);
179
+ }
180
+ else {
181
+ console.log(`Su dung credentials hien co tai ${CREDENTIALS_PATH}`);
172
182
  }
173
- const configPath = updateClaudeConfig();
174
183
  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}`);
178
184
  console.log('Hay khoi dong lai ung dung de su dung');
179
185
  console.log();
180
186
  }
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.3",
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",