Skip to content
Merged
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
10 changes: 7 additions & 3 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,15 @@ export class MCPClient {
const initializeResponse = await this.sendRequest(initializeRequest);

if (isJSONRPCError(initializeResponse)) {
throw new Error(`Initialization failed: ${initializeResponse.error.message}`);
throw new Error(
`Initialization failed: ${initializeResponse.error.message}`
);
}

// 2. Send notifications/initialized message (notification - no response expected)
const initializedNotification = newJSONRPCRequest({
id: this.requestId,
method: "notifications/initialized"
method: "notifications/initialized",
});
this.sendNotification(initializedNotification);

Expand Down Expand Up @@ -281,7 +283,9 @@ export class MCPClient {
return new Promise((resolve, reject) => {
// Add request to pending map before sending
this.pendingRequests.set(request.id, { resolve, reject });
this.logger.debug(`sendRequest: ${JSON.stringify(request)} with id ${request.id}`);
this.logger.debug(
`sendRequest: ${JSON.stringify(request)} with id ${request.id}`
);

this.transport?.send(request).catch((err) => {
this.pendingRequests.delete(request.id);
Expand Down
2 changes: 1 addition & 1 deletion src/transport/httpclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class HTTPClientTransport implements Transport {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}

// Capture session ID from response headers if present
// Capture session ID from response headers if present
// (https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#session-management)
const responseSessionId = response.headers.get("Mcp-Session-Id");
if (responseSessionId && !this.sessionId) {
Expand Down
Loading