fastmcp 1.5.6 → 1.5.8

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 CHANGED
@@ -53,7 +53,12 @@ server.start({
53
53
  You can test the server in terminal with:
54
54
 
55
55
  ```bash
56
- npx fastmcp dev server.js
56
+ git clone https://github.com/punkpeye/fastmcp.git
57
+ cd fastmcp
58
+ # Test the addition server example using CLI:
59
+ npx fastmcp dev src/examples/addition.ts
60
+ # Test the additition server example using MCP Inspector:
61
+ npx fastmcp inspect src/examples/additition.ts
57
62
  ```
58
63
 
59
64
  ### SSE
@@ -15,12 +15,11 @@ await yargs(hideBin(process.argv)).scriptName("fastmcp").command(
15
15
  });
16
16
  },
17
17
  async (argv) => {
18
- const command = argv.file.endsWith(".ts") ? ["npx", "tsx", argv.file] : ["node", argv.file];
19
18
  await $({
20
19
  stdin: "inherit",
21
20
  stdout: "inherit",
22
21
  stderr: "inherit"
23
- })`npx @wong2/mcp-cli ${command}`;
22
+ })`npx @wong2/mcp-cli npx tsx ${argv.file}`;
24
23
  }
25
24
  ).command(
26
25
  "inspect <file>",
@@ -36,7 +35,7 @@ await yargs(hideBin(process.argv)).scriptName("fastmcp").command(
36
35
  await $({
37
36
  stdout: "inherit",
38
37
  stderr: "inherit"
39
- })`npx @modelcontextprotocol/inspector node ${argv.file}`;
38
+ })`npx @modelcontextprotocol/inspector npx tsx ${argv.file}`;
40
39
  }
41
40
  ).help().parseAsync();
42
41
  //# sourceMappingURL=fastmcp.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bin/fastmcp.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { $ } from \"execa\";\n\nawait yargs(hideBin(process.argv))\n .scriptName(\"fastmcp\")\n .command(\n \"dev <file>\",\n \"Start a development server\",\n (yargs) => {\n return yargs.positional(\"file\", {\n type: \"string\",\n describe: \"The path to the server file\",\n demandOption: true,\n });\n },\n async (argv) => {\n const command = argv.file.endsWith(\".ts\")\n ? [\"npx\", \"tsx\", argv.file]\n : [\"node\", argv.file];\n\n await $({\n stdin: \"inherit\",\n stdout: \"inherit\",\n stderr: \"inherit\",\n })`npx @wong2/mcp-cli ${command}`;\n },\n )\n .command(\n \"inspect <file>\",\n \"Inspect a server file\",\n (yargs) => {\n return yargs.positional(\"file\", {\n type: \"string\",\n describe: \"The path to the server file\",\n demandOption: true,\n });\n },\n async (argv) => {\n await $({\n stdout: \"inherit\",\n stderr: \"inherit\",\n })`npx @modelcontextprotocol/inspector node ${argv.file}`;\n },\n )\n .help()\n .parseAsync();\n"],"mappings":";;;AAEA,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,SAAS,SAAS;AAElB,MAAM,MAAM,QAAQ,QAAQ,IAAI,CAAC,EAC9B,WAAW,SAAS,EACpB;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAACA,WAAU;AACT,WAAOA,OAAM,WAAW,QAAQ;AAAA,MAC9B,MAAM;AAAA,MACN,UAAU;AAAA,MACV,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EACA,OAAO,SAAS;AACd,UAAM,UAAU,KAAK,KAAK,SAAS,KAAK,IACpC,CAAC,OAAO,OAAO,KAAK,IAAI,IACxB,CAAC,QAAQ,KAAK,IAAI;AAEtB,UAAM,EAAE;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV,CAAC,uBAAuB,OAAO;AAAA,EACjC;AACF,EACC;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAACA,WAAU;AACT,WAAOA,OAAM,WAAW,QAAQ;AAAA,MAC9B,MAAM;AAAA,MACN,UAAU;AAAA,MACV,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EACA,OAAO,SAAS;AACd,UAAM,EAAE;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV,CAAC,6CAA6C,KAAK,IAAI;AAAA,EACzD;AACF,EACC,KAAK,EACL,WAAW;","names":["yargs"]}
