diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e6eff0..c415b54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - E2E tests now run under the Bun runtime (in addition to Node.js); use `./test/e2e/run.sh --runtime bun` or `npm run test:e2e:bun` ### Fixed +- `logging-set-level` JSON output no longer includes a `success` field; output is now `{"level":""}` consistent with the project's convention of indicating errors via exit codes - `--header` / `-H` option is now specific to the `connect` command instead of being shown as a global option in `mcpc --help` +- Bridge now forwards `logging/message` notifications from the MCP server to connected clients, so `logging-set-level` actually takes effect in interactive shell sessions - IPC buffer between CLI and bridge process is now capped at 10 MB; sockets are destroyed if the limit is exceeded, preventing unbounded memory growth - `validateOptions()` no longer includes subcommand-specific options (`--full`, `--x402`, `--proxy`, etc.) in global known-options list; misplaced flags now produce clear "Unknown option" errors instead of confusing Commander rejections - Sessions requiring authentication now correctly show as `expired` instead of `live` when the server rejects unauthenticated connections diff --git a/src/bridge/index.ts b/src/bridge/index.ts index f3e1910..cd97f8d 100644 --- a/src/bridge/index.ts +++ b/src/bridge/index.ts @@ -29,7 +29,12 @@ import { OAuthProvider } from '../lib/auth/oauth-provider.js'; import { storeKeychainOAuthTokenInfo, readKeychainOAuthTokenInfo } from '../lib/auth/keychain.js'; import { updateAuthProfileRefreshedAt } from '../lib/auth/profiles.js'; import { readKeychainProxyBearerToken } from '../lib/auth/keychain.js'; -import type { Tool, Resource, Prompt } from '@modelcontextprotocol/sdk/types.js'; +import { + LoggingMessageNotificationSchema, + type Tool, + type Resource, + type Prompt, +} from '@modelcontextprotocol/sdk/types.js'; import { createRequire } from 'module'; const { version: mcpcVersion } = createRequire(import.meta.url)('../../package.json') as { version: string; @@ -587,6 +592,13 @@ class BridgeProcess { logger.info('Connected to MCP server'); logger.debug('MCP client created successfully, authProvider was:', !!clientConfig.authProvider); + // Forward server logging messages to connected IPC clients + this.client + .getSDKClient() + .setNotificationHandler(LoggingMessageNotificationSchema, (notification) => { + this.broadcastNotification('logging/message', notification.params); + }); + // Update session with protocol version, MCP session ID, and lastSeenAt const serverDetails = await this.client.getServerDetails(); const newMcpSessionId = this.client.getMcpSessionId(); diff --git a/src/cli/commands/logging.ts b/src/cli/commands/logging.ts index 706146d..c21f74f 100644 --- a/src/cli/commands/logging.ts +++ b/src/cli/commands/logging.ts @@ -40,15 +40,7 @@ export async function setLogLevel( if (options.outputMode === 'human') { console.log(formatSuccess(`Server log level set to: ${level}`)); } else { - console.log( - formatOutput( - { - level, - success: true, - }, - 'json' - ) - ); + console.log(formatOutput({ level }, 'json')); } }); }