diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml new file mode 100644 index 0000000..2b6c87d --- /dev/null +++ b/.github/workflows/claude.yml @@ -0,0 +1,50 @@ +name: Claude Code + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + +jobs: + claude: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + issues: read + id-token: write + actions: read # Required for Claude to read CI results on PRs + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + + # This is an optional setting that allows Claude to read CI results on PRs + additional_permissions: | + actions: read + + # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. + # prompt: 'Update the pull request description to include a summary of changes.' + + # Optional: Add claude_args to customize behavior and configuration + # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md + # or https://docs.claude.com/en/docs/claude-code/cli-reference for available options + # claude_args: '--allowed-tools Bash(gh pr:*)' + diff --git a/mcp-client-python/client.py b/mcp-client-python/client.py index 1194840..c53b39b 100644 --- a/mcp-client-python/client.py +++ b/mcp-client-python/client.py @@ -64,7 +64,7 @@ class MCPClient: # Initial Claude API call response = self.anthropic.messages.create( - model="claude-3-5-sonnet-20241022", + model="claude-sonnet-4-0", max_tokens=1000, messages=messages, tools=available_tools @@ -97,7 +97,7 @@ class MCPClient: # Get next response from Claude response = self.anthropic.messages.create( - model="claude-3-5-sonnet-20241022", + model="claude-sonnet-4-0", max_tokens=1000, messages=messages, ) diff --git a/mcp-client-typescript/index.ts b/mcp-client-typescript/index.ts index be89f65..150434c 100644 --- a/mcp-client-typescript/index.ts +++ b/mcp-client-typescript/index.ts @@ -92,7 +92,7 @@ class MCPClient { // Initial Claude API call const response = await this.anthropic.messages.create({ - model: "claude-3-5-sonnet-20241022", + model: "claude-sonnet-4-0", max_tokens: 1000, messages, tools: this.tools, @@ -100,7 +100,6 @@ class MCPClient { // Process response and handle tool calls const finalText = []; - const toolResults = []; for (const content of response.content) { if (content.type === "text") { @@ -114,7 +113,6 @@ class MCPClient { name: toolName, arguments: toolArgs, }); - toolResults.push(result); finalText.push( `[Calling tool ${toolName} with args ${JSON.stringify(toolArgs)}]`, ); @@ -127,7 +125,7 @@ class MCPClient { // Get next response from Claude const response = await this.anthropic.messages.create({ - model: "claude-3-5-sonnet-20241022", + model: "claude-sonnet-4-0", max_tokens: 1000, messages, }); diff --git a/weather-server-python/weather.py b/weather-server-python/weather.py index 74a3015..5822b4e 100644 --- a/weather-server-python/weather.py +++ b/weather-server-python/weather.py @@ -89,6 +89,9 @@ Forecast: {period['detailedForecast']} return "\n---\n".join(forecasts) -if __name__ == "__main__": +def main(): # Initialize and run the server - mcp.run(transport='stdio') + mcp.run(transport='stdio') + +if __name__ == "__main__": + main()