fastmcp 1.19.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/jsr.json +1 -1
- package/package.json +4 -4
- package/src/FastMCP.test.ts +56 -0
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ A TypeScript framework for building [MCP](https://modelcontextprotocol.io/) serv
|
|
|
14
14
|
- [Logging](#logging)
|
|
15
15
|
- [Error handling](#errors)
|
|
16
16
|
- [SSE](#sse)
|
|
17
|
+
- CORS (enabled by default)
|
|
17
18
|
- [Progress notifications](#progress)
|
|
18
19
|
- [Typed server events](#typed-server-events)
|
|
19
20
|
- [Prompt argument auto-completion](#prompt-argument-auto-completion)
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fastmcp",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"main": "dist/FastMCP.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@modelcontextprotocol/sdk": "^1.6.0",
|
|
25
25
|
"execa": "^9.5.2",
|
|
26
|
-
"file-type": "^20.
|
|
26
|
+
"file-type": "^20.3.0",
|
|
27
27
|
"fuse.js": "^7.1.0",
|
|
28
28
|
"mcp-proxy": "^2.5.0",
|
|
29
29
|
"strict-event-emitter-types": "^2.0.0",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"jsr": "^0.13.3",
|
|
60
60
|
"prettier": "^3.5.2",
|
|
61
61
|
"semantic-release": "^24.2.3",
|
|
62
|
-
"tsup": "^8.
|
|
62
|
+
"tsup": "^8.4.0",
|
|
63
63
|
"typescript": "^5.7.3",
|
|
64
|
-
"vitest": "^3.0.
|
|
64
|
+
"vitest": "^3.0.7"
|
|
65
65
|
},
|
|
66
66
|
"tsup": {
|
|
67
67
|
"entry": [
|
package/src/FastMCP.test.ts
CHANGED
|
@@ -1313,3 +1313,59 @@ test("throws ErrorCode.InvalidParams if tool parameters do not match zod schema"
|
|
|
1313
1313
|
},
|
|
1314
1314
|
});
|
|
1315
1315
|
});
|
|
1316
|
+
|
|
1317
|
+
test("server remains usable after InvalidParams error", async () => {
|
|
1318
|
+
await runWithTestServer({
|
|
1319
|
+
server: async () => {
|
|
1320
|
+
const server = new FastMCP({
|
|
1321
|
+
name: "Test",
|
|
1322
|
+
version: "1.0.0",
|
|
1323
|
+
});
|
|
1324
|
+
|
|
1325
|
+
server.addTool({
|
|
1326
|
+
name: "add",
|
|
1327
|
+
description: "Add two numbers",
|
|
1328
|
+
parameters: z.object({
|
|
1329
|
+
a: z.number(),
|
|
1330
|
+
b: z.number(),
|
|
1331
|
+
}),
|
|
1332
|
+
execute: async (args) => {
|
|
1333
|
+
return String(args.a + args.b);
|
|
1334
|
+
},
|
|
1335
|
+
});
|
|
1336
|
+
|
|
1337
|
+
return server;
|
|
1338
|
+
},
|
|
1339
|
+
run: async ({ client }) => {
|
|
1340
|
+
try {
|
|
1341
|
+
await client.callTool({
|
|
1342
|
+
name: "add",
|
|
1343
|
+
arguments: {
|
|
1344
|
+
a: 1,
|
|
1345
|
+
b: "invalid",
|
|
1346
|
+
},
|
|
1347
|
+
});
|
|
1348
|
+
} catch (error) {
|
|
1349
|
+
expect(error).toBeInstanceOf(McpError);
|
|
1350
|
+
|
|
1351
|
+
// @ts-expect-error - we know that error is an McpError
|
|
1352
|
+
expect(error.code).toBe(ErrorCode.InvalidParams);
|
|
1353
|
+
|
|
1354
|
+
// @ts-expect-error - we know that error is an McpError
|
|
1355
|
+
expect(error.message).toBe("MCP error -32602: MCP error -32602: Invalid add parameters");
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
expect(
|
|
1359
|
+
await client.callTool({
|
|
1360
|
+
name: "add",
|
|
1361
|
+
arguments: {
|
|
1362
|
+
a: 1,
|
|
1363
|
+
b: 2,
|
|
1364
|
+
},
|
|
1365
|
+
}),
|
|
1366
|
+
).toEqual({
|
|
1367
|
+
content: [{ type: "text", text: "3" }],
|
|
1368
|
+
});
|
|
1369
|
+
},
|
|
1370
|
+
});
|
|
1371
|
+
});
|