finhay-mcp-server 1.1.0 → 1.1.1

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 +20 -10
  2. package/package.json +1 -1
package/dist/install.js CHANGED
@@ -123,13 +123,13 @@ function updateClaudeConfig() {
123
123
  args: ['-y', 'finhay-mcp-server'],
124
124
  };
125
125
  fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
126
- console.log(` Claude Desktop config: ${configPath}`);
126
+ return configPath;
127
127
  }
128
128
  async function main() {
129
129
  console.log('\n Finhay MCP Server — Cai dat cho Claude Desktop\n');
130
- console.log(' Tao API Key tai: https://www.finhay.com.vn/finhay-skills\n');
131
130
  let apiKey = '';
132
131
  let apiSecret = '';
132
+ let overwroteCreds = false;
133
133
  if (fs.existsSync(CREDENTIALS_PATH)) {
134
134
  const content = fs.readFileSync(CREDENTIALS_PATH, 'utf-8');
135
135
  const keyMatch = content.match(/FINHAY_API_KEY=(.+)/);
@@ -138,8 +138,11 @@ async function main() {
138
138
  const maskedKey = keyMatch[1].trim().slice(0, 8) + '***';
139
139
  console.log(` Tim thay credentials tai ${CREDENTIALS_PATH}`);
140
140
  console.log(` API Key: ${maskedKey}\n`);
141
- const reuse = await ask(' Su dung credentials nay? (Y/n): ');
142
- if (reuse.toLowerCase() !== 'n') {
141
+ const replace = await ask('Ban co muon thay the khong? (y/n): ');
142
+ if (replace.toLowerCase() === 'y') {
143
+ overwroteCreds = true;
144
+ }
145
+ else {
143
146
  apiKey = keyMatch[1].trim();
144
147
  apiSecret = secretMatch[1].trim();
145
148
  }
@@ -147,12 +150,16 @@ async function main() {
147
150
  }
148
151
  }
149
152
  if (!apiKey) {
150
- apiKey = await ask(' API Key: ');
153
+ apiKey = overwroteCreds
154
+ ? await ask('Nhap API Key moi: ')
155
+ : await ask('Nhap API Key: ');
151
156
  if (!apiKey) {
152
157
  console.error('\n Loi: API Key khong duoc de trong.\n');
153
158
  process.exit(1);
154
159
  }
155
- apiSecret = await askMasked(' API Secret: ');
160
+ apiSecret = overwroteCreds
161
+ ? await askMasked('Nhap Secret Key moi: ')
162
+ : await askMasked('Nhap Secret Key: ');
156
163
  if (!apiSecret) {
157
164
  console.error('\n Loi: API Secret khong duoc de trong.\n');
158
165
  process.exit(1);
@@ -162,11 +169,14 @@ async function main() {
162
169
  FINHAY_API_SECRET: apiSecret,
163
170
  FINHAY_BASE_URL: 'https://open-api.fhsc.com.vn',
164
171
  });
165
- console.log(`\n Credentials: ${CREDENTIALS_PATH} (permission: 600)\n`);
166
172
  }
167
- updateClaudeConfig();
168
- console.log('\n Da cai dat thanh cong!');
169
- console.log(' Hay khoi dong lai Claude Desktop de su dung.\n');
173
+ const configPath = updateClaudeConfig();
174
+ 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
+ console.log('Hay khoi dong lai ung dung de su dung');
179
+ console.log();
170
180
  }
171
181
  export const run = main().catch((err) => {
172
182
  console.error('Loi:', err.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "finhay-mcp-server",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
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",