Skip to content

Commit 2d47b35

Browse files
committed
Add d-compose + ngrok for local & remote dev
Easier to connect to streamable http mcps if you can link remotely
1 parent 9b064b1 commit 2d47b35

File tree

4 files changed

+148
-1
lines changed

4 files changed

+148
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ __pycache__/
55

66
# C extensions
77
*.so
8-
8+
test-config.json
99
# Distribution / packaging
1010
.Python
1111
build/
@@ -197,3 +197,4 @@ cython_debug/
197197
# claude code settings
198198
.claude
199199
CLAUDE.md
200+
compose/local/ngrok/ngrok.yml

compose/local/ngrok/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM ngrok/ngrok:latest
2+
3+
RUN ngrok --version
4+
5+
# Add config script (if you want to set up multiple tunnels or use diff config)
6+
# COPY --chown=ngrok ngrok.yml /home/ngrok/.ngrok2/
7+
COPY entrypoint.sh /
8+
9+
USER ngrok
10+
ENV USER=ngrok
11+
12+
CMD ["/entrypoint.sh"]

compose/local/ngrok/entrypoint.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/sh -e
2+
3+
if [ -n "$@" ]; then
4+
exec "$@"
5+
fi
6+
7+
# Legacy compatible:
8+
if [ -z "$NGROK_PORT" ]; then
9+
if [ -n "$HTTPS_PORT" ]; then
10+
NGROK_PORT="$HTTPS_PORT"
11+
elif [ -n "$HTTP_PORT" ]; then
12+
NGROK_PORT="$HTTP_PORT"
13+
elif [ -n "$APP_PORT" ]; then
14+
NGROK_PORT="$APP_PORT"
15+
fi
16+
fi
17+
18+
ARGS="ngrok"
19+
20+
# Set the protocol.
21+
if [ "$NGROK_PROTOCOL" = "TCP" ]; then
22+
ARGS="$ARGS tcp"
23+
else
24+
ARGS="$ARGS http"
25+
NGROK_PORT="${NGROK_PORT:-80}"
26+
fi
27+
28+
# Set the TLS binding flag
29+
if [ -n "$NGROK_BINDTLS" ]; then
30+
ARGS="$ARGS --bind-tls=$NGROK_BINDTLS "
31+
fi
32+
33+
# Set the authorization token.
34+
if [ -n "$NGROK_AUTH" ]; then
35+
echo "authtoken: $NGROK_AUTH" >> ~/.ngrok2/ngrok.yml
36+
fi
37+
38+
# We use the forced NGROK_HOSTNAME here.
39+
# This requires a valid Ngrok auth token in $NGROK_AUTH
40+
if [ -n "$NGROK_HOSTNAME" ]; then
41+
if [ -z "$NGROK_AUTH" ]; then
42+
echo "You must set NGROK_AUTH (your Ngrok auth token) to use a custom domain."
43+
exit 1
44+
fi
45+
ARGS="$ARGS --url=$NGROK_HOSTNAME "
46+
fi
47+
48+
# Set the remote-addr if specified
49+
if [ -n "$NGROK_REMOTE_ADDR" ]; then
50+
if [ -z "$NGROK_AUTH" ]; then
51+
echo "You must specify an authentication token to use reserved IP addresses."
52+
exit 1
53+
fi
54+
ARGS="$ARGS --remote-addr=$NGROK_REMOTE_ADDR "
55+
fi
56+
57+
# Set a custom region
58+
if [ -n "$NGROK_REGION" ]; then
59+
ARGS="$ARGS --region=$NGROK_REGION "
60+
fi
61+
62+
if [ -n "$NGROK_HEADER" ]; then
63+
ARGS="$ARGS --host-header=$NGROK_HEADER "
64+
fi
65+
66+
# HTTP Auth config
67+
if [ -n "$NGROK_USERNAME" ] && [ -n "$NGROK_PASSWORD" ] && [ -n "$NGROK_AUTH" ]; then
68+
ARGS="$ARGS --auth=$NGROK_USERNAME:$NGROK_PASSWORD "
69+
elif [ -n "$NGROK_USERNAME" ] || [ -n "$NGROK_PASSWORD" ]; then
70+
if [ -z "$NGROK_AUTH" ]; then
71+
echo "You must specify NGROK_USERNAME, NGROK_PASSWORD, and NGROK_AUTH for custom HTTP authentication."
72+
exit 1
73+
fi
74+
fi
75+
76+
# Always log to stdout in debug mode
77+
ARGS="$ARGS --log stdout --log-level=debug"
78+
79+
# Set the port.
80+
if [ -z "$NGROK_PORT" ]; then
81+
echo "You must specify an NGROK_PORT to expose."
82+
exit 1
83+
fi
84+
85+
# Finally, add the port to the command
86+
ARGS="$ARGS $(echo $NGROK_PORT | sed 's|^tcp://||')"
87+
88+
set -x
89+
exec $ARGS

docker-compose.local.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'linkedin-mcp-server'
2+
3+
services:
4+
linkedin-mcp-server:
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
container_name: linkedin-mcp-server
9+
env_file:
10+
- .env
11+
ports:
12+
- "8080:8080"
13+
volumes:
14+
- /tmp/chrome-profile-$(date +%s%N):/tmp/chrome-profile-$(date +%s%N)
15+
- .:/app:z
16+
17+
# streamable-http or stdio
18+
command:
19+
python linkedin-mcp-server --no-headless --user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"
20+
21+
restart: unless-stopped
22+
networks:
23+
- linkedin-mcp-server-network
24+
25+
ngrok:
26+
build:
27+
context: ./compose/local/ngrok
28+
dockerfile: ./Dockerfile
29+
restart: unless-stopped
30+
command: >
31+
http
32+
127.0.0.1:8000
33+
# command: ["ngrok", "start", "--all"]
34+
environment:
35+
- NGROK_CONFIG_FILE=/home/ngrok/.ngrok2/ngrok.yml
36+
ports:
37+
- 4041:4040
38+
depends_on:
39+
- linkedin-mcp-server
40+
networks:
41+
- linkedin-mcp-server-network
42+
43+
networks:
44+
linkedin-mcp-server-network:
45+
driver: bridge

0 commit comments

Comments
 (0)