Prerequisites
Node.js v18.0.0 or higher is required for native fetch support.
- Node.js >= v18.0.0
- npm (comes with Node.js)
- Git
- A running Dokploy server instance for testing
Clone and Install
- Fork and clone the repository:
- Set upstream remote (for contributors):
- Install dependencies:
@modelcontextprotocol/sdk- MCP protocol implementationaxios- HTTP client for Dokploy APIzod- Schema validationexpress- HTTP server (for HTTP mode)- TypeScript and ESLint tooling
Available Scripts
Thepackage.json defines several useful scripts:
Build Commands
Run Commands
Code Quality
Development Workflow
1. Set Up Environment Variables
Create a local configuration for testing. You’ll need:DOKPLOY_URL: Your Dokploy server API URL (e.g.,https://your-dokploy-server.com/api)DOKPLOY_API_KEY: Your Dokploy API authentication token
2. Build the Project
build/ directory.
3. Test Locally with MCP Inspector
The MCP Inspector is the recommended way to test your changes:- Interactive tool testing
- Request/response inspection
- Schema validation
- Real-time debugging
4. Test with Your MCP Client
Configure your MCP client to use your local build:/path/to/dokploy-mcp with the actual path to your cloned repository.
5. Make Changes
The development cycle:- Make code changes in
src/ - Run
npm run buildto compile - Test with MCP Inspector or your MCP client
- Run
npm run precommitto verify code quality - Repeat as needed
Code Structure Overview
Understanding the codebase structure:Key Files
- src/index.ts:42 - Main entry point that determines transport mode (stdio or HTTP)
- src/server.ts - Creates and configures the MCP server instance
- src/http-server.ts - Express-based HTTP server for web deployments
- src/mcp/tools/ - Tool implementations using Zod schemas for validation
Adding a New Tool
When adding new Dokploy tools:- Create a new file in the appropriate
src/mcp/tools/subdirectory - Define the tool schema using Zod
- Implement the handler function
- Add semantic annotations (
readOnlyHint,destructiveHint,idempotentHint) - Register the tool in the server configuration
- Update documentation in
TOOLS.md
Testing Strategies
Manual Testing
- Unit testing: Test individual tool functions
- Integration testing: Test with MCP Inspector
- End-to-end testing: Test with real MCP clients (Claude Desktop, VS Code)
Test Both Transport Modes
Always test changes in both modes:Debugging Tips
Enable Verbose Logging
The codebase uses a custom logger (seesrc/utils/logger.js). Logs go to stderr to avoid interfering with stdio transport.
Common Issues
TypeScript compilation errors
TypeScript compilation errors
Run
npm run type-check to see detailed type errors without generating build artifacts.ESLint errors
ESLint errors
Run
npm run lint:fix to automatically fix common linting issues.Runtime errors in stdio mode
Runtime errors in stdio mode
Check that you’re not logging to stdout - use the logger utility which writes to stderr.
HTTP mode not starting
HTTP mode not starting
Ensure port 3000 is available or set a different port via code changes.
Inspect Tool Schemas
Use the MCP Inspector to validate your tool schemas are correct:Contributing Guidelines
Read the full contributing guide
Learn about the contribution process, coding guidelines, and how to submit pull requests.
Quick Contributing Checklist
Before submitting a pull request:- Code follows existing style conventions
- All linting and formatting checks pass (
npm run precommit) - TypeScript compiles without errors (
npm run build) - Changes are tested with MCP Inspector
- Documentation is updated if needed
- Commit messages follow conventional format
Branch Naming
Commit Message Format
Next Steps
- Deploy with Docker for production testing
- Check Troubleshooting for common development issues
- Explore the Tools Reference to understand available operations
- Read TOOLS.md for detailed tool schemas