Skip to content

Commit 768637f

Browse files
authored
Merge pull request #1 from pulseengine/feature/mcp-auth-security-framework
Feature/mcp auth security framework
2 parents 41952e9 + 06627f3 commit 768637f

File tree

118 files changed

+44581
-357
lines changed

Some content is hidden

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

118 files changed

+44581
-357
lines changed

.github/workflows/README.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# CI/CD Workflows for MCP External Validation
2+
3+
This directory contains GitHub Actions workflows for continuous integration and deployment of the MCP External Validation framework.
4+
5+
## Workflows
6+
7+
### 1. External Validation (`external-validation.yml`)
8+
**Trigger:** Push to main/develop, PRs, daily schedule, manual dispatch
9+
10+
**Purpose:** Comprehensive validation testing across platforms and Rust versions
11+
12+
**Features:**
13+
- Multi-OS testing (Ubuntu, macOS, Windows)
14+
- Multiple Rust versions (stable, nightly)
15+
- Python SDK compatibility testing
16+
- MCP Inspector integration
17+
- Property-based testing with proptest
18+
- Full compliance validation
19+
- Performance benchmarking
20+
- Security scanning
21+
22+
**Artifacts:**
23+
- Compliance reports (JSON format)
24+
- Test results
25+
26+
### 2. Docker Validation (`docker-validation.yml`)
27+
**Trigger:** Push to main/develop, PRs, manual dispatch
28+
29+
**Purpose:** Containerized validation testing
30+
31+
**Features:**
32+
- Docker image build and push to GitHub Container Registry
33+
- Multi-version protocol testing
34+
- Container-based validation runs
35+
- Matrix testing for protocol versions and transports
36+
37+
### 3. Scheduled Validation (`scheduled-validation.yml`)
38+
**Trigger:** Every 6 hours, manual dispatch
39+
40+
**Purpose:** Regular validation of external MCP servers
41+
42+
**Features:**
43+
- Tests against known MCP server implementations
44+
- Generates compatibility matrix
45+
- Creates issues for validation failures
46+
- Updates COMPATIBILITY.md automatically
47+
48+
### 4. Release Validation (`release-validation.yml`)
49+
**Trigger:** Release creation, manual dispatch
50+
51+
**Purpose:** Comprehensive validation for releases
52+
53+
**Features:**
54+
- Full test suite execution
55+
- Code coverage with Codecov
56+
- Cross-platform builds (Linux, macOS, Windows)
57+
- Release artifact generation
58+
- Automatic release notes update
59+
60+
### 5. PR Validation (`pr-validation.yml`)
61+
**Trigger:** Pull request events
62+
63+
**Purpose:** Quick validation for pull requests
64+
65+
**Features:**
66+
- Code formatting checks
67+
- Clippy linting
68+
- Unit tests
69+
- Documentation checks
70+
- Conditional testing based on changed files
71+
- Automatic PR comments with results
72+
73+
## Configuration
74+
75+
### Environment Variables
76+
- `CARGO_TERM_COLOR`: Always colored output
77+
- `RUST_BACKTRACE`: Full backtraces for debugging
78+
- `MCP_VALIDATOR_API_URL`: External MCP validator API endpoint
79+
- `JSONRPC_VALIDATOR_URL`: JSON-RPC validator endpoint
80+
81+
### Secrets Required
82+
- `GITHUB_TOKEN`: Automatically provided by GitHub Actions
83+
- No additional secrets required for public repositories
84+
85+
### Cache Configuration
86+
All workflows use GitHub Actions cache for:
87+
- Cargo registry
88+
- Git dependencies
89+
- Build artifacts
90+
91+
## Usage
92+
93+
### Manual Workflow Dispatch
94+
Most workflows support manual triggering with parameters:
95+
96+
```bash
97+
# Trigger external validation with custom server
98+
gh workflow run external-validation.yml -f server_url=https://my-mcp-server.com -f protocol_version=2024-11-05
99+
100+
# Trigger scheduled validation with custom servers
101+
gh workflow run scheduled-validation.yml -f test_servers="https://server1.com,https://server2.com"
102+
```
103+
104+
### Adding New Validation Tests
105+
1. Add test to appropriate workflow file
106+
2. Update matrix if testing multiple configurations
107+
3. Add artifact collection if needed
108+
4. Update this README
109+
110+
### Monitoring
111+
- Check Actions tab for workflow runs
112+
- Review artifacts for detailed results
113+
- Monitor issues for automated failure reports
114+
- Check COMPATIBILITY.md for server compatibility status
115+
116+
## Best Practices
117+
118+
1. **Keep workflows DRY**: Use composite actions for repeated steps
119+
2. **Use caching**: Cache dependencies and build artifacts
120+
3. **Fail fast**: Use `fail-fast: false` only when needed
121+
4. **Clean up**: Always clean up resources (servers, containers)
122+
5. **Security**: Run security scans on every PR
123+
6. **Documentation**: Update this README when adding workflows
124+
125+
## Troubleshooting
126+
127+
### Common Issues
128+
129+
1. **Python SDK tests failing**
130+
- Ensure Python 3.9+ is available
131+
- Check if MCP SDK is properly installed
132+
133+
2. **Inspector not found**
134+
- Verify download URL is correct
135+
- Check platform-specific installation
136+
137+
3. **Timeout errors**
138+
- Increase timeout values in workflow
139+
- Check server startup time
140+
141+
4. **Cache misses**
142+
- Verify cache key includes Cargo.lock
143+
- Clear cache if corrupted
144+
145+
### Debug Mode
146+
Enable debug logging by setting repository secret:
147+
- `ACTIONS_RUNNER_DEBUG=true`
148+
- `ACTIONS_STEP_DEBUG=true`
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Docker Validation
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: pulseengine/mcp-validator
13+
14+
jobs:
15+
build-validation-image:
16+
name: Build Validation Docker Image
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log in to Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=ref,event=branch
43+
type=ref,event=pr
44+
type=semver,pattern={{version}}
45+
type=semver,pattern={{major}}.{{minor}}
46+
type=sha
47+
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: .
52+
file: ./Dockerfile.validation
53+
push: true
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
58+
59+
- name: Verify image was pushed
60+
run: |
61+
echo "Built and pushed image with tags:"
62+
echo "${{ steps.meta.outputs.tags }}"
63+
# Use the short SHA format that matches the metadata tags
64+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
65+
echo "Checking if sha-tagged image exists:"
66+
docker manifest inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${SHORT_SHA} || echo "Warning: Image verification failed"
67+
68+
validate-in-container:
69+
name: Run Validation in Container
70+
needs: build-validation-image
71+
runs-on: ubuntu-latest
72+
if: success()
73+
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v4
77+
78+
- name: Log in to Container Registry
79+
uses: docker/login-action@v3
80+
with:
81+
registry: ${{ env.REGISTRY }}
82+
username: ${{ github.actor }}
83+
password: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Debug image information
86+
run: |
87+
echo "Registry: ${{ env.REGISTRY }}"
88+
echo "Image name: ${{ env.IMAGE_NAME }}"
89+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
90+
echo "Full image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${SHORT_SHA}"
91+
echo "Checking if image exists..."
92+
docker manifest inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${SHORT_SHA} || echo "Image not found"
93+
94+
- name: Run validation container
95+
run: |
96+
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
97+
docker run --rm \
98+
-v ${{ github.workspace }}:/workspace \
99+
-e RUST_LOG=info \
100+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${SHORT_SHA} \
101+
mcp-validate --server-url http://test-server:3000
102+
103+
multi-version-testing:
104+
name: Multi-Version Protocol Testing
105+
runs-on: ubuntu-latest
106+
strategy:
107+
matrix:
108+
protocol_version: ['2024-11-05', '2025-03-26']
109+
transport: ['http', 'websocket', 'stdio']
110+
111+
steps:
112+
- name: Checkout code
113+
uses: actions/checkout@v4
114+
115+
- name: Setup Rust
116+
uses: dtolnay/rust-toolchain@stable
117+
118+
- name: Test protocol version ${{ matrix.protocol_version }} with ${{ matrix.transport }}
119+
run: |
120+
cargo test --package pulseengine-mcp-external-validation \
121+
--features "proptest,fuzzing" \
122+
-- --test-threads=1 \
123+
protocol_${{ matrix.protocol_version }}_${{ matrix.transport }}
124+
env:
125+
MCP_PROTOCOL_VERSION: ${{ matrix.protocol_version }}
126+
MCP_TRANSPORT: ${{ matrix.transport }}

0 commit comments

Comments
 (0)