mcphosting-cli 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/CONTRIBUTING.md +156 -0
- package/LICENSE +21 -0
- package/README.md +260 -0
- package/dist/index.cjs +1182 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1159 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
- package/src/commands/auth.ts +186 -0
- package/src/commands/connect.ts +172 -0
- package/src/commands/import.ts +213 -0
- package/src/commands/proxy.ts +144 -0
- package/src/commands/search.ts +135 -0
- package/src/commands/servers.ts +131 -0
- package/src/index.ts +130 -0
- package/src/lib/api.ts +137 -0
- package/src/lib/clients.ts +188 -0
- package/src/lib/config.ts +90 -0
- package/src/lib/logger.ts +63 -0
- package/src/types.ts +47 -0
- package/tsconfig.json +26 -0
- package/tsup.config.ts +14 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# Contributing to MCPHosting CLI
|
|
2
|
+
|
|
3
|
+
We love contributions! Here's how to get started.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
1. **Clone the repository:**
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/gorlomi-enzo/mcphosting-cli.git
|
|
10
|
+
cd mcphosting-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. **Install dependencies:**
|
|
14
|
+
```bash
|
|
15
|
+
npm install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
3. **Build and test:**
|
|
19
|
+
```bash
|
|
20
|
+
npm run build
|
|
21
|
+
node dist/index.js --help
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Project Structure
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
src/
|
|
28
|
+
├── index.ts # CLI entry point
|
|
29
|
+
├── commands/ # Command implementations
|
|
30
|
+
│ ├── auth.ts # login/logout/whoami
|
|
31
|
+
│ ├── connect.ts # connect/disconnect/list
|
|
32
|
+
│ ├── import.ts # import from other tools
|
|
33
|
+
│ ├── proxy.ts # STDIO MCP proxy
|
|
34
|
+
│ ├── search.ts # search/info marketplace
|
|
35
|
+
│ └── servers.ts # server management (stubs)
|
|
36
|
+
├── lib/ # Shared utilities
|
|
37
|
+
│ ├── api.ts # MCPHosting API client
|
|
38
|
+
│ ├── clients.ts # AI client detection/config
|
|
39
|
+
│ ├── config.ts # Local config management
|
|
40
|
+
│ └── logger.ts # Pretty console output
|
|
41
|
+
└── types.ts # TypeScript definitions
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Making Changes
|
|
45
|
+
|
|
46
|
+
1. **Create a feature branch:**
|
|
47
|
+
```bash
|
|
48
|
+
git checkout -b feature/my-feature
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
2. **Make your changes:**
|
|
52
|
+
- Follow the existing code style
|
|
53
|
+
- Add TypeScript types for new code
|
|
54
|
+
- Test your changes with `npm run build && node dist/index.js`
|
|
55
|
+
|
|
56
|
+
3. **Test different scenarios:**
|
|
57
|
+
```bash
|
|
58
|
+
# Test search
|
|
59
|
+
node dist/index.js search github
|
|
60
|
+
|
|
61
|
+
# Test connect (dry run)
|
|
62
|
+
node dist/index.js connect github --client chatgpt
|
|
63
|
+
|
|
64
|
+
# Test help
|
|
65
|
+
node dist/index.js --help
|
|
66
|
+
node dist/index.js connect --help
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Adding New Commands
|
|
70
|
+
|
|
71
|
+
1. **Create the command file** in `src/commands/`
|
|
72
|
+
2. **Export a function** that returns a `Command` object
|
|
73
|
+
3. **Import and add** to `src/index.ts`
|
|
74
|
+
|
|
75
|
+
Example:
|
|
76
|
+
```typescript
|
|
77
|
+
// src/commands/example.ts
|
|
78
|
+
import { Command } from 'commander';
|
|
79
|
+
import { Logger } from '../lib/logger.js';
|
|
80
|
+
|
|
81
|
+
export function createExampleCommand(): Command {
|
|
82
|
+
return new Command('example')
|
|
83
|
+
.description('Example command')
|
|
84
|
+
.action(async () => {
|
|
85
|
+
Logger.success('Hello world!');
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/index.ts
|
|
90
|
+
import { createExampleCommand } from './commands/example.js';
|
|
91
|
+
program.addCommand(createExampleCommand());
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Adding New MCP Servers
|
|
95
|
+
|
|
96
|
+
Static MCP servers are defined in `src/lib/api.ts` in the `getStaticMCPs()` method. Add new entries there for testing until the live API is available.
|
|
97
|
+
|
|
98
|
+
## Code Style
|
|
99
|
+
|
|
100
|
+
- Use TypeScript with strict mode
|
|
101
|
+
- Prefer async/await over Promises
|
|
102
|
+
- Use the Logger class for consistent output
|
|
103
|
+
- Add help text and examples to commands
|
|
104
|
+
- Handle errors gracefully with user-friendly messages
|
|
105
|
+
|
|
106
|
+
## Testing
|
|
107
|
+
|
|
108
|
+
Currently manual testing. Run these scenarios:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Core functionality
|
|
112
|
+
npm run build
|
|
113
|
+
node dist/index.js search github
|
|
114
|
+
node dist/index.js info notion
|
|
115
|
+
node dist/index.js list
|
|
116
|
+
node dist/index.js connect github --client chatgpt
|
|
117
|
+
|
|
118
|
+
# Import testing (will show "not found" unless you have Smithery)
|
|
119
|
+
node dist/index.js import --from smithery --dry-run
|
|
120
|
+
|
|
121
|
+
# Help testing
|
|
122
|
+
node dist/index.js --help
|
|
123
|
+
node dist/index.js connect --help
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Submitting Changes
|
|
127
|
+
|
|
128
|
+
1. **Commit your changes:**
|
|
129
|
+
```bash
|
|
130
|
+
git add .
|
|
131
|
+
git commit -m "Add: your feature description"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
2. **Push your branch:**
|
|
135
|
+
```bash
|
|
136
|
+
git push origin feature/my-feature
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
3. **Create a Pull Request** on GitHub
|
|
140
|
+
|
|
141
|
+
## Growth Hacking Features
|
|
142
|
+
|
|
143
|
+
When adding commands, remember to include:
|
|
144
|
+
|
|
145
|
+
- Helpful error messages with next steps
|
|
146
|
+
- Links to GitHub repository in help text
|
|
147
|
+
- Sharing prompts after successful actions
|
|
148
|
+
- SEO-friendly descriptions and keywords
|
|
149
|
+
|
|
150
|
+
## Need Help?
|
|
151
|
+
|
|
152
|
+
- Open an issue on GitHub
|
|
153
|
+
- Check existing issues for similar problems
|
|
154
|
+
- Join our Discord: https://discord.gg/mcphosting
|
|
155
|
+
|
|
156
|
+
Thanks for contributing! 🚀
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 MCPHosting / Gorlomi Ventures LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# MCPHosting CLI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@mcphosting/cli)
|
|
4
|
+
[](https://www.npmjs.com/package/@mcphosting/cli)
|
|
5
|
+
[](https://github.com/gorlomi-enzo/mcphosting-cli)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
**Connect AI agents to MCP servers. Browse, install, and manage Model Context Protocol servers.**
|
|
9
|
+
|
|
10
|
+
The easiest way to connect MCP servers to Claude Desktop, ChatGPT, Cursor, VS Code, and other AI clients. One command to rule them all.
|
|
11
|
+
|
|
12
|
+
## ⚡ Quick Start
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Install globally
|
|
16
|
+
npm install -g @mcphosting/cli
|
|
17
|
+
|
|
18
|
+
# Or run directly with npx
|
|
19
|
+
npx @mcphosting/cli connect github
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 🔗 How to Connect MCP Servers to AI Clients
|
|
23
|
+
|
|
24
|
+
### How to Connect MCP Servers to Claude Desktop
|
|
25
|
+
|
|
26
|
+
Claude Desktop is the most popular way to use MCP servers. Here's how to connect any MCP server:
|
|
27
|
+
|
|
28
|
+
1. **Install the CLI:**
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g @mcphosting/cli
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
2. **Connect an MCP server:**
|
|
34
|
+
```bash
|
|
35
|
+
mcphost connect github
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
3. **Restart Claude Desktop** to load the new MCP server
|
|
39
|
+
|
|
40
|
+
The CLI automatically detects your Claude Desktop installation and updates the `claude_desktop_config.json` file with the MCP server configuration.
|
|
41
|
+
|
|
42
|
+
**Manual Claude Desktop Setup:**
|
|
43
|
+
If you prefer manual setup, edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"github": {
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["-y", "@mcphosting/cli", "proxy", "https://github.mcphost.dev"],
|
|
51
|
+
"env": {}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### How to Connect MCP Servers to ChatGPT
|
|
58
|
+
|
|
59
|
+
ChatGPT Plus users can connect MCP servers through the web interface:
|
|
60
|
+
|
|
61
|
+
1. **Get the MCP server URL:**
|
|
62
|
+
```bash
|
|
63
|
+
mcphost info github # Shows the server URL
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. **Add to ChatGPT:**
|
|
67
|
+
- Open ChatGPT in your browser
|
|
68
|
+
- Go to Settings → Apps → Connect an app
|
|
69
|
+
- Enter the MCP server URL (e.g., `https://github.mcphost.dev`)
|
|
70
|
+
- Follow the authorization prompts
|
|
71
|
+
|
|
72
|
+
3. **Start using MCP tools** in your ChatGPT conversations
|
|
73
|
+
|
|
74
|
+
### How to Connect MCP Servers to Cursor
|
|
75
|
+
|
|
76
|
+
Cursor IDE supports MCP servers through configuration files:
|
|
77
|
+
|
|
78
|
+
1. **Auto-connect with CLI:**
|
|
79
|
+
```bash
|
|
80
|
+
mcphost connect notion --client cursor
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
2. **Manual Cursor setup:**
|
|
84
|
+
Create or edit `~/.cursor/mcp.json`:
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"notion": {
|
|
89
|
+
"command": "npx",
|
|
90
|
+
"args": ["-y", "@mcphosting/cli", "proxy", "https://notion.mcphost.dev"],
|
|
91
|
+
"env": {}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
3. **Restart Cursor** to load the MCP server
|
|
98
|
+
|
|
99
|
+
## 📦 Available Commands
|
|
100
|
+
|
|
101
|
+
### Connection Management
|
|
102
|
+
```bash
|
|
103
|
+
mcphost connect <url-or-slug> # Connect MCP server to all AI clients
|
|
104
|
+
mcphost connect <url> --client claude # Connect only to Claude Desktop
|
|
105
|
+
mcphost disconnect <slug> # Remove MCP connection
|
|
106
|
+
mcphost list # List all connected MCP servers
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Marketplace
|
|
110
|
+
```bash
|
|
111
|
+
mcphost search <query> # Search MCP marketplace
|
|
112
|
+
mcphost info <slug> # Get detailed MCP server info
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Migration
|
|
116
|
+
```bash
|
|
117
|
+
mcphost import --from smithery # Import from Smithery CLI
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Authentication (Optional)
|
|
121
|
+
```bash
|
|
122
|
+
mcphost login # Login to MCPHosting
|
|
123
|
+
mcphost logout # Logout
|
|
124
|
+
mcphost whoami # Show current user
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 🌟 Featured MCP Servers
|
|
128
|
+
|
|
129
|
+
| Server | Description | Tools | Connect |
|
|
130
|
+
|--------|-------------|-------|---------|
|
|
131
|
+
| **GitHub** | Access repositories, issues, PRs | `read_file`, `list_repos`, `create_issue` | `mcphost connect github` |
|
|
132
|
+
| **Slack** | Send messages, manage workspaces | `send_message`, `list_channels` | `mcphost connect slack` |
|
|
133
|
+
| **Notion** | Read/write pages and databases | `read_page`, `create_page`, `query_database` | `mcphost connect notion` |
|
|
134
|
+
| **Stripe** | Payment and customer data | `get_customer`, `list_payments` | `mcphost connect stripe` |
|
|
135
|
+
| **PostgreSQL** | Safe database queries | `query`, `describe_table`, `list_tables` | `mcphost connect postgres` |
|
|
136
|
+
|
|
137
|
+
## 🚀 MCPHosting CLI vs Smithery CLI
|
|
138
|
+
|
|
139
|
+
| Feature | MCPHosting CLI | Smithery CLI |
|
|
140
|
+
|---------|----------------|--------------|
|
|
141
|
+
| **Auto-detection** | ✅ Detects Claude, Cursor, VS Code | ❌ Manual config |
|
|
142
|
+
| **ChatGPT support** | ✅ Web setup instructions | ❌ Not supported |
|
|
143
|
+
| **Migration** | ✅ `import --from smithery` | ❌ No migration |
|
|
144
|
+
| **Marketplace** | ✅ Search & browse built-in | ❌ Limited discovery |
|
|
145
|
+
| **Growth features** | ✅ Sharing prompts, GitHub stars | ❌ Basic CLI |
|
|
146
|
+
| **Proxy mode** | ✅ Built-in STDIO proxy | ❌ External tools needed |
|
|
147
|
+
| **Multiple clients** | ✅ Connect to all at once | ❌ One at a time |
|
|
148
|
+
|
|
149
|
+
**Migration from Smithery:**
|
|
150
|
+
```bash
|
|
151
|
+
mcphost import --from smithery
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 🎯 Supported AI Clients
|
|
155
|
+
|
|
156
|
+
| Client | Status | Auto-Detection | Config Location |
|
|
157
|
+
|--------|--------|----------------|-----------------|
|
|
158
|
+
| **Claude Desktop** | ✅ Full support | ✅ Automatic | `~/Library/Application Support/Claude/` |
|
|
159
|
+
| **ChatGPT Plus** | ✅ Web setup | N/A | Web interface |
|
|
160
|
+
| **Cursor** | ✅ Full support | ✅ Automatic | `~/.cursor/mcp.json` |
|
|
161
|
+
| **VS Code** | ✅ Full support | ✅ Automatic | `.vscode/mcp.json` |
|
|
162
|
+
| **OpenClaw** | ✅ Full support | ✅ Automatic | `~/.openclaw/mcp.json` |
|
|
163
|
+
|
|
164
|
+
## 🔧 Examples
|
|
165
|
+
|
|
166
|
+
**Connect GitHub MCP to all clients:**
|
|
167
|
+
```bash
|
|
168
|
+
mcphost connect github
|
|
169
|
+
# 🎉 Connected! Share with your team:
|
|
170
|
+
# npx @mcphosting/cli connect github
|
|
171
|
+
#
|
|
172
|
+
# ⭐ Star us: https://github.com/gorlomi-enzo/mcphosting-cli
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Connect custom MCP server:**
|
|
176
|
+
```bash
|
|
177
|
+
mcphost connect https://my-custom-mcp.example.com
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Search for MCP servers:**
|
|
181
|
+
```bash
|
|
182
|
+
mcphost search "database"
|
|
183
|
+
mcphost search "slack"
|
|
184
|
+
mcphost info notion
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Import from Smithery:**
|
|
188
|
+
```bash
|
|
189
|
+
mcphost import --from smithery --dry-run # Preview what will be imported
|
|
190
|
+
mcphost import --from smithery # Actually import
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**List connections:**
|
|
194
|
+
```bash
|
|
195
|
+
mcphost list
|
|
196
|
+
# 📋 Connected MCP Servers (3)
|
|
197
|
+
#
|
|
198
|
+
# Slug | URL | Clients | Added
|
|
199
|
+
# github | https://github.mcphost.dev | claude, cursor | 12/1/2024
|
|
200
|
+
# slack | https://slack.mcphost.dev | claude | 12/1/2024
|
|
201
|
+
# notion | https://notion.mcphost.dev | claude, cursor | 12/1/2024
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## 🏗️ How It Works
|
|
205
|
+
|
|
206
|
+
1. **URL Resolution:** Slugs like `github` become `https://github.mcphost.dev`
|
|
207
|
+
2. **Client Detection:** Automatically finds Claude Desktop, Cursor, VS Code configs
|
|
208
|
+
3. **Config Update:** Adds MCP server entry to each client's config file
|
|
209
|
+
4. **Proxy Mode:** Uses `npx @mcphosting/cli proxy <url>` for STDIO communication
|
|
210
|
+
|
|
211
|
+
**Config Format:**
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"mcpServers": {
|
|
215
|
+
"github": {
|
|
216
|
+
"command": "npx",
|
|
217
|
+
"args": ["-y", "@mcphosting/cli", "proxy", "https://github.mcphost.dev"],
|
|
218
|
+
"env": {}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## 🔒 Security & Privacy
|
|
225
|
+
|
|
226
|
+
- **No data collection** during MCP proxying
|
|
227
|
+
- **Open source** - audit the code yourself
|
|
228
|
+
- **Local config** - your connections stored in `~/.mcphosting/`
|
|
229
|
+
- **Optional auth** - marketplace features only
|
|
230
|
+
|
|
231
|
+
## 📚 Documentation
|
|
232
|
+
|
|
233
|
+
- [Getting Started Guide](https://mcphosting.com/docs/getting-started)
|
|
234
|
+
- [MCP Server Development](https://mcphosting.com/docs/development)
|
|
235
|
+
- [API Reference](https://mcphosting.com/docs/api)
|
|
236
|
+
- [Troubleshooting](https://mcphosting.com/docs/troubleshooting)
|
|
237
|
+
|
|
238
|
+
## 🤝 Contributing
|
|
239
|
+
|
|
240
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md).
|
|
241
|
+
|
|
242
|
+
1. Fork the repository
|
|
243
|
+
2. Create a feature branch: `git checkout -b my-feature`
|
|
244
|
+
3. Commit changes: `git commit -am 'Add feature'`
|
|
245
|
+
4. Push to branch: `git push origin my-feature`
|
|
246
|
+
5. Submit a Pull Request
|
|
247
|
+
|
|
248
|
+
## 📄 License
|
|
249
|
+
|
|
250
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
251
|
+
|
|
252
|
+
## 🌟 Star History
|
|
253
|
+
|
|
254
|
+
[](https://star-history.com/#gorlomi-enzo/mcphosting-cli&Date)
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
**Made with ❤️ by [MCPHosting](https://mcphosting.com)**
|
|
259
|
+
|
|
260
|
+
[⭐ Star us on GitHub](https://github.com/gorlomi-enzo/mcphosting-cli) • [🐦 Follow on Twitter](https://twitter.com/mcphosting) • [💬 Join Discord](https://discord.gg/mcphosting)
|