mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
docs: add uv example for Python MCP servers in mcp_config section (#170)
Added documentation showing how to configure Python-based MCP servers using uv with the --directory argument, as requested in issue #130. Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Ashwin Bhat <ashwin-ant@users.noreply.github.com>
This commit is contained in:
34
README.md
34
README.md
@@ -149,6 +149,40 @@ For MCP servers that require sensitive information like API keys or tokens, use
|
|||||||
# ... other inputs
|
# ... other inputs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Using Python MCP Servers with uv
|
||||||
|
|
||||||
|
For Python-based MCP servers managed with `uv`, you need to specify the directory containing your server:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: anthropics/claude-code-action@beta
|
||||||
|
with:
|
||||||
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||||
|
mcp_config: |
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"my-python-server": {
|
||||||
|
"type": "stdio",
|
||||||
|
"command": "uv",
|
||||||
|
"args": [
|
||||||
|
"--directory",
|
||||||
|
"${{ github.workspace }}/path/to/server/",
|
||||||
|
"run",
|
||||||
|
"server_file.py"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allowed_tools: "my-python-server__<tool_name>" # Replace <tool_name> with your server's tool names
|
||||||
|
# ... other inputs
|
||||||
|
```
|
||||||
|
|
||||||
|
For example, if your Python MCP server is at `mcp_servers/weather.py`, you would use:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
"args":
|
||||||
|
["--directory", "${{ github.workspace }}/mcp_servers/", "run", "weather.py"]
|
||||||
|
```
|
||||||
|
|
||||||
**Important**:
|
**Important**:
|
||||||
|
|
||||||
- Always use GitHub Secrets (`${{ secrets.SECRET_NAME }}`) for sensitive values like API keys, tokens, or passwords. Never hardcode secrets directly in the workflow file.
|
- Always use GitHub Secrets (`${{ secrets.SECRET_NAME }}`) for sensitive values like API keys, tokens, or passwords. Never hardcode secrets directly in the workflow file.
|
||||||
|
|||||||
Reference in New Issue
Block a user