thetoolforthat 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. package/cli.js +73 -106
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -1,137 +1,106 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { program } from "commander";
4
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
5
- import { homedir } from "os";
6
- import { join } from "path";
7
- import { spawn } from "child_process";
8
- import { fileURLToPath } from "url";
9
- import { dirname } from "path";
10
-
11
- const __filename = fileURLToPath(import.meta.url);
12
- const __dirname = dirname(__filename);
13
-
14
- const CONFIG_PATHS = {
15
- claude: join(homedir(), ".claude", "settings.json"),
16
- cursor: join(process.cwd(), ".cursor", "mcp.json"),
17
- vscode: join(process.cwd(), ".vscode", "mcp.json"),
18
- codex: join(homedir(), ".codex", "config.toml"),
19
- opencode: join(homedir(), ".opencode", "mcp.json"),
20
- };
21
-
22
- const MCP_CONFIG = {
4
+ import { execSync } from "child_process";
5
+
6
+ const MCP_CONFIG = JSON.stringify({
23
7
  command: "npx",
24
8
  args: ["thetoolforthat", "mcp"],
25
- };
26
-
27
- function ensureDir(filePath) {
28
- const dir = dirname(filePath);
29
- if (!existsSync(dir)) {
30
- mkdirSync(dir, { recursive: true });
31
- }
32
- }
9
+ });
33
10
 
