langchain-mcp 1.0.1 → 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.
Files changed (2) hide show
  1. package/dist/bin/cli.js +60 -14
  2. package/package.json +1 -1
package/dist/bin/cli.js CHANGED
@@ -6,6 +6,24 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
6
6
  import { loadConfig, saveConfig, deleteConfig, getConfigPath, DEFAULT_API_URL } from '../src/config.js';
7
7
  import { APIClient } from '../src/api-client.js';
8
8
  import { createServer } from '../src/server.js';
9
+ // ASCII Art Banner
10
+ const BANNER = `
11
+ _ _ _ __ __ ____ ____
12
+ | | __ _ _ __ __ _ ___| |__ __ _(_)_ __ | \\/ |/ ___| _ \\
13
+ | | / _\` | '_ \\ / _\` |/ __| '_ \\ / _\` | | '_ \\ _____| |\\/| | | | |_) |
14
+ | |__| (_| | | | | (_| | (__| | | | (_| | | | | |_____| | | | |___| __/
15
+ |_____\\__,_|_| |_|\\__, |\\___|_| |_|\\__,_|_|_| |_| |_| |_|\\____|_|
16
+ |___/
17
+ `;
18
+ function printBanner() {
19
+ console.log('\x1b[36m' + BANNER + '\x1b[0m'); // Cyan color
20
+ }
21
+ function printDivider(char = '─', length = 70) {
22
+ console.log('\x1b[90m' + char.repeat(length) + '\x1b[0m');
23
+ }
24
+ function printSection(title) {
25
+ console.log(`\n\x1b[1m\x1b[33m${title}\x1b[0m`); // Bold yellow
26
+ }
9
27
  const program = new Command();
10
28
  program
11
29
  .name('langchain-mcp')
@@ -82,9 +100,20 @@ async function loginWithWebFlow(apiUrl, provider, openBrowser) {
82
100
  api_url: apiUrl,
83
101
  user,
84
102
  });
85
- console.log(`\n✅ Logged in as ${user.email}`);
86
- console.log(`💰 Credits: $${user.credits.toFixed(2)} remaining`);
87
- console.log(`📁 Config saved to ${getConfigPath()}`);
103
+ printBanner();
104
+ printDivider();
105
+ console.log('\n \x1b[32m✓ Login Successful!\x1b[0m\n');
106
+ printSection('👤 User');
107
+ console.log(` Name: ${user.name || 'N/A'}`);
108
+ console.log(` Email: ${user.email}`);
109
+ printSection('💰 Credits');
110
+ const creditColor = user.credits > 5 ? '\x1b[32m' : user.credits > 1 ? '\x1b[33m' : '\x1b[31m';
111
+ console.log(` Remaining: ${creditColor}$${user.credits.toFixed(2)}\x1b[0m`);
112
+ printSection('⚙️ Config');
113
+ console.log(` Saved to: ${getConfigPath()}`);
114
+ console.log('');
115
+ printDivider();
116
+ console.log('');
88
117
  res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
89
118
  res.end(`
90
119
  <!DOCTYPE html>
@@ -160,26 +189,43 @@ program
160
189
  .description('Show current login status and usage')
161
190
  .action(async () => {
162
191
  const config = loadConfig();
192
+ printBanner();
193
+ printDivider();
163
194
  if (!config) {
164
- console.log(' Not logged in.');
165
- console.log('Run "langchain-mcp login" to log in.');
195
+ console.log('\n \x1b[31m✗ Not logged in\x1b[0m');
196
+ console.log(' Run \x1b[36mlangchain-mcp login\x1b[0m to get started.\n');
166
197
  return;
167
198
  }
168
- console.log(`👤 Logged in as: ${config.user?.email || 'Unknown'}`);
169
- console.log(`📁 Config: ${getConfigPath()}`);
199
+ // User Info Section
200
+ printSection('👤 User');
201
+ console.log(` Name: ${config.user?.name || 'N/A'}`);
202
+ console.log(` Email: ${config.user?.email || 'Unknown'}`);
203
+ console.log(` ID: ${config.user?.id || 'N/A'}`);
170
204
  try {
171
205
  const client = new APIClient(config.api_url, config.api_key);
172
206
  const usage = await client.getUsage();
173
- console.log(`\n💰 Credits: $${usage.credits.remaining.toFixed(2)} remaining`);
174
- console.log(`\n📊 Usage:`);
175
- console.log(` Today: ${usage.usage.today.tokens.toLocaleString()} tokens (${usage.usage.today.requests} requests)`);
176
- console.log(` This month: ${usage.usage.this_month.tokens.toLocaleString()} tokens (${usage.usage.this_month.requests} requests)`);
177
- console.log(` All time: ${usage.usage.all_time.tokens.toLocaleString()} tokens (${usage.usage.all_time.requests} requests)`);
207
+ // Credits Section
208
+ printSection('💰 Credits');
209
+ const remaining = usage.credits.remaining;
210
+ const creditColor = remaining > 5 ? '\x1b[32m' : remaining > 1 ? '\x1b[33m' : '\x1b[31m';
211
+ console.log(` Remaining: ${creditColor}$${remaining.toFixed(2)}\x1b[0m`);
212
+ // Token Usage Section
213
+ printSection('📊 Token Usage');
214
+ console.log(` Today: ${usage.usage.today.tokens.toLocaleString().padStart(12)} tokens (${usage.usage.today.requests} requests)`);
215
+ console.log(` This Month: ${usage.usage.this_month.tokens.toLocaleString().padStart(12)} tokens (${usage.usage.this_month.requests} requests)`);
216
+ console.log(` All Time: ${usage.usage.all_time.tokens.toLocaleString().padStart(12)} tokens (${usage.usage.all_time.requests} requests)`);
217
+ // Config Section
218
+ printSection('⚙️ Config');
219
+ console.log(` Path: ${getConfigPath()}`);
220
+ console.log(` API: ${config.api_url}`);
178
221
  }
179
222
  catch (error) {
180
- console.log(`\n⚠️ Could not fetch usage: ${error.message}`);
181
- console.log('Your API key may be invalid. Run "langchain-mcp login" to log in again.');
223
+ console.log(`\n \x1b[33m⚠️ Could not fetch usage: ${error.message}\x1b[0m`);
224
+ console.log(' Your API key may be invalid. Run \x1b[36mlangchain-mcp login\x1b[0m again.');
182
225
  }
226
+ console.log('');
227
+ printDivider();
228
+ console.log('');
183
229
  });
184
230
  /**
185
231
  * Logout command - remove local credentials
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langchain-mcp",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "MCP server for LangChain documentation and code search",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",