# Installation

This guide covers how to install and set up AWS Logs MCP for both one-click installation in VS Code and manual installation.

## One-Click Installation

The fastest way to get started with AWS Logs MCP is using our one-click installation for VS Code:

[![Install with NPX in VS Code](https://img.shields.io/badge/VS_Code-NPM-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=aws-logs&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_credentials_method%22%2C%22description%22%3A%22AWS%20Authentication%20Method%22%2C%22options%22%3A%5B%22IAM%20Credentials%22%2C%22AWS%20Profile%22%5D%7D%2C%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_profile%22%2C%22description%22%3A%22AWS%20Profile%20Name%22%2C%22default%22%3A%22default%22%2C%22when%22%3A%22%24%7Binput%3Aaws_credentials_method%7D%20%3D%3D%20'AWS%20Profile'%22%7D%2C%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_access_key_id%22%2C%22description%22%3A%22AWS%20Access%20Key%20ID%22%2C%22password%22%3Atrue%2C%22when%22%3A%22%24%7Binput%3Aaws_credentials_method%7D%20%3D%3D%20'IAM%20Credentials'%22%7D%2C%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_secret_access_key%22%2C%22description%22%3A%22AWS%20Secret%20Access%20Key%22%2C%22password%22%3Atrue%2C%22when%22%3A%22%24%7Binput%3Aaws_credentials_method%7D%20%3D%3D%20'IAM%20Credentials'%22%7D%2C%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_region%22%2C%22description%22%3A%22AWS%20Region%22%2C%22default%22%3A%22us-east-1%22%7D%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40schuettc%2Faws-logs-mcp%22%5D%2C%22env%22%3A%7B%22AWS_PROFILE%22%3A%22%24%7Binput%3Aaws_profile%7D%22%2C%22AWS_ACCESS_KEY_ID%22%3A%22%24%7Binput%3Aaws_access_key_id%7D%22%2C%22AWS_SECRET_ACCESS_KEY%22%3A%22%24%7Binput%3Aaws_secret_access_key%7D%22%2C%22AWS_REGION%22%3A%22%24%7Binput%3Aaws_region%7D%22%7D%7D) [![Install with Docker in VS Code](https://img.shields.io/badge/VS_Code-Docker-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=aws-logs&inputs=%5B%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_credentials_method%22%2C%22description%22%3A%22AWS%20Authentication%20Method%22%2C%22options%22%3A%5B%22IAM%20Credentials%22%2C%22AWS%20Profile%22%5D%7D%2C%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_profile%22%2C%22description%22%3A%22AWS%20Profile%20Name%22%2C%22default%22%3A%22default%22%2C%22when%22%3A%22%24%7Binput%3Aaws_credentials_method%7D%20%3D%3D%20'AWS%20Profile'%22%7D%2C%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_access_key_id%22%2C%22description%22%3A%22AWS%20Access%20Key%20ID%22%2C%22password%22%3Atrue%2C%22when%22%3A%22%24%7Binput%3Aaws_credentials_method%7D%20%3D%3D%20'IAM%20Credentials'%22%7D%2C%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_secret_access_key%22%2C%22description%22%3A%22AWS%20Secret%20Access%20Key%22%2C%22password%22%3Atrue%2C%22when%22%3A%22%24%7Binput%3Aaws_credentials_method%7D%20%3D%3D%20'IAM%20Credentials'%22%7D%2C%7B%22type%22%3A%22promptString%22%2C%22id%22%3A%22aws_region%22%2C%22description%22%3A%22AWS%20Region%22%2C%22default%22%3A%22us-east-1%22%7D%5D&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22schuettc%2Faws-logs-mcp%22%5D%2C%22env%22%3A%7B%22AWS_PROFILE%22%3A%22%24%7Binput%3Aaws_profile%7D%22%2C%22AWS_ACCESS_KEY_ID%22%3A%22%24%7Binput%3Aaws_access_key_id%7D%22%2C%22AWS_SECRET_ACCESS_KEY%22%3A%22%24%7Binput%3Aaws_secret_access_key%7D%22%2C%22AWS_REGION%22%3A%22%24%7Binput%3Aaws_region%7D%22%7D%7D)

This installation will:

1. Prompt you to choose your AWS authentication method:
   - AWS Profile (recommended if you already use the AWS CLI)
   - IAM Credentials (for direct credential entry)

2. Ask for required inputs based on your selection:
   - For Profile: Profile name (defaults to "default")
   - For IAM: Access key ID and secret access key
   - For both: AWS Region (defaults to "us-east-1")

3. Install and run the MCP server in VS Code using either:
   - NPM: installs with `npx -y @schuettc/aws-logs-mcp`
   - Docker: runs with `docker run -i --rm schuettc/aws-logs-mcp`

Your AWS credentials remain on your local machine and are only used for accessing AWS services.

## Manual Installation Options

If you need more control or want to customize your installation, you can choose one of the manual installation methods below. These methods provide the same functionality as the one-click installation but allow for more advanced configuration options.

The one-click installation above takes care of the AWS authentication automatically based on your input. For manual installation, you'll configure these options in your `.env` file as described in the [Configuration](configuration.md) guide.

## Prerequisites for Manual Installation

If you prefer to install manually, ensure you have the following installed:

- Node.js 18+ and pnpm
- AWS credentials with appropriate permissions
- Docker (optional, for containerization)

## Manual Installation

1. Clone the repository:
   ```bash
   git clone https://github.com/schuettc/aws-logs-mcp.git
   cd aws-logs-mcp
   ```

2. Install dependencies:
   ```bash
   pnpm install
   ```

3. Set up environment variables:
   ```bash
   cp .env.example .env
   ```
   Edit the `.env` file with your AWS credentials.

4. Build and start the server:
   ```bash
   pnpm build
   pnpm start
   ```
   
   Or for development with hot-reloading:
   ```bash
   pnpm dev
   ```

## Docker Deployment

### Using a .env File

1. Build and run using Docker:
   ```bash
   docker build -t aws-logs-mcp .
   docker run -p 3000:3000 --env-file .env aws-logs-mcp
   ```

2. Alternatively, use Docker Compose:
   ```bash
   docker-compose up -d
   ```

### Using Exported AWS Credentials

1. Export your AWS credentials in your terminal:
   ```bash
   export AWS_REGION=us-east-1
   export AWS_ACCESS_KEY_ID=your_access_key_id
   export AWS_SECRET_ACCESS_KEY=your_secret_access_key
   # Optional if using temporary credentials
   export AWS_SESSION_TOKEN=your_session_token
   ```

   Alternatively, use the AWS CLI to export credentials:
   ```bash
   eval $(aws configure export-credentials)
   # Or for a specific profile
   eval $(aws configure export-credentials --profile your-profile)
   ```

2. Run the server with the provided helper script:
   ```bash
   ./run-server.sh
   ```

## Verifying Installation

Once installed, you can verify your installation is working by:

1. Checking the server is running:
   ```bash
   curl http://localhost:3000/health
   ```

2. Using the test client in the `test-client` directory:
   ```bash
   cd test-client
   pnpm install
   ./run-client.sh
   ```

You should see output confirming connection to the MCP server and available tools.