Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ export function serverConnectionError(
} else if (cause.includes('ETIMEDOUT') || cause.includes('timeout')) {
suggestion =
'Connection timed out. Check network connectivity and server availability';
} else if (
cause.includes('already running') ||
cause.includes('profile is locked') ||
cause.includes('Use --isolated')
) {
suggestion =
'This looks like a stateful server reusing a locked profile. Keep daemon mode enabled so mcp-cli can reuse the same server connection, and only use --isolated when you intentionally want a separate fresh instance.';
} else if (cause.includes('401') || cause.includes('Unauthorized')) {
suggestion = 'Authentication required. Add Authorization header to config';
} else if (cause.includes('403') || cause.includes('Forbidden')) {
Expand Down
10 changes: 10 additions & 0 deletions tests/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ describe('errors', () => {
const error = serverConnectionError('remote', '401 Unauthorized');
expect(error.suggestion).toContain('Authorization header');
});

test('serverConnectionError detects stateful server profile lock hints', () => {
const error = serverConnectionError(
'chrome-devtools',
'The browser is already running for /tmp/chrome-profile. Use --isolated to run multiple browser instances.',
);
expect(error.suggestion).toContain('daemon mode');
expect(error.suggestion).toContain('--isolated');
expect(error.suggestion).toContain('same server connection');
});
});

describe('tool errors', () => {
Expand Down