Skip to content

Commit b68c234

Browse files
authored
feat(stdio): add standalone stdio entry point for Claude Desktop (#7)
* feat(smithery): add Smithery compatibility and npm publishing setup - Refactor src/index.ts to use Smithery-compatible McpServer format with configSchema - Add zod dependency for configuration validation - Create smithery.yaml for TypeScript runtime deployment - Add .npmignore to exclude development files from npm package - Update package.json with repository metadata and enhanced keywords - Maintain all 13 Namecheap API tools with proper Zod schemas - Ready for both npm publish and Smithery deployment * chore(deps): update dependencies to fix security vulnerabilities Fixes the following vulnerabilities: - axios: DoS attack (high) - updated to 1.13.4 - form-data: unsafe random function (critical) - updated to 4.0.5 - js-yaml: prototype pollution (moderate) - updated to 4.1.1 - qs: memory exhaustion DoS (high) - updated to 6.14.1 - @eslint/plugin-kit: ReDoS (low) - updated to 0.3.5 - body-parser: DoS (moderate) - updated to 2.2.2 Note: @modelcontextprotocol/sdk vulnerability (high) remains unfixed. The SDK update to 1.25.3 introduces breaking TypeScript type changes that require code modifications to resolve. This should be addressed in a separate PR with proper type fixes. * feat(stdio): add standalone stdio entry point for Claude Desktop index.ts exports a Smithery factory function that never starts a server. Claude Desktop needs a process that connects stdio transport and stays alive. Add src/stdio.ts as the standalone entry point and update start script to use it. * fix(lint): remove unnecessary @ts-nocheck from stdio.ts
1 parent 120f95e commit b68c234

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"scripts": {
99
"build": "tsc",
1010
"dev": "tsx watch src/index.ts",
11-
"start": "node --no-warnings dist/index.js",
11+
"start": "node --no-warnings dist/stdio.js",
1212
"lint": "eslint src --ext .ts",
1313
"lint:fix": "eslint src --ext .ts --fix",
1414
"test": "echo \"No tests yet\" && exit 0",

src/stdio.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env node
2+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3+
import * as dotenv from "dotenv";
4+
import * as path from "path";
5+
import createServer from "./index.js";
6+
7+
// Load .env from the project root
8+
dotenv.config({ path: path.resolve(__dirname, "..", ".env") });
9+
10+
const config = {
11+
NAMECHEAP_API_KEY: process.env.NAMECHEAP_API_KEY || "",
12+
NAMECHEAP_API_USER: process.env.NAMECHEAP_API_USER || "",
13+
NAMECHEAP_CLIENT_IP: process.env.NAMECHEAP_CLIENT_IP || "",
14+
NAMECHEAP_USE_SANDBOX: process.env.NAMECHEAP_USE_SANDBOX === "true",
15+
};
16+
17+
if (!config.NAMECHEAP_API_KEY || !config.NAMECHEAP_API_USER || !config.NAMECHEAP_CLIENT_IP) {
18+
console.error("Missing required environment variables: NAMECHEAP_API_KEY, NAMECHEAP_API_USER, NAMECHEAP_CLIENT_IP");
19+
process.exit(1);
20+
}
21+
22+
const server = createServer({ config });
23+
24+
async function main() {
25+
const transport = new StdioServerTransport();
26+
await server.connect(transport);
27+
}
28+
29+
main().catch((error) => {
30+
console.error("Fatal error:", error);
31+
process.exit(1);
32+
});

0 commit comments

Comments
 (0)