# MCP Server Migration to Python
## β
Completed
MCP server successfully rewritten from TypeScript/JavaScript to Python!
## π New Files
- **`src/server.py`** - Python version of MCP server
- **`requirements.txt`** - Python dependencies
## π Usage
### 1. Install Dependencies
```bash
pip install -r requirements.txt
```
Or manually:
```bash
pip install pymongo requests
```
### 2. Run Server
```bash
python3 src/server.py
```
Or make the file executable:
```bash
chmod +x src/server.py
./src/server.py
```
### 3. Use with Clients
All clients are already updated to use the Python version:
- `mcp_client.py` - text client
- `voice_client.py` - voice client
## βοΈ Claude Desktop Configuration
Update Claude Desktop configuration (`~/Library/Application Support/Claude/claude_desktop_config.json`):
```json
{
"mcpServers": {
"mac-apps": {
"command": "python3",
"args": ["/Users/olegzaichkin/Documents/MCP/src/server.py"]
}
}
}
```
## π What Changed
### Python Version Advantages:
1. β
Easier to use - no compilation required (npm run build)
2. β
Fewer dependencies - only pymongo and requests
3. β
Direct JSON-RPC implementation via stdio
4. β
All features preserved - all tools work identically
### Functionality:
All tools work the same as in the TypeScript version:
- β
Mac application management
- β
Ollama integration
- β
MongoDB integration
- β
AppleScript automation
## π Version Comparison
| Feature | TypeScript | Python |
|---------|-----------|--------|
| Compilation | Required (npm run build) | Not required |
| Dependencies | @modelcontextprotocol/sdk, mongodb | pymongo, requests |
| Size | Larger (node_modules) | Smaller |
| Speed | Fast | Fast |
| Compatibility | β
| β
|
## π§ Environment Variables
Both versions use the same environment variables:
```bash
export OLLAMA_API_URL="http://localhost:11434"
export MONGODB_URI="mongodb://localhost:27017"
```
## π Documentation
- Main documentation: [README.md](./README.md)
- Voice control: [VOICE_SETUP.md](./VOICE_SETUP.md)
- MongoDB: [MONGODB_USAGE.md](./MONGODB_USAGE.md)
## π Troubleshooting
### Error: "No module named 'pymongo'"
**Solution:**
```bash
pip install -r requirements.txt
```
### Error: "No module named 'requests'"
**Solution:**
```bash
pip install requests
```
### Server Won't Start
Check that Python 3 is installed:
```bash
python3 --version
```
Should be Python 3.7 or higher.
## β οΈ Note
The old TypeScript version (`src/index.ts` and `dist/index.js`) is still available, but clients now use the Python version by default.
If you need to revert to the TypeScript version, update paths in clients back to `dist/index.js` and `node`.