connect-mcp 1.0.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 +8 -0
- package/commands/claude.js +40 -0
- package/commands.txt +1 -0
- package/constants/defaults.js +4 -0
- package/index.js +21 -0
- package/package.json +19 -0
- package/utils/getClaudePath.js +65 -0
- package/utils/logger.js +27 -0
- package/utils/readConfig.js +14 -0
- package/utils/writeConfig.js +9 -0
package/README.MD
ADDED
|
@@ -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;
|
package/commands.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node index.js claude --url=https://your-mcp-server.com
|
package/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { Command } = require("commander");
|
|
4
|
+
const setupClaude = require("./commands/claude");
|
|
5
|
+
|
|
6
|
+
const program = new Command();
|
|
7
|
+
|
|
8
|
+
program
|
|
9
|
+
.name("mcp-connect")
|
|
10
|
+
.description("One-click MCP integration tool")
|
|
11
|
+
.version("1.0.0");
|
|
12
|
+
|
|
13
|
+
program
|
|
14
|
+
.command("claude")
|
|
15
|
+
.requiredOption("--url <url>", "MCP server URL")
|
|
16
|
+
.description("Connect MCP to Claude Desktop")
|
|
17
|
+
.action(async (options) => {
|
|
18
|
+
await setupClaude(options.url);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "connect-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "One-click MCP integration CLI",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"connect-mcp": "./index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node index.js"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["mcp", "cli", "ai", "integration"],
|
|
13
|
+
"author": "ZenithX",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"commander": "^11.0.0",
|
|
17
|
+
"fs-extra": "^11.2.0"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -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;
|
package/utils/logger.js
ADDED
|
@@ -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
|
+
};
|