local: use fastmcp
directly
production: use fastmcp
as a gateway and cloudflare
for ssl/dns
https://***.ngrok-free.dev/mcp
curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt update && sudo apt install ngrok
http://127.0.0.1:8080/mcp
python -m venv venv
source venv/bin/activate
pip install fastmcp
Für neueste Features: pip install git+https://github.com/jlowin/fastmcp.git
pip install "fastapi[standard]"
fastmcp version
uvicorn app:app --host 0.0.0.0 --port 8000
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared jammy main' | sudo tee /etc/apt/sources.list.d/cloudflared.list
sudo apt-get update
sudo apt-get install cloudflared
cloudflared tunnel login
cloudflared tunnel create TUNNEL
cloudflared tunnel route dns --overwrite-dns TUNNEL custom-domain.xyz
// admin interface is on cloudflare.com > Zero Trust > Networks > Tunnels
cloudflared tunnel run --url http://localhost:8000 TUNNEL
https://my-mcp-server.dev/mcp
nano /etc/apache2/sites-available/mcp.conf
sudo a2ensite mcp.conf
sudo service apache2 reload
<VirtualHost *:443>
ServerName my-mcp-server.dev
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Content-Type-Options "nosniff"
Header always set X-XSS-Protection "1; mode=block"
RequestHeader set X-Real-IP "%{REMOTE_ADDR}s"
RequestHeader set X-Forwarded-Proto "https"
ProxyPreserveHost On
ProxyRequests Off
ProxyAddHeaders On
ProxyTimeout 3600
RequestReadTimeout header=60,MinRate=1 body=60,MinRate=1
ProxyPass / http://127.0.0.1:8080/ keepalive=On retry=0 flushpackets=on
ProxyPassReverse / http://127.0.0.1:8080/
<Location />
Require all granted
Header unset Connection
</Location>
SSLEngine on
SSLCertificateFile ...
SSLCertificateKeyFile ...
</VirtualHost>
Register on https://auth0.com
Applications > Applications > Create Application
For browser login
Type: Single Page Web Applications
Allowed Callback URLs: https://*.ngrok-free.app/auth/auth/callback,https://your-custom-domain.com/auth/auth/callback
Copy Client ID
and Client Secret
For api calls
Type: Machine to Machine Applications
API: Auth0 Management API > Permissions: All
Copy Client ID
and Client Secret
Applications > APIs
User Management > Create User
mcp inspector: ...
chatgpt.com/claude.ai: Login via Browser
composer require php-mcp/server
nvm use --lts
npm install @modelcontextprotocol/sdk
printf '{ "type": "module" }\n' > package.json
node mcp.js
nvm use --lts
npx -y @modelcontextprotocol/server-filesystem /var/www
note: wsl paths are not possible without mounting beforehand
add fresh chrome profile
download + unzip chrome extension from https://github.com/hangwin/mcp-chrome
chrome://extensions/
Entpackte Erweiterung laden
Ordner auswählen
In Windows (nicht WSL)
npm install -g mcp-chrome-bridge
mcp-chrome-bridge register
start server in chrome extension
wsl
cmd (admin):
netsh interface portproxy show v4tov4
netsh interface portproxy delete v4tov4 listenaddress=192.168.0.2 listenport=12306
netsh interface portproxy add v4tov4 listenaddress=192.168.0.2 listenport=12306 connectaddress=127.0.0.1 connectport=12306
powershell (admin): New-NetFirewallRule -DisplayName "chrome-mcp" -Direction Inbound -LocalPort 12306 -Action Allow -Protocol TCP
test via: http://127.0.0.1:12306/mcp
connect inside fastmcp to: http://127.0.0.1:12306/mcp (ipconfig
)
nvm use --lts
npx @playwright/mcp@latest --port 8931 --no-sandbox --timeout-action 10000 --output-dir=./mcp-out --save-session --save-trace
add mcp server through connectors
enable mcp server in chat
Einstellungen > Entwickler > Config bearbeiten > claude_desktop_config.json
Siehe unten
Neu öffnen mit: Datei > Beenden (Fenster schließen reicht nicht!)
claude_desktop_config.json
{
"mcpServers" : {
"custom" : {
"command" : " php" ,
"args" : [" /var/www/path/to/mcp.php" ]
}
}
}
{
"mcpServers" : {
"custom" : {
"command" : " npx" ,
"args" : [" mcp-remote" , " http://127.0.0.1:8080/mcp" ]
}
}
}
if available remove from PATH in windows
.\node_modules\.bin\
.\vendor\bin
edit file claude_desktop_config.json
"command" : " C:\\ Windows\\ System32\\ wsl.exe" ,
"args" : [" php" , " /var/www/path/to/_mcp/mcp.php" ],
nvm use --lts
npx @modelcontextprotocol/inspector
DANGEROUSLY_OMIT_AUTH=true npx @modelcontextprotocol/inspector
(disable security token from inspector, has nothing to do with oauth of mcps)
usage with ngrok: install chrome extension ModHeader
and set ngrok-skip-browser-warning = 69420