File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed
Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build & Deploy Docs MCP Server
2+
3+ on :
4+ push :
5+ branches : [main]
6+ paths :
7+ - " docs-mcp/**"
8+ - " pages/**"
9+ - " .github/workflows/docs-mcp.yml"
10+ workflow_dispatch :
11+
12+ permissions :
13+ contents : read
14+ packages : write
15+
16+ env :
17+ IMAGE : ghcr.io/${{ github.repository }}/docs-mcp-server
18+ DOCS_MCP_URL : https://docs-mcp.genlayer.com
19+
20+ jobs :
21+ build-and-push :
22+ runs-on : ubuntu-latest
23+ steps :
24+ - uses : actions/checkout@v4
25+
26+ - name : Log in to GitHub Container Registry
27+ uses : docker/login-action@v3
28+ with :
29+ registry : ghcr.io
30+ username : ${{ github.actor }}
31+ password : ${{ secrets.GITHUB_TOKEN }}
32+
33+ - name : Build and push
34+ uses : docker/build-push-action@v6
35+ with :
36+ context : ./docs-mcp
37+ push : true
38+ tags : |
39+ ${{ env.IMAGE }}:latest
40+ ${{ env.IMAGE }}:sha-${{ github.sha }}
41+
42+ refresh-index :
43+ runs-on : ubuntu-latest
44+ needs : build-and-push
45+ if : always()
46+ steps :
47+ - name : Trigger docs reindex
48+ run : |
49+ # Trigger a refresh of both libraries via the web UI's scrape endpoint.
50+ # Uses formMode=refresh to only re-scrape changed pages.
51+ # Fails silently if server is not yet deployed.
52+ curl -sf -X POST "${{ env.DOCS_MCP_URL }}/web/jobs/scrape" \
53+ -H "Content-Type: application/x-www-form-urlencoded" \
54+ -d "formMode=refresh&library=genlayer-docs&url=https://docs.genlayer.com&scope=hostname" \
55+ || echo "Docs refresh trigger failed (server may not be deployed yet)"
56+
57+ curl -sf -X POST "${{ env.DOCS_MCP_URL }}/web/jobs/scrape" \
58+ -H "Content-Type: application/x-www-form-urlencoded" \
59+ -d "formMode=refresh&library=genlayer-sdk&url=https://sdk.genlayer.com/main/&scope=hostname" \
60+ || echo "SDK refresh trigger failed (server may not be deployed yet)"
Original file line number Diff line number Diff line change 1+ FROM node:20-alpine
2+
3+ RUN npm install -g @arabold/docs-mcp-server
4+
5+ ENV PORT=8080
6+ ENV DOCS_URL=https://docs.genlayer.com
7+ ENV SDK_URL=https://sdk.genlayer.com/main/
8+
9+ EXPOSE 8080
10+
11+ COPY entrypoint.sh /entrypoint.sh
12+ RUN chmod +x /entrypoint.sh
13+
14+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ set -e
3+
4+ STORE_PATH=" ${STORE_PATH:-/ data} "
5+
6+ # Initial index if database doesn't exist
7+ if [ ! -f " $STORE_PATH /documents.db" ]; then
8+ echo " First boot — indexing documentation..."
9+ docs-mcp-server scrape genlayer-docs " $DOCS_URL " --store-path " $STORE_PATH "
10+ docs-mcp-server scrape genlayer-sdk " $SDK_URL " --store-path " $STORE_PATH "
11+ echo " Initial indexing complete."
12+ else
13+ echo " Existing index found at $STORE_PATH /documents.db"
14+ fi
15+
16+ echo " Starting docs-mcp-server..."
17+ exec docs-mcp-server server \
18+ --port " $PORT " \
19+ --host 0.0.0.0 \
20+ --store-path " $STORE_PATH " \
21+ --protocol http
You can’t perform that action at this time.
0 commit comments