34
- function readJsonConfig(path) {
35
- if (!existsSync(path)) {
36
- return {};
37
- }
11
+ function runCommand(cmd) {
38
12
  try {
39
- return JSON.parse(readFileSync(path, "utf-8"));
40
- } catch {
41
- return {};
13
+ execSync(cmd, { stdio: "inherit" });
14
+ return true;
15
+ } catch (error) {
16
+ return false;
42
17
  }
43
18
  }
44
19
 
45
- function writeJsonConfig(path, config) {
46
- ensureDir(path);
47
- writeFileSync(path, JSON.stringify(config, null, 2) + "\n");
48
- }
49
-
50
20
  function initClaude() {
51
- const configPath = CONFIG_PATHS.claude;
52
- const config = readJsonConfig(configPath);
53
-
54
- if (!config.mcpServers) {
55
- config.mcpServers = {};
21
+ console.log("Adding thetoolforthat to Claude Code...\n");
22
+
23
+ // Use claude mcp add-json with user scope
24
+ const success = runCommand(
25
+ `claude mcp add-json --scope user thetoolforthat '${MCP_CONFIG}'`
26
+ );
27
+
28
+ if (success) {
29
+ console.log("\n✓ Added thetoolforthat MCP server");
30
+ console.log("\nRestart Claude Code and try:");
31
+ console.log(" - Search for animation libraries");
32
+ console.log(" - Recommend tools for building a SaaS dashboard");
33
+ console.log(" - List all design agencies");
34
+ } else {
35
+ console.error("\nFailed to add MCP server. Try manually:");
36
+ console.log(`\nclaude mcp add-json --scope user thetoolforthat '${MCP_CONFIG}'`);
56
37
  }
57
-
58
- config.mcpServers.thetoolforthat = MCP_CONFIG;
59
-
60
- writeJsonConfig(configPath, config);
61
- console.log(`✓ Added thetoolforthat to ${configPath}`);
62
- console.log("\nRestart Claude Code and try:");
63
- console.log(" - Search for animation libraries");
64
- console.log(" - Recommend tools for building a SaaS dashboard");
65
- console.log(" - List all design agencies");
66
38
  }
67
39
 
68
40
  function initCursor() {
69
- const configPath = CONFIG_PATHS.cursor;
70
- const config = readJsonConfig(configPath);
71
-
72
- if (!config.mcpServers) {
73
- config.mcpServers = {};
74
- }
75
-
76
- config.mcpServers.thetoolforthat = MCP_CONFIG;
77
-
78
- writeJsonConfig(configPath, config);
79
- console.log(`✓ Added thetoolforthat to ${configPath}`);
80
- console.log("\nOpen Cursor Settings and enable the MCP server for thetoolforthat.");
81
- console.log("\nThen try:");
82
- console.log(" - Search for animation libraries");
83
- console.log(" - Recommend tools for building a SaaS dashboard");
41
+ console.log("Adding thetoolforthat to Cursor...\n");
42
+
43
+ const config = {
44
+ mcpServers: {
45
+ thetoolforthat: {
46
+ command: "npx",
47
+ args: ["thetoolforthat", "mcp"],
48
+ },
49
+ },
50
+ };
51
+
52
+ console.log("Add this to .cursor/mcp.json in your project:\n");
53
+ console.log(JSON.stringify(config, null, 2));
54
+ console.log("\nThen open Cursor Settings and enable the MCP server.");
84
55
  }
85
56
 
86
57
  function initVscode() {
87
- const configPath = CONFIG_PATHS.vscode;
88
- const config = readJsonConfig(configPath);
89
-
90
- if (!config.servers) {
91
- config.servers = {};
92
- }
93
-
94
- config.servers.thetoolforthat = MCP_CONFIG;
95
-
96
- writeJsonConfig(configPath, config);
97
- console.log(`✓ Added thetoolforthat to ${configPath}`);
98
- console.log("\nOpen .vscode/mcp.json and click Start next to thetoolforthat.");
99
- console.log("\nThen try with GitHub Copilot:");
100
- console.log(" - Search for animation libraries");
101
- console.log(" - Recommend tools for building a SaaS dashboard");
58
+ console.log("Adding thetoolforthat to VS Code...\n");
59
+
60
+ const config = {
61
+ servers: {
62
+ thetoolforthat: {
63
+ command: "npx",
64
+ args: ["thetoolforthat", "mcp"],
65
+ },
66
+ },
67
+ };
68
+
69
+ console.log("Add this to .vscode/mcp.json in your project:\n");
70
+ console.log(JSON.stringify(config, null, 2));
71
+ console.log("\nThen click Start next to thetoolforthat in the MCP panel.");
102
72
  }
103
73
 
104
74
  function initCodex() {
105
- console.log(`To configure Codex, add this to ~/.codex/config.toml:\n`);
75
+ console.log("Adding thetoolforthat to Codex...\n");
76
+ console.log("Add this to ~/.codex/config.toml:\n");
106
77
  console.log(`[mcp_servers.thetoolforthat]`);
107
78
  console.log(`command = "npx"`);
108
79
  console.log(`args = ["thetoolforthat", "mcp"]`);
109
- console.log("\nThen restart Codex and try:");
110
- console.log(" - Search for animation libraries");
111
- console.log(" - Recommend tools for building a SaaS dashboard");
80
+ console.log("\nThen restart Codex.");
112
81
  }
113
82
 
114
83
  function initOpencode() {
115
- const configPath = CONFIG_PATHS.opencode;
116
- const config = readJsonConfig(configPath);
117
-
118
- if (!config.mcpServers) {
119
- config.mcpServers = {};
120
- }
121
-
122
- config.mcpServers.thetoolforthat = MCP_CONFIG;
123
-
124
- writeJsonConfig(configPath, config);
125
- console.log(`✓ Added thetoolforthat to ${configPath}`);
126
- console.log("\nRestart OpenCode and try:");
127
- console.log(" - Search for animation libraries");
128
- console.log(" - Recommend tools for building a SaaS dashboard");
84
+ console.log("Adding thetoolforthat to OpenCode...\n");
85
+
86
+ const config = {
87
+ mcpServers: {
88
+ thetoolforthat: {
89
+ command: "npx",
90
+ args: ["thetoolforthat", "mcp"],
91
+ },
92
+ },
93
+ };
94
+
95
+ console.log("Add this to ~/.opencode/mcp.json:\n");
96
+ console.log(JSON.stringify(config, null, 2));
97
+ console.log("\nThen restart OpenCode.");
129
98
  }
130
99
 
131
100
  program
132
101
  .name("thetoolforthat")
133
102
  .description("Curated tools, resources, and agencies for builders")
134
- .version("1.0.0");
103
+ .version("1.2.0");
135
104
 
136
105
  program
137
106
  .command("init")
@@ -141,8 +110,8 @@ program
141
110
  const client = options.client?.toLowerCase();
142
111
 
143
112
  if (!client) {
144
- console.log("Available clients: claude, cursor, vscode, codex, opencode");
145
- console.log("\nUsage: npx thetoolforthat init --client <client>");
113
+ console.log("Available clients: claude, cursor, vscode, codex, opencode\n");
114
+ console.log("Usage: npx thetoolforthat init --client <client>");
146
115
  console.log("Example: npx thetoolforthat init --client claude");
147
116
  return;
148
117
  }
@@ -174,11 +143,9 @@ program
174
143
  .command("mcp")
175
144
  .description("Start the MCP server")
176
145
  .action(async () => {
177
- // Import and run the server
178
146
  await import("./server.js");
179
147
  });
180
148
 
181
- // Default command (no args) - show help
182
149
  program.action(() => {
183
150
  program.help();
184
151
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thetoolforthat",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "MCP server for searching curated developer tools, design resources, and agencies",
5
5
  "type": "module",
6
6
  "main": "cli.js",