moeba-claude-channel 0.0.2 → 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 +21 -7
- 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: {
|
|
@@ -259,7 +266,12 @@ When you receive a message:
|
|
|
259
266
|
3. Send progress updates via moeba_progress while working on longer tasks
|
|
260
267
|
4. Reply using moeba_reply with the connection_id from the message tag
|
|
261
268
|
|
|
262
|
-
|
|
269
|
+
IMPORTANT: The user is on a mobile app and CANNOT approve terminal permissions.
|
|
270
|
+
- Prefer reading files (Read tool) over running commands (Bash) when possible
|
|
271
|
+
- Use Glob, Grep, and Read tools which don't need permission
|
|
272
|
+
- If you must run a command, warn the user it needs terminal approval
|
|
273
|
+
- NEVER get stuck silently — if something needs approval, send a moeba_reply explaining that the action requires terminal approval
|
|
274
|
+
- Keep replies concise — the user is on a small screen`,
|
|
263
275
|
});
|
|
264
276
|
// 3. Register tools
|
|
265
277
|
mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
@@ -346,9 +358,11 @@ Keep replies concise and helpful. The user is chatting from a mobile app.`,
|
|
|
346
358
|
});
|
|
347
359
|
// 4. Connect MCP to Claude Code
|
|
348
360
|
await mcp.connect(new StdioServerTransport());
|
|
349
|
-
// 5. Start SSE listener
|
|
350
|
-
|
|
351
|
-
|
|
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
|
+
}
|
|
352
366
|
}
|
|
353
367
|
main().catch((err) => {
|
|
354
368
|
console.error('Fatal:', err.message);
|