moeba-claude-channel 0.0.3 → 0.0.4
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/moeba-channel.js +15 -6
- package/package.json +1 -1
package/dist/moeba-channel.js
CHANGED
|
@@ -237,13 +237,20 @@ function connectSSE(c, mcp) {
|
|
|
237
237
|
// Main — authenticate first, then connect MCP
|
|
238
238
|
// ---------------------------------------------------------------------------
|
|
239
239
|
async function main() {
|
|
240
|
-
// 1.
|
|
240
|
+
// 1. Load cached credentials — never open browser automatically
|
|
241
|
+
// User must run `npx moeba-claude-channel --login` to authenticate new projects
|
|
242
|
+
const loginMode = process.argv.includes('--login');
|
|
241
243
|
let creds = loadCredentials();
|
|
242
|
-
if (!creds) {
|
|
244
|
+
if (!creds && loginMode) {
|
|
243
245
|
console.error('No Moeba credentials found — opening browser to sign in...');
|
|
244
246
|
creds = await authenticate();
|
|
245
247
|
}
|
|
246
|
-
|
|
248
|
+
if (creds) {
|
|
249
|
+
console.error(`Authenticated as ${creds.email} (project: ${PROJECT_NAME})`);
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
console.error(`Moeba channel: no credentials for project "${PROJECT_NAME}" — run with --login to authenticate`);
|
|
253
|
+
}
|
|
247
254
|
// 2. Create MCP channel server
|
|
248
255
|
const mcp = new Server({ name: 'moeba', version: '0.0.1' }, {
|
|
249
256
|
capabilities: {
|
|
@@ -351,9 +358,11 @@ IMPORTANT: The user is on a mobile app and CANNOT approve terminal permissions.
|
|
|
351
358
|
});
|
|
352
359
|
// 4. Connect MCP to Claude Code
|
|
353
360
|
await mcp.connect(new StdioServerTransport());
|
|
354
|
-
// 5. Start SSE listener
|
|
355
|
-
|
|
356
|
-
|
|
361
|
+
// 5. Start SSE listener (only if authenticated)
|
|
362
|
+
if (creds) {
|
|
363
|
+
connectSSE(creds, mcp);
|
|
364
|
+
console.error('Moeba channel ready — waiting for messages');
|
|
365
|
+
}
|
|
357
366
|
}
|
|
358
367
|
main().catch((err) => {
|
|
359
368
|
console.error('Fatal:', err.message);
|