Skip to content

Commit 89571a8

Browse files
Disturbingdisturbingjuliux9
authored
feat/playground (#41)
* Initial chat working in browser. * server add * new server * Proxy implementation for playground. * Current state saved * Refactor mcp proxy locaiton + refactor tests to use websocket tunnel. * Fix all packages and dev to be able to start effectively for playground * Fix hibneraiton issues and status checks * Realtime connection states donezo * Fix configuration for new mcps. * Package for external react components + example implementation * docs(changeset): New MCP proxy support and Playground for local mcp testing * Minor package bumps * temporary mcp tools server until we upgrade into index.ts * Migrate to pnpm + update auto build and deps * Migrate projects to pnpm * index.ts with tools * Working tool calls. * Remove excessive logging * Fix reconnection logic for MCP client * Configure system prompts and advance usage from the ui * Error handling and user friendly responses. * Fix deps and cleanup old code thats not used * Update to 1.13 consistent sdk across all . * docker updates with new dependencies * updated test figma * remove double * small readme updates * another README update * Stash commit of work for playground * Reconnect playground logic to UI. * Update pnpm-lock.yaml with new @radix-ui/react-tabs dependency and improve CSS styles for model selector and dropdown components to match design specifications. Enhance chat API with detailed logging for debugging and refactor model fetching logic in chat components. * Animation for mcp server load * Production ready docker file * Fix builds * Fix mcp toolbox builds * Remove old builds * Fix misc build errors. * Lint fixes * Ignore data! * And ignore db * Reorganize files and builds now bundled correctly. * Fix mcp proxy to work with live registry image. * Fix linting and various bugs * Fix linting errors * More linting fixes. * Refactor MCP server components to support installer preferences and Cursor deeplink generation. Added new icons and improved dropdown functionality for installation options. * More lint fixes. * MOre lint fixes * Update license to prevent platform competition * Fix lint * Fix crud-mcp build * Fix config. * Fix images to be in the palyground showcase. * ATtempt fix build linting * Fix formatting for the landing page. * Playground refactor. * docs(changeset): Introducing playround and mcp proxy support * docs(changeset): playground introduction * Proper merge bump fixes. * Fix compile errors * Fix references * Fix linting errors * Linting consistency * Fix playground example linting errors * Fix accidental ignore * Fix tests * Fix build deps * Temp pause of crud MCP. * Delete incorrect vibe coded file --------- Co-authored-by: disturbing <hello@xavalabs.com> Co-authored-by: juliux <jules@avalaunch.app>
1 parent a433808 commit 89571a8

File tree

206 files changed

+70423
-34329
lines changed

Some content is hidden

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

206 files changed

+70423
-34329
lines changed

.changeset/soft-vans-lie.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@xava-labs/playground": patch
3+
"@xava-labs/mcp": patch
4+
---
5+
6+
playground introduction
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Cleanup old preview Docker images for mcp-toolbox
2+
name: Cleanup MCP Toolbox Preview Images
3+
4+
on:
5+
schedule:
6+
# Run daily at 2:00 AM UTC
7+
- cron: '0 2 * * *'
8+
workflow_dispatch:
9+
# Allow manual trigger
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}/mcp-toolbox
14+
15+
jobs:
16+
cleanup-preview-images:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Log in to Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Clean up old preview images
34+
uses: actions/github-script@v7
35+
with:
36+
script: |
37+
const owner = context.repo.owner;
38+
const packageName = '${{ env.IMAGE_NAME }}'.split('/').pop();
39+
40+
// Calculate cutoff date (7 days ago)
41+
const cutoffDate = new Date();
42+
cutoffDate.setDate(cutoffDate.setDate() - 7);
43+
44+
let deletedCount = 0;
45+
let totalChecked = 0;
46+
47+
try {
48+
// Get all versions of the package
49+
const { data: versions } = await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({
50+
package_type: 'container',
51+
package_name: packageName,
52+
org: owner,
53+
per_page: 100
54+
});
55+
56+
console.log(`Found ${versions.length} total package versions`);
57+
58+
for (const version of versions) {
59+
totalChecked++;
60+
61+
// Check if this is a preview image (has pr- prefix in tags)
62+
const isPreviewImage = version.metadata?.container?.tags?.some(tag =>
63+
tag.startsWith('pr-') || tag.includes('-pr-')
64+
);
65+
66+
if (!isPreviewImage) {
67+
console.log(`Skipping non-preview version: ${version.id} (tags: ${version.metadata?.container?.tags?.join(', ') || 'none'})`);
68+
continue;
69+
}
70+
71+
const versionDate = new Date(version.created_at);
72+
73+
if (versionDate < cutoffDate) {
74+
try {
75+
await github.rest.packages.deletePackageVersionForOrg({
76+
package_type: 'container',
77+
package_name: packageName,
78+
org: owner,
79+
package_version_id: version.id
80+
});
81+
82+
deletedCount++;
83+
console.log(`✅ Deleted preview image version ${version.id} (created: ${version.created_at}, tags: ${version.metadata?.container?.tags?.join(', ') || 'none'})`);
84+
} catch (error) {
85+
console.log(`❌ Failed to delete version ${version.id}: ${error.message}`);
86+
}
87+
} else {
88+
console.log(`⏭️ Keeping recent preview version ${version.id} (created: ${version.created_at})`);
89+
}
90+
}
91+
92+
// Generate summary
93+
const summary = `## 🧹 MCP Toolbox Preview Image Cleanup
94+
95+
**Cleanup Summary:**
96+
- **Total versions checked:** ${totalChecked}
97+
- **Preview images deleted:** ${deletedCount}
98+
- **Cutoff date:** ${cutoffDate.toISOString()}
99+
100+
**Retention Policy:**
101+
- Preview images older than 7 days are automatically deleted
102+
- Production images (\`latest\`, \`main-*\`, version tags) are preserved
103+
104+
${deletedCount > 0 ? '✅ Cleanup completed successfully' : 'ℹ️ No preview images needed cleanup'}
105+
`;
106+
107+
console.log(summary);
108+
109+
// Write to job summary
110+
require('fs').appendFileSync(process.env.GITHUB_STEP_SUMMARY, summary);
111+
112+
} catch (error) {
113+
console.error('Error during cleanup:', error);
114+
115+
const errorSummary = `## ❌ MCP Toolbox Preview Image Cleanup Failed
116+
117+
**Error:** ${error.message}
118+
119+
**Details:**
120+
- Package: \`${packageName}\`
121+
- Registry: \`${{ env.REGISTRY }}\`
122+
- Organization: \`${owner}\`
123+
`;
124+
125+
require('fs').appendFileSync(process.env.GITHUB_STEP_SUMMARY, errorSummary);
126+
throw error;
127+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Build and push preview Docker images for the mcp-toolbox package
2+
name: MCP Toolbox Preview Build
3+
4+
on:
5+
pull_request:
6+
branches: [main, develop]
7+
paths:
8+
- 'packages/mcp-toolbox/**'
9+
- 'packages/mcp/**'
10+
- 'packages/mcp-proxy/**'
11+
- '.github/workflows/mcp-toolbox-preview.yml'
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}/mcp-toolbox
16+
17+
jobs:
18+
build-preview:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
pull-requests: write
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Log in to Container Registry
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract metadata
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
tags: |
45+
type=ref,event=pr
46+
type=sha,prefix=pr-${{ github.event.number }}-
47+
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@v5
50+
with:
51+
context: .
52+
file: mcp-toolbox.Dockerfile
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+
platforms: linux/amd64,linux/arm64
59+
60+
- name: Comment PR with image info
61+
uses: actions/github-script@v7
62+
with:
63+
script: |
64+
const { data: comments } = await github.rest.issues.listComments({
65+
issue_number: context.issue.number,
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
});
69+
70+
const botComment = comments.find(comment =>
71+
comment.user.type === 'Bot' &&
72+
comment.body.includes('🐳 Preview MCP Toolbox Docker Image')
73+
);
74+
75+
const commentBody = `🐳 **Preview MCP Toolbox Docker Image Built**
76+
77+
**Image:** \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}\`
78+
79+
**Tags:**
80+
${{ steps.meta.outputs.tags }}
81+
82+
**Usage:**
83+
\`\`\`bash
84+
# Pull the preview image
85+
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}
86+
87+
# Run the MCP Toolbox server
88+
docker run -p 11990:11990 \\
89+
-e PROXY_ID=preview-toolbox-${{ github.event.number }} \\
90+
-e MCP_SERVER_HOST=host.docker.internal:6050 \\
91+
--add-host host.docker.internal:host-gateway \\
92+
-v \$(pwd)/data:/app/data \\
93+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}
94+
\`\`\`
95+
96+
**Health Check:**
97+
\`\`\`bash
98+
curl http://localhost:11990/health
99+
\`\`\`
100+
101+
**Note:** Preview images are automatically cleaned up after 7 days.
102+
`;
103+
104+
if (botComment) {
105+
await github.rest.issues.updateComment({
106+
comment_id: botComment.id,
107+
owner: context.repo.owner,
108+
repo: context.repo.repo,
109+
body: commentBody
110+
});
111+
} else {
112+
await github.rest.issues.createComment({
113+
issue_number: context.issue.number,
114+
owner: context.repo.owner,
115+
repo: context.repo.repo,
116+
body: commentBody
117+
});
118+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Build and push production Docker images for the mcp-toolbox package
2+
name: MCP Toolbox Production Build
3+
4+
on:
5+
push:
6+
branches: [main]
7+
paths:
8+
- 'packages/mcp-toolbox/**'
9+
- 'packages/mcp/**'
10+
- 'packages/mcp-proxy/**'
11+
- '.github/workflows/mcp-toolbox-production.yml'
12+
release:
13+
types: [published]
14+
15+
env:
16+
REGISTRY: ghcr.io
17+
IMAGE_NAME: ${{ github.repository }}/mcp-toolbox
18+
19+
jobs:
20+
build-production:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v4
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Log in to Container Registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Extract metadata
41+
id: meta
42+
uses: docker/metadata-action@v5
43+
with:
44+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
tags: |
46+
type=ref,event=branch
47+
type=semver,pattern={{version}}
48+
type=semver,pattern={{major}}.{{minor}}
49+
type=semver,pattern={{major}}
50+
type=sha,prefix={{branch}}-
51+
type=raw,value=latest,enable={{is_default_branch}}
52+
53+
- name: Build and push Docker image
54+
uses: docker/build-push-action@v5
55+
with:
56+
context: .
57+
file: mcp-toolbox.Dockerfile
58+
push: true
59+
tags: ${{ steps.meta.outputs.tags }}
60+
labels: ${{ steps.meta.outputs.labels }}
61+
cache-from: type=gha
62+
cache-to: type=gha,mode=max
63+
platforms: linux/amd64,linux/arm64
64+
65+
- name: Generate deployment summary
66+
run: |
67+
echo "## 🚀 MCP Toolbox Docker Image Deployed" >> $GITHUB_STEP_SUMMARY
68+
echo "" >> $GITHUB_STEP_SUMMARY
69+
echo "**Registry:** \`${{ env.REGISTRY }}\`" >> $GITHUB_STEP_SUMMARY
70+
echo "**Image:** \`${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}\`" >> $GITHUB_STEP_SUMMARY
71+
echo "" >> $GITHUB_STEP_SUMMARY
72+
echo "**Tags:**" >> $GITHUB_STEP_SUMMARY
73+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
74+
echo "${{ steps.meta.outputs.tags }}" >> $GITHUB_STEP_SUMMARY
75+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
76+
echo "" >> $GITHUB_STEP_SUMMARY
77+
echo "**Usage:**" >> $GITHUB_STEP_SUMMARY
78+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
79+
echo "# Pull the latest image" >> $GITHUB_STEP_SUMMARY
80+
echo "docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_STEP_SUMMARY
81+
echo "" >> $GITHUB_STEP_SUMMARY
82+
echo "# Run the MCP Toolbox server" >> $GITHUB_STEP_SUMMARY
83+
echo "docker run -p 11990:11990 \\" >> $GITHUB_STEP_SUMMARY
84+
echo " -e PROXY_ID=your-unique-proxy-id \\" >> $GITHUB_STEP_SUMMARY
85+
echo " -e MCP_SERVER_HOST=host.docker.internal:6050 \\" >> $GITHUB_STEP_SUMMARY
86+
echo " -e PORT=11990 \\" >> $GITHUB_STEP_SUMMARY
87+
echo " -e DB_PATH=/app/data/packages.db \\" >> $GITHUB_STEP_SUMMARY
88+
echo " --add-host host.docker.internal:host-gateway \\" >> $GITHUB_STEP_SUMMARY
89+
echo " -v \$(pwd)/data:/app/data \\" >> $GITHUB_STEP_SUMMARY
90+
echo " ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_STEP_SUMMARY
91+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
92+
93+
- name: Update package description
94+
uses: actions/github-script@v7
95+
with:
96+
script: |
97+
const packageName = `${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}`.toLowerCase();
98+
99+
try {
100+
await github.rest.packages.updatePackageForOrg({
101+
package_type: 'container',
102+
package_name: packageName.split('/').pop(),
103+
org: context.repo.owner,
104+
description: 'MCP Toolbox - A lightweight, bundled WebSocket server for managing MCP (Model Context Protocol) packages with pure JavaScript SQLite persistence',
105+
homepage_url: `https://github.com/${context.repo.owner}/${context.repo.repo}`,
106+
public: true
107+
});
108+
console.log('✅ Package description updated successfully');
109+
} catch (error) {
110+
console.log('⚠️ Could not update package description:', error.message);
111+
}
112+
113+
security-scan:
114+
runs-on: ubuntu-latest
115+
needs: build-production
116+
permissions:
117+
contents: read
118+
packages: read
119+
security-events: write
120+
121+
steps:
122+
- name: Run Trivy vulnerability scanner
123+
uses: aquasecurity/trivy-action@master
124+
with:
125+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
126+
format: 'sarif'
127+
output: 'trivy-results.sarif'
128+
129+
- name: Upload Trivy scan results to GitHub Security tab
130+
uses: github/codeql-action/upload-sarif@v3
131+
if: always()
132+
with:
133+
sarif_file: 'trivy-results.sarif'

0 commit comments

Comments
 (0)