From 38c7ce34e380e512ab9560f2f4f1c3540c0158fe Mon Sep 17 00:00:00 2001 From: Fanyang Meng Date: Sun, 20 Apr 2025 16:03:11 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Support=20npx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 +++----- package.json | 14 ++++++++++++-- src/server.ts | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 364a651..cb56600 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,9 @@ To use this with MCP clients, for instance, Claude Desktop, add the following to ```json { "mcpServers": { - "ghost-mcp-ts": { - "command": "node", - "args": [ - "ABSOLUTE_PATH_TO_GHOST_MCP_SERVER/build/server.js", - ], + "ghost-mcp": { + "command": "npx", + "args": ["-y", "@fanyangmeng/ghost-mcp"], "env": { "GHOST_API_URL": "https://yourblog.com", "GHOST_ADMIN_API_KEY": "your_admin_api_key", diff --git a/package.json b/package.json index 4425008..e11cc35 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,23 @@ { "name": "@fanyangmeng/ghost-mcp", - "version": "0.0.1", + "version": "0.1.0", "description": "MCP server for using the Ghost API", - "main": "index.js", + "main": "build/server.js", + "bin": { + "ghost-mcp": "build/server.js" + }, + "files": [ + "build/" + ], "scripts": { "build": "tsc", "start": "node build/server.js", + "prepare": "npm run build", "test": "echo \"Error: no test specified\" && exit 1" }, + "publishConfig": { + "access": "public" + }, "keywords": [], "author": "Fanyang Meng (https://mfydev.link)", "license": "ISC", diff --git a/src/server.ts b/src/server.ts index 556d91a..0fc8542 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,3 +1,5 @@ +#!/usr/bin/env node + import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { ghostApiClient } from './ghostApi'; // Import the initialized Ghost API client