connect-mcp 0.1.0

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 ADDED
@@ -0,0 +1,8 @@
1
+ # MCP Connect
2
+
3
+ One-click MCP integration tool.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npx mcp-connect claude --url=https://your-mcp-server.com
@@ -0,0 +1,40 @@
1
+ const getClaudePath = require("../utils/getClaudePath");
2
+ const readConfig = require("../utils/readConfig");
3
+ const writeConfig = require("../utils/writeConfig");
4
+ const logger = require("../utils/logger");
5
+
6
+ async function setupClaude(url) {
7
+ try {
8
+ const configPath = getClaudePath();
9
+ console.log("📁 Claude config path:", configPath);
10
+
11
+ let config = await readConfig(configPath);
12
+
13
+ if (!config.mcpServers) {
14
+ config.mcpServers = {};
15
+ }
16
+
17
+ // Generate clean server name
18
+ const serverName = new URL(url).hostname.replace(/\./g, "-");
19
+
20
+ if (config.mcpServers[serverName]) {
21
+ logger.warn("Server already exists. Updating...");
22
+ }
23
+
24
+ // ✅ NEW FORMAT (IMPORTANT)
25
+ config.mcpServers[serverName] = {
26
+ command: "npx",
27
+ args: ["mcp-remote", url]
28
+ };
29
+
30
+ await writeConfig(configPath, config);
31
+
32
+ logger.success("MCP server added to Claude Desktop!");
33
+ logger.info("Restart Claude Desktop to apply changes.");
34
+
35
+ } catch (err) {
36
+ logger.error(err.message);
37
+ }
38
+ }
39
+
40
+ module.exports = setupClaude;
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ DEFAULT_SERVER_NAME: "custom-mcp",
3
+ TYPE: "http"
4
+ };
package/index.js ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require("commander");
4
+ const setupClaude = require("./commands/claude");
5
+ const inquirer = require("inquirer");
6
+
7
+ const program = new Command();
8
+
9
+ program
10
+ .name("connect-mcp")
11
+ .description("One-click MCP integration tool")
12
+ .version("1.0.0");
13
+
14
+ // ✅ GLOBAL OPTION ONLY
15
+ program.option("--url <url>", "MCP server URL");
16
+
17
+ // ✅ COMMAND: Claude (NO requiredOption here)
18
+ program
19
+ .command("claude")
20
+ .description("Connect MCP to Claude Desktop")
21
+ .action(async () => {
22
+ const globalOptions = program.opts();
23
+
24
+ if (!globalOptions.url) {
25
+ console.error("❌ Error: --url is required");
26
+ process.exit(1);
27
+ }
28
+
29
+ await setupClaude(globalOptions.url);
30
+ });
31
+
32
+ // ✅ INTERACTIVE MODE
33
+ async function interactiveMode() {
34
+ const answers = await inquirer.prompt([
35
+ {
36
+ type: "input",
37
+ name: "url",
38
+ message: "Enter MCP server URL:",
39
+ validate: (input) => {
40
+ try {
41
+ new URL(input);
42
+ return true;
43
+ } catch {
44
+ return "Please enter a valid URL";
45
+ }
46
+ },
47
+ },
48
+ {
49
+ type: "list",
50
+ name: "platform",
51
+ message: "Select platform:",
52
+ choices: [
53
+ { name: "Claude Desktop", value: "claude" },
54
+ { name: "Cursor (coming soon)", value: "cursor", disabled: true },
55
+ { name: "VS Code (coming soon)", value: "vscode", disabled: true },
56
+ ],
57
+ },
58
+ ]);
59
+
60
+ if (answers.platform === "claude") {
61
+ await setupClaude(answers.url);
62
+ }
63
+ }
64
+
65
+ // ✅ MAIN
66
+ async function main() {
67
+ const args = process.argv.slice(2);
68
+
69
+ // No args → interactive
70
+ if (args.length === 0) {
71
+ return interactiveMode();
72
+ }
73
+
74
+ program.parse(process.argv);
75
+
76
+ const options = program.opts();
77
+
78
+ // Only --url → default to Claude
79
+ if (options.url && !args.includes("claude")) {
80
+ return setupClaude(options.url);
81
+ }
82
+ }
83
+
84
+ main();
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "connect-mcp",
3
+ "version": "0.1.0",
4
+ "description": "One-click MCP integration CLI for Claude Desktop and more",
5
+ "main": "index.js",
6
+ "type": "commonjs",
7
+
8
+ "bin": {
9
+ "connect-mcp": "./index.js"
10
+ },
11
+
12
+ "scripts": {
13
+ "start": "node index.js"
14
+ },
15
+
16
+ "keywords": [
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "ai",
20
+ "cli",
21
+ "claude",
22
+ "integration",
23
+ "llm",
24
+ "tools"
25
+ ],
26
+
27
+ "author": "ZenithX",
28
+ "license": "MIT",
29
+
30
+ "preferGlobal": true,
31
+
32
+ "engines": {
33
+ "node": ">=16"
34
+ },
35
+
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/theprathameshpund/connect-mcp.git"
39
+ },
40
+
41
+ "bugs": {
42
+ "url": "https://github.com/theprathameshpund/connect-mcp/issues"
43
+ },
44
+
45
+ "homepage": "https://github.com/theprathameshpund/connect-mcp#readme",
46
+
47
+ "dependencies": {
48
+ "commander": "^11.0.0",
49
+ "fs-extra": "^11.2.0",
50
+ "inquirer": "^8.2.7"
51
+ }
52
+ }
@@ -0,0 +1,65 @@
1
+ const os = require("os");
2
+ const path = require("path");
3
+ const fs = require("fs-extra");
4
+
5
+ function getClaudePath() {
6
+ const home = os.homedir();
7
+ const platform = os.platform();
8
+
9
+ // đŸĒŸ WINDOWS
10
+ if (platform === "win32") {
11
+ const appData = process.env.APPDATA;
12
+
13
+ // 1. Try UWP path (Windows Store version)
14
+ const localAppData = process.env.LOCALAPPDATA;
15
+
16
+ if (localAppData) {
17
+ const packagesPath = path.join(localAppData, "Packages");
18
+
19
+ if (fs.existsSync(packagesPath)) {
20
+ const dirs = fs.readdirSync(packagesPath);
21
+
22
+ const claudeDir = dirs.find((dir) =>
23
+ dir.toLowerCase().includes("claude")
24
+ );
25
+
26
+ if (claudeDir) {
27
+ const uwpPath = path.join(
28
+ packagesPath,
29
+ claudeDir,
30
+ "LocalCache",
31
+ "Roaming",
32
+ "Claude",
33
+ "claude_desktop_config.json"
34
+ );
35
+
36
+ return uwpPath;
37
+ }
38
+ }
39
+ }
40
+
41
+ // 2. Fallback to normal path
42
+ return path.join(appData, "Claude", "claude_desktop_config.json");
43
+ }
44
+
45
+ // 🍎 macOS
46
+ if (platform === "darwin") {
47
+ return path.join(
48
+ home,
49
+ "Library",
50
+ "Application Support",
51
+ "Claude",
52
+ "claude_desktop_config.json"
53
+ );
54
+ }
55
+
56
+ // 🐧 Linux
57
+ return path.join(
58
+ home,
59
+ ".config",
60
+ "Claude",
61
+ "claude_desktop_config.json"
62
+ );
63
+ }
64
+
65
+ module.exports = getClaudePath;
@@ -0,0 +1,27 @@
1
+ function log(message) {
2
+ console.log(message);
3
+ }
4
+
5
+ function success(message) {
6
+ console.log("✅ " + message);
7
+ }
8
+
9
+ function error(message) {
10
+ console.log("❌ " + message);
11
+ }
12
+
13
+ function warn(message) {
14
+ console.log("âš ī¸ " + message);
15
+ }
16
+
17
+ function info(message) {
18
+ console.log("â„šī¸ " + message);
19
+ }
20
+
21
+ module.exports = {
22
+ log,
23
+ success,
24
+ error,
25
+ warn,
26
+ info
27
+ };
@@ -0,0 +1,14 @@
1
+ const fs = require("fs-extra");
2
+
3
+ async function readConfig(configPath) {
4
+ try {
5
+ if (await fs.pathExists(configPath)) {
6
+ return await fs.readJson(configPath);
7
+ }
8
+ return {};
9
+ } catch {
10
+ return {};
11
+ }
12
+ }
13
+
14
+ module.exports = readConfig;
@@ -0,0 +1,9 @@
1
+ const fs = require("fs-extra");
2
+ const path = require("path");
3
+
4
+ async function writeConfig(configPath, config) {
5
+ await fs.ensureDir(path.dirname(configPath));
6
+ await fs.writeJson(configPath, config, { spaces: 2 });
7
+ }
8
+
9
+ module.exports = writeConfig;