Skip to content

Commit c306080

Browse files
author
“Tomer
committed
created http stream mcp template
1 parent fef03ca commit c306080

65 files changed

Lines changed: 17809 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Dependencies
2+
node_modules
3+
npm-debug.log*
4+
5+
# Build outputs
6+
dist
7+
coverage
8+
9+
# Development files
10+
.git
11+
.gitignore
12+
README.md
13+
.eslintrc.json
14+
.prettierrc
15+
vitest.config.ts
16+
17+
# IDE files
18+
.vscode
19+
.idea
20+
*.swp
21+
*.swo
22+
23+
# OS files
24+
.DS_Store
25+
Thumbs.db
26+
27+
# Environment files
28+
.env
29+
.env.local
30+
.env.*.local
31+
32+
# Logs
33+
logs
34+
*.log
35+
36+
# Test files (for production build)
37+
tests
38+
*.test.ts
39+
*.spec.ts
40+
41+
# Documentation
42+
docs
43+
examples

.eslintrc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"extends": [
4+
"eslint:recommended"
5+
],
6+
"plugins": ["@typescript-eslint"],
7+
"parserOptions": {
8+
"ecmaVersion": 2022,
9+
"sourceType": "module"
10+
},
11+
"rules": {
12+
"@typescript-eslint/no-unused-vars": "error",
13+
"@typescript-eslint/no-explicit-any": "warn",
14+
"prefer-const": "error",
15+
"no-var": "error"
16+
},
17+
"env": {
18+
"node": true,
19+
"es2022": true
20+
}
21+
}

.github/workflows/ci.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: CI/CD Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
name: Test and Build
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18.x, 20.x]
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: 'npm'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run type checking
32+
run: npm run typecheck
33+
34+
- name: Run linter
35+
run: npm run lint
36+
37+
- name: Check code formatting
38+
run: npm run format:check
39+
40+
- name: Run tests with coverage
41+
run: npm run test:coverage
42+
43+
- name: Upload coverage to Codecov
44+
uses: codecov/codecov-action@v3
45+
with:
46+
file: ./coverage/coverage-final.json
47+
flags: unittests
48+
name: codecov-umbrella
49+
50+
- name: Build project
51+
run: npm run build
52+
53+
- name: Test built application
54+
run: |
55+
timeout 10s npm start &
56+
sleep 5
57+
curl -f http://localhost:3000/health || exit 1
58+
59+
docker:
60+
name: Docker Build
61+
runs-on: ubuntu-latest
62+
needs: test
63+
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v4
67+
68+
- name: Set up Docker Buildx
69+
uses: docker/setup-buildx-action@v3
70+
71+
- name: Build production Docker image
72+
run: |
73+
docker build -t http-stream-mcp-template:latest .
74+
75+
- name: Test Docker image
76+
run: |
77+
docker run -d --name test-container -p 3000:3000 http-stream-mcp-template:latest
78+
sleep 10
79+
curl -f http://localhost:3000/health || exit 1
80+
docker stop test-container
81+
docker rm test-container
82+
83+
- name: Build development Docker image
84+
run: |
85+
docker build -f Dockerfile.dev -t http-stream-mcp-template:dev .
86+
87+
security:
88+
name: Security Scan
89+
runs-on: ubuntu-latest
90+
91+
steps:
92+
- name: Checkout code
93+
uses: actions/checkout@v4
94+
95+
- name: Run npm audit
96+
run: npm audit --audit-level moderate
97+
98+
- name: Run Trivy vulnerability scanner
99+
uses: aquasecurity/trivy-action@master
100+
with:
101+
scan-type: 'fs'
102+
scan-ref: '.'
103+
format: 'sarif'
104+
output: 'trivy-results.sarif'
105+
106+
- name: Upload Trivy scan results to GitHub Security tab
107+
uses: github/codeql-action/upload-sarif@v2
108+
if: always()
109+
with:
110+
sarif_file: 'trivy-results.sarif'

.github/workflows/deploy.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
8+
jobs:
9+
deploy:
10+
name: Deploy to Production
11+
runs-on: ubuntu-latest
12+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20.x'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Run tests
28+
run: npm run test:ci
29+
30+
- name: Build project
31+
run: npm run build
32+
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v3
35+
36+
- name: Login to Docker Hub
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{ secrets.DOCKER_USERNAME }}
40+
password: ${{ secrets.DOCKER_PASSWORD }}
41+
42+
- name: Extract metadata
43+
id: meta
44+
uses: docker/metadata-action@v5
45+
with:
46+
images: ${{ secrets.DOCKER_USERNAME }}/http-stream-mcp-template
47+
tags: |
48+
type=ref,event=branch
49+
type=ref,event=pr
50+
type=semver,pattern={{version}}
51+
type=semver,pattern={{major}}.{{minor}}
52+
53+
- name: Build and push Docker image
54+
uses: docker/build-push-action@v5
55+
with:
56+
context: .
57+
push: true
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
cache-from: type=gha
61+
cache-to: type=gha,mode=max
62+
63+
# Example deployment to a server (uncomment and configure as needed)
64+
# - name: Deploy to server
65+
# uses: appleboy/ssh-action@v1.0.0
66+
# with:
67+
# host: ${{ secrets.HOST }}
68+
# username: ${{ secrets.USERNAME }}
69+
# key: ${{ secrets.KEY }}
70+
# script: |
71+
# docker pull ${{ secrets.DOCKER_USERNAME }}/http-stream-mcp-template:main
72+
# docker stop mcp-server || true
73+
# docker rm mcp-server || true
74+
# docker run -d --name mcp-server -p 3000:3000 \
75+
# -e NODE_ENV=production \
76+
# -e MCP_ALLOWED_ORIGINS="${{ secrets.MCP_ALLOWED_ORIGINS }}" \
77+
# --restart unless-stopped \
78+
# ${{ secrets.DOCKER_USERNAME }}/http-stream-mcp-template:main

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Dependencies
2+
node_modules/
3+
npm-debug.log*
4+
yarn-debug.log*
5+
yarn-error.log*
6+
7+
# Build outputs
8+
dist/
9+
build/
10+
*.tsbuildinfo
11+
12+
# Environment variables
13+
.env
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
# IDE files
20+
.vscode/
21+
.idea/
22+
*.swp
23+
*.swo
24+
*~
25+
26+
# OS files
27+
.DS_Store
28+
Thumbs.db
29+
30+
# Test coverage
31+
coverage/
32+
.nyc_output/
33+
34+
# Logs
35+
logs/
36+
*.log
37+
38+
# Runtime data
39+
pids/
40+
*.pid
41+
*.seed
42+
*.pid.lock
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional eslint cache
48+
.eslintcache
49+
50+
# Temporary folders
51+
tmp/
52+
temp/

0 commit comments

Comments
 (0)