1
+ {"version":3,"sources":["../../src/bin/fastmcp.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { $ } from \"execa\";\n\nawait yargs(hideBin(process.argv))\n .scriptName(\"fastmcp\")\n .command(\n \"dev <file>\",\n \"Start a development server\",\n (yargs) => {\n return yargs.positional(\"file\", {\n type: \"string\",\n describe: \"The path to the server file\",\n demandOption: true,\n });\n },\n async (argv) => {\n await $({\n stdin: \"inherit\",\n stdout: \"inherit\",\n stderr: \"inherit\",\n })`npx @wong2/mcp-cli npx tsx ${argv.file}`;\n },\n )\n .command(\n \"inspect <file>\",\n \"Inspect a server file\",\n (yargs) => {\n return yargs.positional(\"file\", {\n type: \"string\",\n describe: \"The path to the server file\",\n demandOption: true,\n });\n },\n async (argv) => {\n await $({\n stdout: \"inherit\",\n stderr: \"inherit\",\n })`npx @modelcontextprotocol/inspector npx tsx ${argv.file}`;\n },\n )\n .help()\n .parseAsync();\n"],"mappings":";;;AAEA,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,SAAS,SAAS;AAElB,MAAM,MAAM,QAAQ,QAAQ,IAAI,CAAC,EAC9B,WAAW,SAAS,EACpB;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAACA,WAAU;AACT,WAAOA,OAAM,WAAW,QAAQ;AAAA,MAC9B,MAAM;AAAA,MACN,UAAU;AAAA,MACV,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EACA,OAAO,SAAS;AACd,UAAM,EAAE;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV,CAAC,+BAA+B,KAAK,IAAI;AAAA,EAC3C;AACF,EACC;AAAA,EACC;AAAA,EACA;AAAA,EACA,CAACA,WAAU;AACT,WAAOA,OAAM,WAAW,QAAQ;AAAA,MAC9B,MAAM;AAAA,MACN,UAAU;AAAA,MACV,cAAc;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EACA,OAAO,SAAS;AACd,UAAM,EAAE;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV,CAAC,gDAAgD,KAAK,IAAI;AAAA,EAC5D;AACF,EACC,KAAK,EACL,WAAW;","names":["yargs"]}
package/jsr.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glama/fastmcp",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "exports": "./src/FastMCP.ts",
5
5
  "include": ["src/FastMCP.ts", "src/bin/fastmcp.ts"]
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastmcp",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "main": "dist/FastMCP.js",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -17,15 +17,11 @@ await yargs(hideBin(process.argv))
17
17
  });
18
18
  },
19
19
  async (argv) => {
20
- const command = argv.file.endsWith(".ts")
21
- ? ["npx", "tsx", argv.file]
22
- : ["node", argv.file];
23
-
24
20
  await $({
25
21
  stdin: "inherit",
26
22
  stdout: "inherit",
27
23
  stderr: "inherit",
28
- })`npx @wong2/mcp-cli ${command}`;
24
+ })`npx @wong2/mcp-cli npx tsx ${argv.file}`;
29
25
  },
30
26
  )
31
27
  .command(
@@ -42,7 +38,7 @@ await yargs(hideBin(process.argv))
42
38
  await $({
43
39
  stdout: "inherit",
44
40
  stderr: "inherit",
45
- })`npx @modelcontextprotocol/inspector node ${argv.file}`;
41
+ })`npx @modelcontextprotocol/inspector npx tsx ${argv.file}`;
46
42
  },
47
43
  )
48
44
  .help()
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This is a complete example of an MCP server.
3
+ */
4
+ import { FastMCP } from "../FastMCP.js";
5
+ import { z } from "zod";
6
+
7
+ const server = new FastMCP({
8
+ name: "Addition",
9
+ version: "1.0.0",
10
+ });
11
+
12
+ server.addTool({
13
+ name: "add",
14
+ description: "Add two numbers",
15
+ parameters: z.object({
16
+ a: z.number(),
17
+ b: z.number(),
18
+ }),
19
+ execute: async (args) => {
20
+ return String(args.a + args.b);
21
+ },
22
+ });
23
+
24
+ server.start({
25
+ transportType: "stdio",
26
+ });