From 161b8da3e08790120d264f8c51bf2be08d6363aa Mon Sep 17 00:00:00 2001 From: ihrpr Date: Tue, 8 Apr 2025 16:16:51 +0100 Subject: [PATCH] fix lint and rename --- src/examples/README.md | 4 ++-- ...impleStreamableHttpClient.ts => simpleStreamableHttp.ts} | 0 src/examples/server/simpleStreamableHttp.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/examples/client/{simpleStreamableHttpClient.ts => simpleStreamableHttp.ts} (100%) diff --git a/src/examples/README.md b/src/examples/README.md index 40898578..6e53fdec 100644 --- a/src/examples/README.md +++ b/src/examples/README.md @@ -36,7 +36,7 @@ curl -X POST -H "Content-Type: application/json" -H "Accept: application/json, t http://localhost:3000/mcp ``` -### Client (`client/simpleStreamableHttpClient.ts`) +### Client (`client/simpleStreamableHttp.ts`) A client that connects to the server, initializes it, and demonstrates how to: @@ -47,7 +47,7 @@ A client that connects to the server, initializes it, and demonstrates how to: #### Running the client ```bash -npx tsx src/examples/client/simpleStreamableHttpClient.ts +npx tsx src/examples/client/simpleStreamableHttp.ts ``` Make sure the server is running before starting the client. diff --git a/src/examples/client/simpleStreamableHttpClient.ts b/src/examples/client/simpleStreamableHttp.ts similarity index 100% rename from src/examples/client/simpleStreamableHttpClient.ts rename to src/examples/client/simpleStreamableHttp.ts diff --git a/src/examples/server/simpleStreamableHttp.ts b/src/examples/server/simpleStreamableHttp.ts index 8db0e236..e6ebe4b9 100644 --- a/src/examples/server/simpleStreamableHttp.ts +++ b/src/examples/server/simpleStreamableHttp.ts @@ -135,11 +135,11 @@ app.post('/mcp', async (req: Request, res: Response) => { }); // Helper function to detect initialize requests -function isInitializeRequest(body: any): boolean { +function isInitializeRequest(body: unknown): boolean { if (Array.isArray(body)) { - return body.some(msg => msg.method === 'initialize'); + return body.some(msg => typeof msg === 'object' && msg !== null && 'method' in msg && msg.method === 'initialize'); } - return body.method === 'initialize'; + return typeof body === 'object' && body !== null && 'method' in body && body.method === 'initialize'; } // Start the server