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
25 changes: 25 additions & 0 deletions cli/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,31 @@ describe("CLI Tests", () => {

expectCliFailure(result);
});

it("should reject non-spec log levels trace and warn", async () => {
const { command, args } = getTestMcpServerCommand();
const resultTrace = await runCli([
command,
...args,
"--cli",
"--method",
"logging/setLevel",
"--log-level",
"trace",
]);
expectCliFailure(resultTrace);

const resultWarn = await runCli([
command,
...args,
"--cli",
"--method",
"logging/setLevel",
"--log-level",
"warn",
]);
expectCliFailure(resultWarn);
});
});

describe("Combined Options", () => {
Expand Down
7 changes: 5 additions & 2 deletions cli/src/client/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
import { McpResponse } from "./types.js";

export const validLogLevels = [
"trace",
"debug",
"info",
"warn",
"notice",
"warning",
"error",
"critical",
"alert",
"emergency",
] as const;

export type LogLevel = (typeof validLogLevels)[number];
Expand Down