Skip to content

Commit 09e9937

Browse files
authored
Merge pull request #273 from giedri/main
Switching to uv
2 parents 668cd49 + 4a1ea3d commit 09e9937

File tree

8 files changed

+779
-61
lines changed

8 files changed

+779
-61
lines changed

apigw-ai-agents/kiro-power/mcp.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
{
22
"mcpServers": {
33
"api-expert-server": {
4-
"command": "python",
4+
"command": "uv",
55
"args": [
6-
"<path to helper directory>/api_helper.py"
6+
"--directory",
7+
"<path to api-helper directory>",
8+
"run",
9+
"api_helper.py"
710
],
811
"disabled": false,
912
"env": {
1013
"AWS_REGION": "us-east-1",
11-
"AGENTCORE_AGENT_ARN": "XXXX"
14+
"AGENTCORE_AGENT_ARN": "arn:aws:bedrock:us-east-1:123456789012:agent-runtime/your-agent-id"
1215
}
1316
}
1417
}

apigw-ai-agents/strands-agentcore/mcp/README.md

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,67 @@ API Helper is an Amazon Q and Kiro extension that provides expert guidance and t
1414
### Prerequisites
1515

1616
- Python 3.13 or higher
17+
- [uv](https://docs.astral.sh/uv/) - Fast Python package manager
1718
- AWS CLI configured with appropriate permissions
1819
- Amazon Bedrock agents configured and accessible
1920

20-
### Setup
21+
### Setup with uv
2122

2223
1. Clone the repository
23-
2. Set up a virtual environment:
24+
25+
2. Install uv (if not already installed):
2426
```bash
25-
python -m venv .venv
26-
source .venv/bin/activate # On Windows: .venv\Scripts\activate
27+
# macOS/Linux
28+
curl -LsSf https://astral.sh/uv/install.sh | sh
29+
30+
# Or with Homebrew
31+
brew install uv
2732
```
28-
3. Install the package:
33+
34+
3. Sync dependencies:
35+
```bash
36+
cd strands-agentcore/mcp/api-helper
37+
uv sync
38+
```
39+
40+
4. Run the MCP server:
2941
```bash
30-
pip install -e .
42+
uv run api_helper.py
3143
```
3244

3345
### Environment Variables
3446

3547
The following environment variables must be configured for MCP server to function:
3648

3749
- `AWS_REGION`: AWS region where Bedrock agents are deployed
38-
- `EXPERT_AGENT_ARN`: ID of the API Expert Bedrock AgentCore Runtime agent
50+
- `AGENTCORE_AGENT_ARN`: ARN of the API Expert Bedrock AgentCore Runtime agent
3951

4052
## MCP Client Configuration
4153

42-
This directory contains a configuration file [example](../config/mcp.json) for the MCP client.
43-
54+
This directory contains a configuration file [example](config/mcp.json) for the MCP client.
55+
56+
Example configuration using uv:
57+
```json
58+
{
59+
"mcpServers": {
60+
"api-helper": {
61+
"command": "uv",
62+
"args": ["--directory", "/path/to/strands-agentcore/mcp/api-helper", "run", "api_helper.py"],
63+
"env": {
64+
"AWS_REGION": "us-east-1",
65+
"AGENTCORE_AGENT_ARN": "arn:aws:bedrock:us-east-1:123456789012:agent-runtime/your-agent-id"
66+
}
67+
}
68+
}
69+
}
70+
```
4471

4572
## Implementation
4673

47-
API Helper is built as a FastMCP server that integrates with Amazon Q. It provides three main tools that invoke Amazon Bedrock agents:
74+
API Helper is built as a FastMCP server that integrates with Amazon Q and Kiro. It provides tools that invoke Amazon Bedrock agents:
4875

4976
1. **ask_api_expert**: Connects to an API Expert Bedrock agent to answer questions and provide guidance
50-
2. **build_openapi_specification**: Invokes a specialized Bedrock agent to generate OpenAPI specifications
51-
3. **build_API**: Leverages a Bedrock agent to create complete API implementations with IaC templates
77+
2. **inspect_API**: Retrieves and analyzes API Gateway configurations against best practices
5278

5379
Each tool follows a similar pattern:
5480
- Accept a request string from Amazon Q
@@ -57,8 +83,13 @@ Each tool follows a similar pattern:
5783

5884
### Project Structure
5985

60-
- `api_helper.py`: Main module containing the FastMCP server and tool implementations.
61-
- `pyproject.toml`: Project metadata and dependencies
86+
```
87+
api-helper/
88+
├── api_helper.py # Main FastMCP server and tool implementations
89+
├── pyproject.toml # Project metadata and dependencies
90+
├── .python-version # Python version for uv
91+
└── uv.lock # Locked dependencies (generated by uv sync)
92+
```
6293

6394
### Adding New Features
6495

@@ -68,22 +99,18 @@ To add new API-related tools:
6899
2. Implement the logic to invoke the appropriate Bedrock agent
69100
3. Update documentation
70101

102+
### Development Commands
71103

104+
```bash
105+
# Install dependencies
106+
uv sync
72107

108+
# Run the server
109+
uv run api_helper.py
73110

111+
# Add a new dependency
112+
uv add <package-name>
74113

75-
### Project Structure
76-
77-
- `api_helper.py`: Main module containing the FastMCP server and tool implementations.
78-
- `pyproject.toml`: Project metadata and dependencies
79-
80-
### Adding New Features
81-
82-
To add new API-related tools:
83-
84-
1. Create a new function in `api_helper.py` decorated with `@mcp.tool()`
85-
2. Implement the logic to invoke the appropriate Bedrock agent
86-
3. Update documentation
87-
88-
89-
114+
# Update dependencies
115+
uv lock --upgrade
116+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

apigw-ai-agents/strands-agentcore/mcp/api-helper/README.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# API Helper
22

3-
API Helper is an Amazon Q and Kiro extension that provides expert guidance and tools for API development, operations, management, and governance on AWS. It leverages AI agent running on Amazon Bedrock AgentCore to deliver specialized assistance for API-related tasks.
3+
API Helper is a Kiro extension that provides expert guidance and tools for API development, operations, management, and governance on AWS. It leverages AI agent running on Amazon Bedrock AgentCore to deliver specialized assistance for API-related tasks.
44

55
## Features
66

@@ -14,41 +14,67 @@ API Helper is an Amazon Q and Kiro extension that provides expert guidance and t
1414
### Prerequisites
1515

1616
- Python 3.13 or higher
17+
- [uv](https://docs.astral.sh/uv/) - Fast Python package manager
1718
- AWS CLI configured with appropriate permissions
1819
- Amazon Bedrock agents configured and accessible
1920

20-
### Setup
21+
### Setup with uv
2122

2223
1. Clone the repository
23-
2. Set up a virtual environment:
24+
25+
2. Install uv (if not already installed):
26+
```bash
27+
# macOS/Linux
28+
curl -LsSf https://astral.sh/uv/install.sh | sh
29+
30+
# Or with Homebrew
31+
brew install uv
32+
```
33+
34+
3. Sync dependencies:
2435
```bash
25-
python -m venv .venv
26-
source .venv/bin/activate # On Windows: .venv\Scripts\activate
36+
cd strands-agentcore/mcp/api-helper
37+
uv sync
2738
```
28-
3. Install the package:
39+
40+
4. Run the MCP server:
2941
```bash
30-
pip install -r requirements.txt
42+
uv run api_helper.py
3143
```
3244

3345
### Environment Variables
3446

3547
The following environment variables must be configured for MCP server to function:
3648

3749
- `AWS_REGION`: AWS region where Bedrock agents are deployed
38-
- `EXPERT_AGENT_ARN`: ID of the API Expert Bedrock AgentCore Runtime agent
50+
- `AGENTCORE_AGENT_ARN`: ARN of the API Expert Bedrock AgentCore Runtime agent
3951

4052
## MCP Client Configuration
4153

4254
This directory contains a configuration file [example](../config/mcp.json) for the MCP client.
4355

56+
Example configuration using uv:
57+
```json
58+
{
59+
"mcpServers": {
60+
"api-helper": {
61+
"command": "uv",
62+
"args": ["--directory", "/path/to/strands-agentcore/mcp/api-helper", "run", "api_helper.py"],
63+
"env": {
64+
"AWS_REGION": "us-east-1",
65+
"AGENTCORE_AGENT_ARN": "arn:aws:bedrock:us-east-1:123456789012:agent-runtime/your-agent-id"
66+
}
67+
}
68+
}
69+
}
70+
```
4471

4572
## Implementation
4673

47-
API Helper is built as a FastMCP server that integrates with Amazon Q. It provides three main tools that invoke Amazon Bedrock agents:
74+
API Helper is built as a FastMCP server that integrates with Amazon Q. It provides tools that invoke Amazon Bedrock agents:
4875

4976
1. **ask_api_expert**: Connects to an API Expert Bedrock agent to answer questions and provide guidance
50-
2. **build_openapi_specification**: Invokes a specialized Bedrock agent to generate OpenAPI specifications
51-
3. **build_API**: Leverages a Bedrock agent to create complete API implementations with IaC templates
77+
2. **inspect_API**: Retrieves and analyzes API Gateway configurations against best practices
5278

5379
Each tool follows a similar pattern:
5480
- Accept a request string from Amazon Q
@@ -57,8 +83,9 @@ Each tool follows a similar pattern:
5783

5884
### Project Structure
5985

60-
- `api_helper.py`: Main module containing the FastMCP server and tool implementations.
61-
- `pyproject.toml`: Project metadata and dependencies
86+
- `api_helper.py`: Main module containing the FastMCP server and tool implementations
87+
- `pyproject.toml`: Project metadata and dependencies (uv/pip compatible)
88+
- `.python-version`: Python version specification for uv
6289

6390
### Adding New Features
6491

@@ -69,4 +96,3 @@ To add new API-related tools:
6996
3. Update documentation
7097

7198

72-
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[project]
2+
name = "api-helper"
3+
version = "0.1.0"
4+
description = "API Helper MCP server for Kiro - provides expert guidance for API development on AWS"
5+
readme = "README.md"
6+
requires-python = ">=3.13"
7+
dependencies = [
8+
"boto3>=1.35.0",
9+
"botocore>=1.35.0",
10+
"mcp>=1.0.0",
11+
]
12+
13+
[project.scripts]
14+
api-helper = "api_helper:mcp.run"
15+
16+
[build-system]
17+
requires = ["hatchling"]
18+
build-backend = "hatchling.build"
19+
20+
[tool.hatch.build.targets.wheel]
21+
packages = ["."]

apigw-ai-agents/strands-agentcore/mcp/api-helper/requirements.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)