initalize logging for cli mode
This commit is contained in:
parent
925d11a91d
commit
f4d9bf6d5e
1 changed files with 6 additions and 0 deletions
|
|
@ -18,6 +18,12 @@ export async function connect(
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await client.connect(transport);
|
await client.connect(transport);
|
||||||
|
|
||||||
|
if (client.getServerCapabilities()?.logging) {
|
||||||
|
// default logging level is undefined in the spec, but the user of the
|
||||||
|
// inspector most likely wants debug.
|
||||||
|
await client.setLoggingLevel("debug");
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Failed to connect to MCP server: ${error instanceof Error ? error.message : String(error)}`,
|
`Failed to connect to MCP server: ${error instanceof Error ? error.message : String(error)}`,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue