Ubuntu VPS as a remote MCP server for Claude iPhone
Let me provide the general guide for setting up Ubuntu VPS as a remote MCP server for Claude iPhone.
Here’s the complete guide for your setup:
Ubuntu VPS as Remote MCP Server for Claude iPhone
Architecture Overview
iPhone (Claude app)
│
▼
Anthropic Cloud ←── Claude connects via Anthropic's infrastructure
│
▼
Your Ubuntu VPS (public IP + HTTPS + MCP server)
│
▼
Your tools/files/Obsidian vault
Key point: Claude connects to your MCP server from Anthropic’s cloud infrastructure, not from your local device. So your VPS must be reachable over the public internet from Anthropic’s IP ranges.
Step-by-Step Setup
Step 1 — Choose Your MCP Server Framework
The simplest approach for a Python-based server on Ubuntu:
pip install "mcp[cli]"
Or Node.js-based:
npm install -g @modelcontextprotocol/sdk
Step 2 — Create a Simple MCP Server
Example: a minimal HTTP MCP server in Python (server.py):
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("my-vps-tools")
@mcp.tool()
def read_file(path: str) -> str:
"""Read a file from the VPS"""
with open(path, "r") as f:
return f.read()
@mcp.tool()
def run_command(cmd: str) -> str:
"""Run a shell command"""
import subprocess
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
return result.stdout
if name == "main":
mcp.run(transport="streamable-http", host="0.0.0.0", port=8080)
Step 3 — Set Up HTTPS (Required!)
Remote MCP servers must be reachable over the public internet — servers behind a VPN or firewall that blocks Anthropic’s IPs will fail to connect.
Use Caddy (easiest for auto HTTPS) on Ubuntu:
Install Caddy
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
sudo apt update && sudo apt install caddy
Edit Caddyfile
sudo nano /etc/caddy/Caddyfile
yourdomain.com {
reverse_proxy localhost:8080
}
sudo systemctl reload caddy
You need a domain name pointing to your VPS IP. Free options: duckdns.org, no-ip.com
Step 4 — Run MCP Server as a Service
sudo nano /etc/systemd/system/mcp-server.service
[Unit]
Description=MCP Server
After=network.target
[Service]
ExecStart=/usr/bin/python3 /home/ubuntu/mcp/server.py
Restart=always
User=ubuntu
[Install]
WantedBy=multi-user.target
sudo systemctl enable mcp-server
sudo systemctl start mcp-server
Step 5 — Register in Claude.ai (Syncs to iPhone)
You cannot configure MCP from the mobile app directly — you must add it through claude.ai on the web, and settings automatically sync to mobile. 
- Go to claude.ai → Settings → Connectors
- Click “Add custom connector”
- Enter: https://yourdomain.com/mcp
- Click Add
Then on iPhone, it’s available automatically ✅
Auth Options
| Option | Complexity | Recommended for |
|---|---|---|
| No auth (IP allowlist only) | Easy | Personal use, private VPS |
| API key header | Medium | Simple personal use |
| OAuth 2.0 | Hard | Production / shared use |
For personal use, Claude supports both authless and OAuth-based remote servers. Authless is fine if your VPS is personal.
For Obsidian Specifically
If your vault is on the VPS, add an Obsidian-specific tool to the server:
@mcp.tool()
def read_note(note_name: str) -> str:
"""Read an Obsidian note"""
vault_path = "/home/ubuntu/obsidian-vault"
import os
for root, dirs, files in os.walk(vault_path):
for f in files:
if note_name.lower() in f.lower():
with open(os.path.join(root, f)) as fp:
return fp.read()
return "Note not found"
Summary Checklist
• Ubuntu VPS with public IP
• MCP server running on a port (e.g., 8080)
• Domain name → VPS IP (DNS設定)
• Caddy/Nginx for HTTPS
• Systemd service for auto-restart
• Register URL in claude.ai → Connectors
👁 Views: 2