mobilecoder-mcp 1.0.2 → 1.0.4

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/README.md +331 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,331 @@
1
+ # MobileCoder MCP
2
+
3
+ > MCP server for MobileCoderMCP - enables mobile to desktop coding
4
+
5
+ Transform your mobile device into a powerful coding companion for Cursor, Windsurf, and VSCode. Connect your phone to your IDE and code from anywhere with WebRTC-powered real-time communication.
6
+
7
+ ## Features
8
+
9
+ - **QR Code Quick Connect** - Scan and connect in seconds
10
+ - **End-to-End Encryption** - DTLS-secured WebRTC connections
11
+ - **Universal IDE Support** - Works with Cursor, Windsurf, and VSCode
12
+ - **Real-Time Sync** - Low-latency signaling over WebSocket
13
+ - **Security Hardened** - HMAC integrity, SDP validation, replay protection
14
+
15
+ ---
16
+
17
+ ## What's New in v1.0.2
18
+
19
+ ### Security Hardening & Stability
20
+
21
+ This version brings critical security improvements to ensure robust WebRTC signaling and data integrity.
22
+
23
+ - **HMAC Message Integrity**: Added Hash-based Message Authentication Code (HMAC) to verify that signaling messages haven't been tampered with during transit.
24
+
25
+ - **SDP Validation**: Strict Session Description Protocol (SDP) validation to prevent malicious payload injection.
26
+
27
+ - **DTLS Fingerprint Check**: Added validation for DTLS fingerprints to ensure secure end-to-end encrypted media streams.
28
+
29
+ - **Replay Attack Protection**: Implemented message nonces and tracking to block unauthorized session re-use.
30
+
31
+ - **Memory Leak Prevention**: Optimized event listeners and connection cleanup cycles for long-running sessions.
32
+
33
+ - **HTTPS Enforcement**: Enhanced origin validation to ensure secure contexts (HTTPS) for all WebRTC operations.
34
+
35
+ ---
36
+
37
+ ## Installation
38
+
39
+ ### Global Install
40
+
41
+ ```bash
42
+ npm install -g mobilecoder-mcp@latest
43
+ ```
44
+
45
+ ### Using npx (No Install Required)
46
+
47
+ ```bash
48
+ npx mobilecoder-mcp@latest init
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Quick Start
54
+
55
+ ### 1. Initialize Connection
56
+
57
+ ```bash
58
+ mobilecoder-mcp init
59
+ ```
60
+
61
+ This will:
62
+ - Generate a unique 6-character pairing code
63
+ - Display a QR code for mobile scanning
64
+ - Automatically configure your IDEs (Cursor, Windsurf, VSCode)
65
+ - Start the MCP server
66
+
67
+ ### 2. Connect Mobile Device
68
+
69
+ 1. Visit [https://mobilecoder.xyz/connect](https://mobilecoder.xyz/connect) on your mobile device
70
+ 2. Enter the pairing code displayed in terminal
71
+ 3. Alternatively, scan the QR code shown in terminal
72
+
73
+ ### 3. Start Coding
74
+
75
+ Your mobile device is now connected! Use it to:
76
+ - Generate code with AI assistance
77
+ - Execute terminal commands
78
+ - Browse and edit files
79
+ - Get real-time feedback
80
+
81
+ ---
82
+
83
+ ## Commands
84
+
85
+ ### `mobilecoder-mcp init`
86
+
87
+ Initialize a new connection, generate QR code, and start the agent.
88
+
89
+ ```bash
90
+ mobilecoder-mcp init
91
+ ```
92
+
93
+ **Options:**
94
+ - `-s, --signaling <url>` - Custom signaling server URL (default: https://api.mobilecoder.xyz/api)
95
+ - `--debug` - Enable debug logging
96
+
97
+ ### `mobilecoder-mcp start`
98
+
99
+ Start the agent with an existing connection code.
100
+
101
+ ```bash
102
+ mobilecoder-mcp start --code=ABC123
103
+ ```
104
+
105
+ **Options:**
106
+ - `-c, --code <code>` - Your 6-character connection code (required)
107
+ - `-s, --signaling <url>` - Custom signaling server URL
108
+ - `--debug` - Enable debug logging
109
+
110
+ ### `mobilecoder-mcp reset`
111
+
112
+ Remove MobileCoderMCP configuration from IDEs.
113
+
114
+ ```bash
115
+ mobilecoder-mcp reset
116
+ ```
117
+
118
+ **Options:**
119
+ - `-i, --ide <ide>` - Specific IDE to reset (cursor, windsurf, vscode, all)
120
+
121
+ ---
122
+
123
+ ## Environment Variables
124
+
125
+ | Variable | Description | Default |
126
+ |----------|-------------|---------|
127
+ | `MCP_SIGNALING_URL` | Signaling server URL | `https://api.mobilecoder.xyz/api` |
128
+ | `MOBILE_CODER_WEB_URL` | Web app URL for QR codes | `https://mobilecoder.xyz` |
129
+ | `MCP_CONNECTION_CODE` | Pre-defined connection code | Auto-generated |
130
+
131
+ ---
132
+
133
+ ## How It Works
134
+
135
+ ```
136
+ [Desktop IDE] WebRTC (P2P) [Mobile Device]
137
+
138
+ [MCP Server] Signaling (WebSocket) [Web App]
139
+ ```
140
+
141
+ 1. **Desktop**: MCP server starts, generates pairing code
142
+ 2. **Mobile**: User enters code on web app
143
+ 3. **Signaling**: Server facilitates WebRTC handshake
144
+ 4. **P2P Connection**: Direct peer-to-peer connection established
145
+ 5. **Data Flow**: Commands/results flow directly (no server middleman)
146
+
147
+ ---
148
+
149
+ ## IDE Configuration
150
+
151
+ The `init` command automatically configures supported IDEs:
152
+
153
+ ### Cursor
154
+ ```json
155
+ ~/.cursor/mcp.json
156
+ ```
157
+
158
+ ### Windsurf
159
+ ```json
160
+ ~/.codeium/windsurf/mcp_config.json
161
+ ```
162
+
163
+ ### VSCode
164
+ ```json
165
+ ~/.vscode/mcp.json
166
+ ```
167
+
168
+ Manual configuration example:
169
+
170
+ ```json
171
+ {
172
+ "mcpServers": {
173
+ "mobile-coder": {
174
+ "command": "npx",
175
+ "args": ["mobilecoder-mcp", "start", "--code", "YOUR_CODE", "--signaling", "https://api.mobilecoder.xyz/api"],
176
+ "env": {
177
+ "MCP_CONNECTION_CODE": "YOUR_CODE",
178
+ "MCP_SIGNALING_URL": "https://api.mobilecoder.xyz/api"
179
+ }
180
+ }
181
+ }
182
+ }
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Security
188
+
189
+ ### End-to-End Encryption
190
+
191
+ - **DTLS 1.2/1.3**: All WebRTC media encrypted
192
+ - **HMAC-SHA256**: Message integrity verification
193
+ - **SDP Validation**: Malicious payload prevention
194
+ - **Nonce Tracking**: Replay attack protection
195
+
196
+ ### Data Privacy
197
+
198
+ - **No Server Storage**: Signaling only, no message logging
199
+ - **P2P Architecture**: Data flows directly between devices
200
+ - **Ephemeral Keys**: Session-specific encryption keys
201
+
202
+ ### Best Practices
203
+
204
+ 1. **Use HTTPS**: Always in production (enforced by default)
205
+ 2. **Secure Codes**: Connection codes expire after 5 minutes
206
+ 3. **Rate Limiting**: Signaling endpoints protected
207
+ 4. **CORS Whitelist**: Only authorized origins allowed
208
+
209
+ ---
210
+
211
+ ## Troubleshooting
212
+
213
+ ### Connection Issues
214
+
215
+ **Problem**: "Connection timeout" or "Cannot connect to signaling server"
216
+
217
+ **Solutions**:
218
+ - Check internet connection on both devices
219
+ - Verify `MCP_SIGNALING_URL` is correct
220
+ - Ensure signaling server is running: `curl https://api.mobilecoder.xyz/api/health`
221
+
222
+ ### WebRTC Handshake Fails
223
+
224
+ **Problem**: "ICE connection failed" or "No remote candidate"
225
+
226
+ **Solutions**:
227
+ - Check firewall settings (UDP ports 3478, 5349)
228
+ - Verify TURN server is accessible
229
+ - Try different network (disable VPN if needed)
230
+
231
+ ### Code Already in Use
232
+
233
+ **Problem**: "Connection code is already in use"
234
+
235
+ **Solution**:
236
+ - Wait 2 minutes for code to expire
237
+ - Or generate new code: `mobilecoder-mcp init`
238
+
239
+ ---
240
+
241
+ ## Development
242
+
243
+ ### Build from Source
244
+
245
+ ```bash
246
+ git clone https://github.com/hasmetdurak/mobilecoder-mcp.git
247
+ cd mobilecoder-mcp/mcp-server
248
+ npm install
249
+ npm run build
250
+ npm link
251
+ ```
252
+
253
+ ### Run in Development Mode
254
+
255
+ ```bash
256
+ npm run dev # Watch mode with auto-rebuild
257
+ ```
258
+
259
+ ### Run Debug Mode
260
+
261
+ ```bash
262
+ mobilecoder-mcp init --debug
263
+ ```
264
+
265
+ ---
266
+
267
+ ## Architecture
268
+
269
+ ### MCP Server
270
+
271
+ ```
272
+ mcp-server/
273
+ ├── src/
274
+ │ ├── index.ts # CLI entry point
275
+ │ ├── agent.ts # Universal MCP agent
276
+ │ ├── webrtc.ts # WebRTC connection manager
277
+ │ ├── security.ts # HMAC & validation
278
+ │ ├── mcp-handler.ts # MCP tool handlers
279
+ │ ├── tool-detector.ts # IDE tool detection
280
+ │ └── adapters/
281
+ │ └── cli-adapter.ts # CLI-specific adapters
282
+ ├── dist/ # Compiled JavaScript
283
+ └── package.json
284
+ ```
285
+
286
+ ### Dependencies
287
+
288
+ - `@modelcontextprotocol/sdk` - MCP protocol implementation
289
+ - `simple-peer` - WebRTC wrapper for Node.js
290
+ - `@roamhq/wrtc` - Native WebRTC bindings
291
+ - `commander` - CLI framework
292
+ - `qrcode-terminal` - Terminal QR codes
293
+
294
+ ---
295
+
296
+ ## Contributing
297
+
298
+ Contributions are welcome! Please feel free to submit a Pull Request.
299
+
300
+ 1. Fork the repository
301
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
302
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
303
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
304
+ 5. Open a Pull Request
305
+
306
+ ---
307
+
308
+ ## License
309
+
310
+ MIT License - see LICENSE file for details
311
+
312
+ ---
313
+
314
+ ## Support
315
+
316
+ - **Issues**: [GitHub Issues](https://github.com/hasmetdurak/mobilecoder-mcp/issues)
317
+ - **Web App**: [https://mobilecoder.xyz](https://mobilecoder.xyz)
318
+ - **API Docs**: [https://api.mobilecoder.xyz](https://api.mobilecoder.xyz)
319
+
320
+ ---
321
+
322
+ ## Acknowledgments
323
+
324
+ Built with:
325
+ - [Model Context Protocol (MCP)](https://modelcontextprotocol.io)
326
+ - [Simple Peer](https://github.com/feross/simple-peer)
327
+ - [WebRTC](https://webrtc.org/)
328
+
329
+ ---
330
+
331
+ **Version**: 1.0.3 | **Author**: @hasmetdurak | **License**: MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobilecoder-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "MCP server for MobileCoderMCP - enables mobile to desktop coding",
6
6
  "main": "dist/index.js",