使用说明
MCP Sentry-云部署的MCP服务器🚀
将任何GitHub MCP存储库转换为 实时、可访问的MCP服务器 自动云部署到铁路。
🎯 这有什么作用
当用户通过平台注册其MCP服务器时:
- 验证和打包 -克隆仓库,安装依赖项,验证MCP协议
- 生成Dockerfile -为Node.js或Python创建优化的Docker容器
- 部署到铁路 -自动部署到Railway的云平台
- 提供URL -返回适用于任何计算机的公共HTTPS URL
部署的服务器可以与标准MCP客户端一起使用:
{
"mcpServers": {
"my-deployed-server": {
"url": "https://mcp-abc12345-production.up.railway.app"
}
}
}
🏗️ 建筑
User Submits Form
↓
GitHub Actions Workflow Triggered
↓
Inspector Script:
- Clones repo
- Installs dependencies
- Validates MCP handshake
- Generates Dockerfile
- Compiles HTTP wrapper
↓
Railway Deployment:
- Builds Docker image
- Deploys to Railway
- Generates HTTPS URL
↓
Database Updated with URL
↓
User Gets Deployment URL
🚀 快速开始
1.先决条件
- 铁路账户 (免费等级:$5/月信用)
- Supabase项目
- 此平台的GitHub存储库
2.设置铁路
- 注册于https://railway.app
- 转到帐户→ 代币
- 创建新的API令牌
- 复制令牌
3.配置机密
添加到GitHub存储库机密(设置→ 秘密和变量→ 行动):
RAILWAY_API_TOKEN=your_railway_token_here
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_key
GITHUB_PLATFORM_REPO=your-username/your-repo
GITHUB_PAT=your_github_personal_access_token
4.运行数据库迁移
在Supabase SQL编辑器中执行:
ALTER TABLE tools
ADD COLUMN IF NOT EXISTS deployment_url TEXT;
CREATE INDEX IF NOT EXISTS idx_tools_deployment_url ON tools(deployment_url);
5.安装依赖项
cd MCP_Sentry-version1
pnpm install
6.测试部署
# Start the platform
pnpm dev
# Visit http://localhost:3000
# Sign in and submit an MCP server repository
📋 运作原理
HTTP/SSE包装器
每个MCP服务器都包裹着一个HTTP层(mcp-http-wrapper.ts):
// Exposes MCP over HTTP
GET /health → Health check
GET /tools → List available MCP tools
POST /tools/call → Execute a tool
Dockerfile生成
自动检测项目类型并生成相应的Dockerfile:
- Node.js:使用npm/pnpm,必要时构建TypeScript
- python:创建venv,安装需求,处理uv/petry
铁路部署
使用Railway CLI:
- 创建新项目
- 设置环境变量(机密)
- 使用生成的Dockerfile进行部署
- 生成公共HTTPS域
🔧 支持的MCP服务器
Node.js项目
- ✅ 纯JavaScript
- ✅ TypeScript(自动编译)
- ✅ npm/pnpm/纱线
- ✅ 任何
node启动命令
Python项目
- ✅ 普通Python
- ✅
requirements.txt - ✅
pyproject.toml - ✅
uv包管理器 - ✅ 虚拟环境
📡 使用已部署的服务器
使用Claude桌面版
添加 claude_desktop_config.json:
Mac/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json
视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"my-server": {
"url": "https://your-deployment-url.railway.app"
}
}
}
使用任何MCP客户端
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
const transport = new SSEClientTransport(
new URL('https://your-deployment-url.railway.app')
);
const client = new Client({
name: 'my-client',
version: '1.0.0'
}, {
capabilities: {}
});
await client.connect(transport);
直接HTTP调用
# List tools
curl https://your-deployment-url.railway.app/tools
# Call a tool
curl -X POST https://your-deployment-url.railway.app/tools/call \
-H "Content-Type: application/json" \
-d '{
"name": "search_airbnb",
"arguments": {
"location": "Paris",
"checkin": "2025-06-01"
}
}'
💰 成本细分
铁路免费等级包括:
- $5免费信用/月
- 约500小时的计算时间
- 每个服务1 GB RAM
每个部署的MCP服务器使用:
- ~256-512 MB内存
- 最小CPU(大部分时间空闲)
- ~1-2GB存储空间
您可以在免费层中部署5-10个小型MCP服务器。
🛠️ 发展
项目结构
MCP_Sentry-version1/
├── apps/
│ ├── platform/ # Next.js web app
│ │ ├── src/app/
│ │ │ ├── api/ingest/ # Triggers deployment
│ │ │ ├── api/deployment-status/ # Polls status
│ │ │ └── components/IngestForm.tsx
│ └── gateway/ # (Legacy - not used with cloud deployment)
├── scripts/
│ ├── inspector.ts # Main orchestrator
│ ├── mcp-http-wrapper.ts # HTTP wrapper for MCP
│ ├── dockerfile-generator.ts # Generates Dockerfiles
│ └── railway-deployer.ts # Railway API integration
└── .github/workflows/
└── ingest.yml # GitHub Actions workflow
本地运行
# Platform only
pnpm --filter mcp-platform dev
# Or both platform and legacy gateway
pnpm dev
🔒 安全功能
- 独立部署 -每个MCP服务器都在自己的Railway容器中运行
- 秘密管理 -安全存储在Supabase中的环境变量
- 默认为HTTPS -所有部署都使用HTTPS
- 无共享资源 -每个部署都是独立的
🐛 故障排除
未找到铁路CLI
npm install -g @railway/cli
railway login
部署超时
- 检查GitHub操作日志
- 验证铁路令牌是否有效
- 检查铁路仪表板是否存在构建错误
MCP服务器无法启动
- 先在本地测试:
npx tsx scripts/inspector.ts - 检查启动命令是否正确
- 验证依赖项安装成功
无部署URL
- 等待5-10分钟以完成部署
- 检查铁路日志是否有错误
- 确保启用了铁路域生成
📚 API 参考
POST/api/摄取
触发MCP服务器部署。
请求:
{
"repoUrl": "https://github.com/user/mcp-server",
"userId": "user-uuid",
"startCommand": "node dist/index.js",
"configuration": {
"env": { "API_KEY": "secret" },
"defaultArguments": { "timeout": 30 }
}
}
答复:
{
"success": true,
"toolId": "tool-uuid",
"message": "Build queued successfully"
}
GET/api/部署状态?工具ID=xxx
轮询部署状态。
答复:
{
"toolId": "tool-uuid",
"status": "active",
"deploymentUrl": "https://mcp-xxx.railway.app",
"errorMessage": null
}
🤝 贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 使用真实的MCP服务器部署进行测试
- 提交拉取请求
📄 许可证
MIT许可证-有关详细信息,请参阅许可证文件
🙏 学分
内置:
由...制作❤️ 对于MCP社区