Getting Started with Development
This guide will help you set up your development environment for contributing to Pcnaid MCP Hub.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:
4. Database Setup
If using PostgreSQL, create a database:5. MCP Server Configuration
Create or modifymcp_settings.json:
Development Workflow
Running the Development Server
Start both backend and frontend in development mode:- Backend server on
http://localhost:3000 - Frontend development server on
http://localhost:5173
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:http://localhost:9229.
Making Changes
Backend Development
- Controllers: Handle HTTP requests and responses
- Services: Implement business logic
- Models: Define database schemas
- Routes: Define API endpoints
Frontend Development
- Components: Reusable React components
- Pages: Route-specific components
- Services: API communication
- Hooks: Custom React hooks
Adding New MCP Servers
- Update
mcp_settings.jsonwith the new server configuration - Test the server integration
- Update documentation if needed
Common Development Tasks
Adding a New API Endpoint
- Create a controller in
src/controllers/ - Define the route in
src/routes/ - Add any necessary middleware
- Write tests for the new endpoint
Adding a New Frontend Feature
- Create components in
frontend/src/components/ - Add routes if needed
- Implement API integration
- Style with Tailwind CSS
Database Migrations
When modifying database schemas:- Update models in
src/models/ - Create migration scripts if using TypeORM
- 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 inmcp_settings.json
Permission issues: Ensure MCP servers have necessary permissions
Getting Help
- Check the Contributing Guide
- Review Architecture Documentation
- Open an issue on GitHub for bugs
- Join our community discussions
Next Steps
- Read the Architecture Overview
- Learn about Contributing Guidelines
- Explore Configuration Options