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
3 changes: 3 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const config: Config = {
clearMocks: true,
coverageProvider: "v8",
testEnvironment: "node",
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
transform: {
"^.+.tsx?$": ["ts-jest", {}],
},
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "fastify-mcp",
"version": "2.1.0",
"type": "module",
"packageManager": "yarn@4.7.0",
"author": {
"name": "Kshitij Chauhan",
Expand All @@ -17,14 +18,18 @@
"ai",
"anthropic"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"files": [
"dist"
],
"scripts": {
"lint": "eslint .",
"test": "jest",
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
"build": "tsc",
"format": "prettier --write .",
"format:check": "prettier --check ."
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { fastifyMCPSSE } from "./mcp-sse-plugin";
export { Sessions } from "./session-storage";
export { streamableHttp } from "./streamable-http";
export { fastifyMCPSSE } from "./mcp-sse-plugin.js";
export { Sessions } from "./session-storage.js";
export { streamableHttp } from "./streamable-http.js";
4 changes: 2 additions & 2 deletions src/mcp-sse-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
import { FastifyPluginCallback, FastifyRequest } from "fastify";
import { Sessions } from "./session-storage";
import { Sessions } from "./session-storage.js";

type MCPSSEPluginOptions = {
server: Server;
Expand Down Expand Up @@ -39,7 +39,7 @@ export const fastifyMCPSSE: FastifyPluginCallback<MCPSSEPluginOptions> = (
sessions.remove(sessionId);
});

fastify.log.info("Starting new session", { sessionId });
fastify.log.info({ sessionId }, "Starting new session");
await server.connect(transport);
});

Expand Down
1 change: 1 addition & 0 deletions src/session-storage.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { jest } from "@jest/globals";
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
import { Sessions } from "./session-storage";
import { setTimeout } from "node:timers/promises";
Expand Down
2 changes: 1 addition & 1 deletion src/session-storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport";
import type { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
import { EventEmitter } from "node:events";

type SessionEvents = {
Expand Down
2 changes: 1 addition & 1 deletion src/streamable-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
import { FastifyPluginAsync, FastifyReply } from "fastify";
import { randomUUID } from "node:crypto";
import { Sessions } from "./session-storage";
import { Sessions } from "./session-storage.js";

type StreamableHttpPluginOptions =
| StatefulStreamableHttpPluginOptions
Expand Down
5 changes: 2 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"compilerOptions": {
"target": "es2016",
"module": "commonjs",
"esModuleInterop": true,
"target": "es2022",
"module": "nodenext",
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
Expand Down
Loading