Skip to main content

Development Guide

This guide provides instructions for developing and contributing to the CWCloud MCP Server.

Project Structure​

cwcloud-mcp/
β”œβ”€β”€ cmd/server/ # Application entry point
β”‚ └── main.go # Main application bootstrap
β”œβ”€β”€ internal/ # Internal application code (private)
β”‚ β”œβ”€β”€ types/ # CENTRALIZED TYPE DEFINITIONS
β”‚ β”‚ └── types.go # All project types in one place
β”‚ β”œβ”€β”€ config/ # Configuration management
β”‚ β”‚ └── config.go # Environment and config loading
β”‚ β”œβ”€β”€ cwapi/ # CWCloud API client
β”‚ β”‚ β”œβ”€β”€ client.go # HTTP client implementation
β”‚ β”‚ └── auth.go # Authentication logic
β”‚ β”œβ”€β”€ mcp/ # MCP protocol implementation
β”‚ β”‚ β”œβ”€β”€ server.go # MCP server core
β”‚ β”‚ β”œβ”€β”€ handlers.go # Message handlers
β”‚ β”‚ β”œβ”€β”€ tools.go # Tool constructors
β”‚ β”‚ └── errors.go # Error handling
β”‚ └── tools/ # MCP tool implementations
β”‚ β”œβ”€β”€ generate_ai_prompt.go # AI generation tool
β”‚ └── list_conversations.go # Conversation management tool
β”œβ”€β”€ pkg/ # PUBLIC PACKAGES (importable by other Go projects)
β”‚ └── mcp/ # Public CWCloud MCP library
β”‚ β”œβ”€β”€ client.go # Public client interface
β”‚ β”œβ”€β”€ types.go # Public type definitions
β”‚ β”œβ”€β”€ tools.go # MCP tool helpers
β”‚ └── README.md # Library documentation
β”œβ”€β”€ examples/ # USAGE EXAMPLES
β”‚ └── usage.go # Complete usage examples
└── docs/ # Documentation

Building from Source​

# Install dependencies
go mod tidy

# Build for production
go build -ldflags="-w -s" -o cwcloud-mcp ./cmd/server

# Build Docker image
make docker
# or manually:
docker build -t cwcloud-mcp .

Running Tests​

Integration test​

# Interactive tests with AI functionality (requires valid API keys)
./test-interactive.sh

# Or you can do the same thing using the Make commands
make test-interactive # Run interactive AI tests

Unit tests​

# Note: Unit tests will be added as the project matures

# Run tests
go test ./...

# Or you can do the same thing using the Make commands
make test

Troubleshooting​

Debug Mode​

Enable debug logging for detailed troubleshooting:

LOG_LEVEL=debug