This guide provides instructions for setting up your development environment, running tests, and contributing to the ECS MCP Server project. All development should comply with the guidelines in the parent repository's DEVELOPER_GUIDE.md.
- Python 3.10+ (recommended installation using
uv python install 3.10) - uv
- Git
- AWS CLI with appropriate credentials configured
# Clone the repository
git clone https://github.com/awslabs/mcp.git
cd mcp# Create and activate a virtual environment using uv
cd src/ecs-mcp-server
uv venv
source .venv/bin/activate # On Unix/macOS
.venv\Scripts\activate # On Windows
# Install development dependencies
uv pip install -e ".[dev]"Ensure you have AWS credentials configured with appropriate permissions:
aws configure
AWS Access Key ID [None]: your-access-key
AWS Secret Access Key [None]: your-secret-key
Default region name [None]: us-east-1
Default output format [None]: jsonYou can also run the MCP server directly from a local clone of the GitHub repository:
# Clone the repository
git clone https://github.com/awslabs/mcp.git
# Run the server directly using uv
uv --directory /path/to/ecs-mcp-server/src/ecs-mcp-server/awslabs/ecs_mcp_server run main.pyTo run the server during development:
cd src/ecs-mcp-server
python -m awslabs.ecs_mcp_server.mainAlternatively, you can use uv to run the server:
uv --directory /path/to/ecs-mcp-server/src/ecs-mcp-server/awslabs/ecs_mcp_server run main.pyAdd the ECS MCP Server to your MCP client configuration:
{
"mcpServers": {
"awslabs.ecs-mcp-server": {
"command": "uv",
"args": [
"--directory",
"/path/to/ecs-mcp-server/src/ecs-mcp-server/awslabs/ecs_mcp_server",
"run",
"main.py"
],
"env": {
"AWS_PROFILE": "your-aws-profile",
"AWS_REGION": "your-aws-region",
"FASTMCP_LOG_LEVEL": "DEBUG",
"FASTMCP_LOG_FILE": "/path/to/logs/ecs-mcp-server.log"
}
}
}
}The ECS MCP Server supports both console logging and file logging. During development, you can:
- View console logs: By default, logs are printed to the console with level determined by
FASTMCP_LOG_LEVEL - Enable file logging: Add the
FASTMCP_LOG_FILEenvironment variable to write logs to a file - View log files: Access the log file at the specified path for debugging server issues
- Analyze crash logs: In case of server crashes, the log file will contain details to help diagnose the problem
To adjust log verbosity, set FASTMCP_LOG_LEVEL to one of: DEBUG, INFO, WARNING, ERROR, or CRITICAL.
To run all unit tests:
cd src/ecs-mcp-server
python -m pytest tests/unitTo run a specific test file:
python -m pytest tests/unit/test_main.pyTo run a specific test case with verbose output:
python -m pytest tests/unit/test_main.py::TestMain::test_server_tools -vIntegration tests are available in the tests/llm_testing directory and are run using the run_tests.sh script:
cd src/ecs-mcp-server/tests/llm_testing
./run_tests.shThe script will:
- Give you many test scenarios to choose from
- Set up necessary resources for the particular test
- Provide you with prompts to run in an LLM and the expected outputs
- Clean up resources (with your confirmation)
To generate a test coverage report:
# Generate coverage report
python -m pytest --cov=awslabs.ecs_mcp_server tests/For a detailed HTML coverage report:
python -m pytest --cov=awslabs.ecs_mcp_server --cov-report=html tests/This will create an htmlcov directory with an interactive HTML report that you can open in your browser.
Use pre-commit in DEVELOPER_GUIDE.md
- Create a branch: Create a new branch for your feature or fix
- Make changes: Implement your changes following the code style guidelines
- Run tests: Ensure all tests pass and add new tests as needed
- Update documentation: Update README.md and other documentation as needed
- Commit changes: Use clear commit messages (conventional commits recommended)
- Submit a pull request: Open a pull request against the main branch
All changes should comply with the guidelines in the parent repository's DEVELOPER_GUIDE.md. This includes following the appropriate branching strategy, commit message format, and code review process.
To build the package:
cd src/ecs-mcp-server
python -m build