Loading...
Loading...
Welcome to MCPX! This guide will walk you through installing and setting up MCPX, the comprehensive platform for managing Model Context Protocol (MCP) servers. By the end of this tutorial, you'll have MCPX running locally with your first workspace configured.
Before we begin, make sure you have the following installed:
npm install -g pnpmFirst, let's get the MCPX codebase and install dependencies:
# Clone the repository
git clone https://github.com/your-org/mcpx.git
cd mcpx
# Install dependencies using PNPM
pnpm install
# Copy environment variables
cp .env.example .env.local
Open .env.local and configure the essential variables:
# Database Configuration
DATABASE_URL="postgresql://user:password@localhost:5432/mcpx"
# API Configuration
API_GATEWAY_URL="http://localhost:8080"
T3_API_SECRET="your-secret-key-here"
# Application URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# Docker Configuration (for MCP containers)
DOCKER_HOST="unix:///var/run/docker.sock"
MCPX uses Prisma for database management. Let's set up the database schema:
# Generate Prisma client
pnpm nx run @mcpx/database:generate
# Push schema to database
pnpm nx run @mcpx/database:db-push
# (Optional) Seed with sample data
pnpm nx run @mcpx/database:seed
MCPX consists of multiple services that work together. Let's start them:
# Start the main development environment (app + API gateway)
pnpm dev:main
# This starts:
# - Next.js app on http://localhost:3000
# - API Gateway on http://localhost:8080
You should see output like:
> nx run-many -t serve -p app,api-gateway
✔ app:serve
▲ Ready on http://localhost:3000
✔ api-gateway:serve
🚀 API Gateway running on http://localhost:8080
Open your browser and navigate to http://localhost:3000. You'll see the MCPX dashboard.
In MCPX, workspaces provide isolated environments for MCP servers:
Your organization comes with a default workspace automatically created.
MCPX uses a microservices architecture:
┌─────────────┐ ┌──────────────┐ ┌──────────────┐
│ Next.js │────▶│ API Gateway │────▶│ Docker │
│ Dashboard │ │ (Express) │ │ Containers │
└─────────────┘ └──────────────┘ └──────────────┘
│ │ │
└────────────────────┴─────────────────────┘
│
┌──────────────┐
│ PostgreSQL │
│ Database │
└──────────────┘
/apps/app): The web dashboard for managing MCP servers/apps/api-gateway): Orchestrates MCP server operationsLet's verify everything is working correctly:
curl http://localhost:8080/health
Expected response:
{
"status": "healthy",
"timestamp": "2025-01-02T10:00:00.000Z"
}
pnpm nx run @mcpx/database:studio
This opens Prisma Studio where you can browse your database tables.
Here are essential commands for working with MCPX:
# Run specific services
nx serve app # Just the Next.js app
nx serve api-gateway # Just the API gateway
# Build for production
nx build app
nx build api-gateway
# Run tests
nx test app
nx test api-gateway
# Lint code
nx lint app
# Database migrations
nx run @mcpx/database:migrate
If you encounter Docker permission errors:
# Add your user to the docker group
sudo usermod -aG docker $USER
# Log out and back in, or run:
newgrp docker
If ports 3000 or 8080 are already in use:
# Find process using port
lsof -i :3000
# Kill the process
kill -9 <PID>
# Or use different ports in .env.local
PORT=3001
API_GATEWAY_PORT=8081
Ensure PostgreSQL is running:
# Check PostgreSQL status
systemctl status postgresql
# Start PostgreSQL
systemctl start postgresql
Understanding the MCPX project structure helps with development:
mcpx/
├── apps/
│ ├── app/ # Next.js dashboard
│ ├── api-gateway/ # Express API gateway
│ └── marketing/ # Marketing website
├── packages/
│ ├── @mcpx/database/ # Prisma schemas
│ ├── @mcpx/mcpx-server/ # Core MCP implementation
│ └── @mcpx/shared/ # Shared utilities
└── nx.json # Nx workspace configuration
Congratulations! You now have MCPX running locally. Here's what to explore next:
You've successfully:
MCPX is now ready for you to start adding and managing MCP servers. Happy building!