Skip to main content

Getting Started with Development

This guide will help you set up your development environment for contributing to MCPHub.

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js (version 18 or higher)
  • pnpm (recommended package manager)
  • Git
  • Docker (optional, for containerized development)

Setting Up the Development Environment

1. Clone the Repository

2. Install Dependencies

3. Environment Configuration

Create a .env file in the root directory:
Configure the following environment variables:

4. Database Setup

If using PostgreSQL, create a database:

5. MCP Server Configuration

Create or modify mcp_settings.json:

Development Workflow

Running the Development Server

Start both backend and frontend in development mode:
This will start:
  • Backend server on http://localhost:3000
  • Frontend development server on http://localhost:5173
Local development uses admin / admin123 and writes runtime changes to data/mcp_settings.dev.json. The repository mcp_settings.json remains credential-free.

Running Backend Only

Running Frontend Only

Building the Project

Build both backend and frontend:

Project Structure

Development Tools

Linting and Formatting

Testing

Debugging

To debug the backend with Node.js inspector:
Then attach your debugger to http://localhost:9229.

Making Changes

Backend Development

  1. Controllers: Handle HTTP requests and responses
  2. Services: Implement business logic
  3. Models: Define database schemas
  4. Routes: Define API endpoints

Frontend Development

  1. Components: Reusable React components
  2. Pages: Route-specific components
  3. Services: API communication
  4. Hooks: Custom React hooks

Adding New MCP Servers

  1. Update mcp_settings.json with the new server configuration
  2. Test the server integration
  3. Update documentation if needed

Common Development Tasks

Adding a New API Endpoint

  1. Create a controller in src/controllers/
  2. Define the route in src/routes/
  3. Add any necessary middleware
  4. Write tests for the new endpoint

Adding a New Frontend Feature

  1. Create components in frontend/src/components/
  2. Add routes if needed
  3. Implement API integration
  4. Style with Tailwind CSS

Database Migrations

When modifying database schemas:
  1. Update models in src/models/
  2. Create migration scripts if using TypeORM
  3. Test migrations locally

Troubleshooting

Common Issues

Port conflicts: Ensure ports 3000 and 5173 are available Database connection: Verify PostgreSQL is running and credentials are correct MCP server startup: Check server configurations in mcp_settings.json Permission issues: Ensure MCP servers have necessary permissions

Getting Help

Next Steps