{"id":28633290,"url":"https://github.com/cheffromspace/claude-container-api","last_synced_at":"2025-07-22T17:03:42.783Z","repository":{"id":292715705,"uuid":"981709378","full_name":"Cheffromspace/claude-container-api","owner":"Cheffromspace","description":"Claude API with container support for GitHub repositories","archived":false,"fork":false,"pushed_at":"2025-05-11T18:15:55.000Z","size":66051,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T05:23:20.406Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cheffromspace.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-11T18:07:12.000Z","updated_at":"2025-05-11T18:16:00.000Z","dependencies_parsed_at":"2025-05-11T19:26:36.257Z","dependency_job_id":"3e6577fb-4811-4fb1-bab8-63c0713c6d17","html_url":"https://github.com/Cheffromspace/claude-container-api","commit_stats":null,"previous_names":["cheffromspace/claude-container-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Cheffromspace/claude-container-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cheffromspace%2Fclaude-container-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cheffromspace%2Fclaude-container-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cheffromspace%2Fclaude-container-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cheffromspace%2Fclaude-container-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cheffromspace","download_url":"https://codeload.github.com/Cheffromspace/claude-container-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cheffromspace%2Fclaude-container-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266535695,"owners_count":23944275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-12T15:08:13.220Z","updated_at":"2025-07-22T17:03:42.746Z","avatar_url":"https://github.com/Cheffromspace.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Claude GitHub Webhook\n\nA webhook endpoint for Claude to perform Git and GitHub actions. This microservice allows Claude to respond to mentions in GitHub comments and help with repository tasks.\n\n## Use Cases\n\n- Trigger Claude when mentioned in GitHub comments with `@MCPClaude`\n- Allow Claude to research repository code and answer questions\n- Direct API access for Claude without GitHub webhook requirements\n- Stateless container execution mode for isolation and scalability\n- Optionally permit Claude to make code changes when requested\n\n## Setup Guide\n\n### Prerequisites\n\n- Node.js 16 or higher\n- npm or yarn\n- GitHub account with access to the repositories you want to use\n\n### Step-by-Step Installation\n\n1. **Clone this repository**\n   ```\n   git clone https://github.com/yourusername/claude-github-webhook.git\n   cd claude-github-webhook\n   ```\n\n2. **Run the setup script**\n   ```\n   ./scripts/setup.sh\n   ```\n   This will create necessary directories, copy the environment template, and install dependencies.\n\n3. **Configure Credentials**\n\n   Copy the `.env.example` file to `.env` and edit with your credentials:\n   ```\n   cp .env.example .env\n   nano .env  # or use your preferred editor\n   ```\n\n   **a. GitHub Webhook Secret**\n   - Generate a secure random string to use as your webhook secret\n   - You can use this command to generate one:\n     ```\n     node -e \"console.log(require('crypto').randomBytes(20).toString('hex'))\"\n     ```\n   - Save this value in your `.env` file as `GITHUB_WEBHOOK_SECRET`\n   - You'll use this same value when setting up the webhook in GitHub\n\n   **b. GitHub Personal Access Token**\n   - Go to GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens\n   - Click \"Generate new token\"\n   - Name your token (e.g., \"Claude GitHub Webhook\")\n   - Set the expiration as needed\n   - Select the repositories you want Claude to access\n   - Under \"Repository permissions\":\n     - Issues: Read and write (to post comments)\n     - Contents: Read (to read repository code)\n   - Click \"Generate token\"\n   - Copy the generated token to your `.env` file as `GITHUB_TOKEN`\n\n   **c. AWS Credentials (for Claude via Bedrock)**\n   - You need AWS Bedrock credentials to access Claude\n   - Update the following values in your `.env` file:\n     ```\n     AWS_ACCESS_KEY_ID=your_aws_access_key\n     AWS_SECRET_ACCESS_KEY=your_aws_secret_key\n     AWS_REGION=us-east-1\n     CLAUDE_CODE_USE_BEDROCK=1\n     ANTHROPIC_MODEL=anthropic.claude-3-sonnet-20240229-v1:0\n     ```\n   - Note: You don't need a Claude/Anthropic API key when using Bedrock\n\n   **d. Server Port and Other Settings**\n   - By default, the server runs on port 3000\n   - To use a different port, set the `PORT` environment variable in your `.env` file\n   - Review other settings in the `.env` file for customization options\n\n4. **Start the server**\n   ```\n   npm start\n   ```\n   For development with auto-restart:\n   ```\n   npm run dev\n   ```\n\n### GitHub Webhook Configuration\n\n1. **Go to your GitHub repository**\n2. **Navigate to Settings → Webhooks**\n3. **Click \"Add webhook\"**\n4. **Configure the webhook:**\n   - Payload URL: `https://claude.jonathanflatt.org/api/webhooks/github`\n   - Content type: `application/json`\n   - Secret: The same value you set for `GITHUB_WEBHOOK_SECRET` in your `.env` file\n   - Events: Select \"Send me everything\" if you want to handle multiple event types, or choose specific events\n   - Active: Check this box to enable the webhook\n5. **Click \"Add webhook\"**\n\n### Testing Your Setup\n\n1. **Verify the webhook is receiving events**\n   - After setting up the webhook, GitHub will send a ping event\n   - Check your server logs to confirm it's receiving events\n\n2. **Test with a sample comment**\n   - Create a new issue or pull request in your repository\n   - Add a comment mentioning `@MCPClaude` followed by a question, like:\n     ```\n     @MCPClaude What does this repository do?\n     ```\n   - Claude should respond with a new comment in the thread\n\n3. **Using the test utilities**\n   - You can use the included test utility to verify your webhook setup:\n     ```\n     node test-outgoing-webhook.js\n     ```\n   - This will start a test server and provide instructions for testing\n\n   - To test the direct Claude API:\n     ```\n     node test-claude-api.js owner/repo\n     ```\n   - To test the container-based execution:\n     ```\n     ./build-claude-container.sh  # First build the container\n     node test-claude-api.js owner/repo container \"Your command here\"\n     ```\n\n## Troubleshooting\n\n### Webhook Not Receiving Events\n- Verify your server is publicly accessible\n- Check your server logs for errors\n- Confirm the webhook secret matches between GitHub and your `.env` file\n- Review GitHub webhook delivery logs in the repository settings\n\n### Claude Not Responding\n- Check server logs for errors\n- Verify your AWS credentials are correct\n- Ensure your GitHub token has the necessary permissions\n- Make sure your comment includes the `@MCPClaude` mention\n\n## Direct Claude API\n\nThe server provides a direct API endpoint for Claude that doesn't rely on GitHub webhooks. This allows you to integrate Claude with other systems or test Claude's responses.\n\n### API Endpoint\n\n```\nPOST /api/claude\n```\n\n### Request Body\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| repoFullName | string | The repository name in the format \"owner/repo\" |\n| command | string | The command or question to send to Claude |\n| authToken | string | Optional authentication token (required if CLAUDE_API_AUTH_REQUIRED=1) |\n| useContainer | boolean | Whether to use container-based execution (optional, defaults to false) |\n\n### Example Request\n\n```json\n{\n  \"repoFullName\": \"owner/repo\",\n  \"command\": \"Explain what this repository does\",\n  \"authToken\": \"your-auth-token\",\n  \"useContainer\": true\n}\n```\n\n### Example Response\n\n```json\n{\n  \"message\": \"Command processed successfully\",\n  \"response\": \"This repository is a webhook server that integrates Claude with GitHub...\"\n}\n```\n\n### Authentication\n\nTo secure the API, you can enable authentication by setting the following environment variables:\n\n```\nCLAUDE_API_AUTH_REQUIRED=1\nCLAUDE_API_AUTH_TOKEN=your-secret-token\n```\n\n### Container-Based Execution\n\nThe container-based execution mode provides isolation and better scalability. When enabled, each request will:\n\n1. Launch a new Docker container with Claude Code CLI\n2. Clone the repository inside the container\n3. Execute the command\n4. Return the response\n5. Remove the container\n\nTo enable container-based execution:\n\n1. Build the Claude container:\n   ```\n   ./build-claude-container.sh\n   ```\n\n2. Set the environment variables:\n   ```\n   CLAUDE_USE_CONTAINERS=1\n   CLAUDE_CONTAINER_IMAGE=claudecode:latest\n   REPO_CACHE_DIR=/path/to/cache  # Optional\n   ```\n\n## Development\n\nTo run the server in development mode with auto-restart:\n\n```\nnpm run dev\n```\n\n## Testing\n\nRun tests with:\n\n```\nnpm test\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheffromspace%2Fclaude-container-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheffromspace%2Fclaude-container-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheffromspace%2Fclaude-container-api/lists"}