From 4d2668721f7f8ee80ba525ec5c7d15c72ba5a233 Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 20 Nov 2024 14:42:35 +0000 Subject: [PATCH 1/3] Add `inspector` package script --- template/README.md.ejs | 4 ++-- template/package.json.ejs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/template/README.md.ejs b/template/README.md.ejs index ae94532..2de1440 100644 --- a/template/README.md.ejs +++ b/template/README.md.ejs @@ -61,10 +61,10 @@ On Windows: `%APPDATA%/Claude/claude_desktop_config.json` ### Debugging -Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector): +Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector), which is available as a package script: ```bash -npx @modelcontextprotocol/inspector /path/to/<%= name %>/build/index.js +npm run inspector ``` The Inspector will provide a URL to access debugging tools in your browser. diff --git a/template/package.json.ejs b/template/package.json.ejs index 7012902..7bd775d 100644 --- a/template/package.json.ejs +++ b/template/package.json.ejs @@ -13,7 +13,8 @@ "scripts": { "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"", "prepare": "npm run build", - "watch": "tsc --watch" + "watch": "tsc --watch", + "inspector": "npx @modelcontextprotocol/inspector \"$(node -e \"console.log(require('path').join(process.cwd(), 'build/index.js'))\")\"" }, "dependencies": { "@modelcontextprotocol/sdk": "0.6.0" From 73a09c195aaccff4a420c65766754c7d57f1b27f Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 20 Nov 2024 14:42:42 +0000 Subject: [PATCH 2/3] Add shebang to template's index file --- template/src/index.ts.ejs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/src/index.ts.ejs b/template/src/index.ts.ejs index 6eca196..101a553 100644 --- a/template/src/index.ts.ejs +++ b/template/src/index.ts.ejs @@ -1,3 +1,5 @@ +#!/usr/bin/env node + /** * This is a template MCP server that implements a simple notes system. * It demonstrates core MCP concepts like resources and tools by allowing: From 61d72619530dd1a2f257aa8f9b380fab48890ef4 Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 20 Nov 2024 14:44:43 +0000 Subject: [PATCH 3/3] Don't actually need the cwd bits when the shebang works --- template/package.json.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/package.json.ejs b/template/package.json.ejs index 7bd775d..1eb244a 100644 --- a/template/package.json.ejs +++ b/template/package.json.ejs @@ -14,7 +14,7 @@ "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"", "prepare": "npm run build", "watch": "tsc --watch", - "inspector": "npx @modelcontextprotocol/inspector \"$(node -e \"console.log(require('path').join(process.cwd(), 'build/index.js'))\")\"" + "inspector": "npx @modelcontextprotocol/inspector build/index.js" }, "dependencies": { "@modelcontextprotocol/sdk": "0.6.0"