base2-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- base2_mcp-0.1.0/.github/workflows/ci.yml +30 -0
- base2_mcp-0.1.0/.github/workflows/publish-test.yml +51 -0
- base2_mcp-0.1.0/.github/workflows/publish.yml +50 -0
- base2_mcp-0.1.0/.gitignore +7 -0
- base2_mcp-0.1.0/PKG-INFO +171 -0
- base2_mcp-0.1.0/README.md +157 -0
- base2_mcp-0.1.0/pyproject.toml +33 -0
- base2_mcp-0.1.0/requirements-dev.txt +2 -0
- base2_mcp-0.1.0/requirements.txt +1 -0
- base2_mcp-0.1.0/src/__init__.py +0 -0
- base2_mcp-0.1.0/src/app.py +54 -0
- base2_mcp-0.1.0/src/docs/__init__.py +30 -0
- base2_mcp-0.1.0/src/docs/bastion.md +138 -0
- base2_mcp-0.1.0/src/docs/cfhighlander.md +145 -0
- base2_mcp-0.1.0/src/docs/cfn_vpn.md +97 -0
- base2_mcp-0.1.0/src/docs/guardian.md +125 -0
- base2_mcp-0.1.0/src/docs/monitorable.md +75 -0
- base2_mcp-0.1.0/src/docs/shelvery.md +144 -0
- base2_mcp-0.1.0/src/executor/__init__.py +0 -0
- base2_mcp-0.1.0/src/executor/cli_runner.py +90 -0
- base2_mcp-0.1.0/src/tools/__init__.py +0 -0
- base2_mcp-0.1.0/src/tools/bastion_tools.py +146 -0
- base2_mcp-0.1.0/src/tools/cfhighlander_tools.py +168 -0
- base2_mcp-0.1.0/src/tools/cfn_vpn_tools.py +147 -0
- base2_mcp-0.1.0/src/tools/guardian_tools.py +117 -0
- base2_mcp-0.1.0/src/tools/monitorable_tools.py +66 -0
- base2_mcp-0.1.0/src/tools/overview_tools.py +72 -0
- base2_mcp-0.1.0/src/tools/shelvery_tools.py +161 -0
- base2_mcp-0.1.0/tests/__init__.py +0 -0
- base2_mcp-0.1.0/tests/conftest.py +6 -0
- base2_mcp-0.1.0/tests/test_bastion_tools.py +81 -0
- base2_mcp-0.1.0/tests/test_cfhighlander_tools.py +87 -0
- base2_mcp-0.1.0/tests/test_cfn_vpn_tools.py +89 -0
- base2_mcp-0.1.0/tests/test_cli_runner.py +100 -0
- base2_mcp-0.1.0/tests/test_docs.py +23 -0
- base2_mcp-0.1.0/tests/test_guardian_tools.py +82 -0
- base2_mcp-0.1.0/tests/test_monitorable_tools.py +52 -0
- base2_mcp-0.1.0/tests/test_overview_tools.py +34 -0
- base2_mcp-0.1.0/tests/test_shelvery_tools.py +72 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
token: ${{ secrets.GH_PAT || github.token }}
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: pip install -r requirements.txt -r requirements-dev.txt
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: pytest tests/ -v
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish to Test PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
test:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v4
|
|
11
|
+
with:
|
|
12
|
+
token: ${{ secrets.GH_PAT }}
|
|
13
|
+
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: pip install -r requirements.txt -r requirements-dev.txt
|
|
21
|
+
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: pytest tests/ -v
|
|
24
|
+
|
|
25
|
+
publish:
|
|
26
|
+
needs: test
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
environment: testpypi
|
|
29
|
+
permissions:
|
|
30
|
+
id-token: write
|
|
31
|
+
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
with:
|
|
35
|
+
token: ${{ secrets.GH_PAT }}
|
|
36
|
+
|
|
37
|
+
- name: Set up Python
|
|
38
|
+
uses: actions/setup-python@v5
|
|
39
|
+
with:
|
|
40
|
+
python-version: "3.13"
|
|
41
|
+
|
|
42
|
+
- name: Install build tools
|
|
43
|
+
run: pip install build
|
|
44
|
+
|
|
45
|
+
- name: Build package
|
|
46
|
+
run: python -m build
|
|
47
|
+
|
|
48
|
+
- name: Publish to Test PyPI
|
|
49
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
50
|
+
with:
|
|
51
|
+
repository-url: https://test.pypi.org/simple/
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v4
|
|
12
|
+
with:
|
|
13
|
+
token: ${{ secrets.GH_PAT }}
|
|
14
|
+
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.13"
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: pip install -r requirements.txt -r requirements-dev.txt
|
|
22
|
+
|
|
23
|
+
- name: Run tests
|
|
24
|
+
run: pytest tests/ -v
|
|
25
|
+
|
|
26
|
+
publish:
|
|
27
|
+
needs: test
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
environment: pypi
|
|
30
|
+
permissions:
|
|
31
|
+
id-token: write
|
|
32
|
+
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
with:
|
|
36
|
+
token: ${{ secrets.GH_PAT }}
|
|
37
|
+
|
|
38
|
+
- name: Set up Python
|
|
39
|
+
uses: actions/setup-python@v5
|
|
40
|
+
with:
|
|
41
|
+
python-version: "3.13"
|
|
42
|
+
|
|
43
|
+
- name: Install build tools
|
|
44
|
+
run: pip install build
|
|
45
|
+
|
|
46
|
+
- name: Build package
|
|
47
|
+
run: python -m build
|
|
48
|
+
|
|
49
|
+
- name: Publish to PyPI
|
|
50
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
base2_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: base2-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for Base2 open-source AWS tools — documentation, guidance, and CLI execution
|
|
5
|
+
Author: Base2 Services
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: aws,backup,bastion,cloudformation,mcp,monitoring,vpn
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Requires-Dist: mcp[cli]>=1.9.0
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# base2-mcp
|
|
16
|
+
|
|
17
|
+
MCP server for Base2 open-source AWS tools — documentation, guidance, and CLI execution.
|
|
18
|
+
|
|
19
|
+
## Supported Tools
|
|
20
|
+
|
|
21
|
+
| Tool | Description | Install |
|
|
22
|
+
|------|-------------|---------|
|
|
23
|
+
| [cfhighlander](https://github.com/theonestack/cfhighlander) | CloudFormation DSL and component library | `gem install cfhighlander` |
|
|
24
|
+
| [shelvery](https://github.com/base2Services/shelvery-aws-backups) | Automated AWS backups (EBS, RDS, EC2, Redshift, DocumentDB) | `pip install shelvery` |
|
|
25
|
+
| [cfn-guardian](https://github.com/base2Services/cfn-guardian) | CloudWatch alarm management via CloudFormation | `gem install cfn-guardian` |
|
|
26
|
+
| [monitorable](https://github.com/base2Services/monitorable) | CloudWatch alarm coverage auditing | Clone repo |
|
|
27
|
+
| [cfn-vpn](https://github.com/base2Services/cfn-vpn) | AWS Client VPN management via CloudFormation | `gem install cfn-vpn` |
|
|
28
|
+
| [bastion-cli](https://github.com/base2Services/bastion-cli) | Temporary bastion EC2 instances via Session Manager | [GitHub releases](https://github.com/base2Services/bastion-cli/releases) |
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Cursor IDE (Recommended)
|
|
33
|
+
|
|
34
|
+
Add to your `.cursor/mcp.json` (project-level) or `~/.cursor/mcp.json` (global):
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"base2": {
|
|
40
|
+
"command": "uvx",
|
|
41
|
+
"args": ["--upgrade", "base2-mcp"]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
No manual install needed — `uvx` fetches the package from PyPI automatically and `--upgrade` ensures you always get the latest version on server restart.
|
|
48
|
+
|
|
49
|
+
### Claude Desktop
|
|
50
|
+
|
|
51
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"base2": {
|
|
57
|
+
"command": "uvx",
|
|
58
|
+
"args": ["--upgrade", "base2-mcp"]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Alternative: pin to a specific version
|
|
65
|
+
|
|
66
|
+
If you need a stable version that won't change unexpectedly:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"base2": {
|
|
72
|
+
"command": "uvx",
|
|
73
|
+
"args": ["base2-mcp==0.1.0"]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Prerequisite: uv
|
|
80
|
+
|
|
81
|
+
`uvx` is part of [uv](https://docs.astral.sh/uv/), a fast Python package manager. Install it with:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# macOS / Linux
|
|
85
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
86
|
+
|
|
87
|
+
# Windows
|
|
88
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
89
|
+
|
|
90
|
+
# Or via pip
|
|
91
|
+
pip install uv
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## What It Does
|
|
95
|
+
|
|
96
|
+
This MCP server gives AI agents two capabilities for each tool:
|
|
97
|
+
|
|
98
|
+
1. **Documentation** — Embedded docs with CLI usage, configuration, examples, and best practices. The agent can read these to understand any tool without you explaining it.
|
|
99
|
+
|
|
100
|
+
2. **CLI Execution** — Wrapper tools that run the actual CLI commands (`cfhighlander cfcompile`, `shelvery ebs create_backups`, `bastion launch`, etc.) and return structured output.
|
|
101
|
+
|
|
102
|
+
### Available MCP Tools
|
|
103
|
+
|
|
104
|
+
**Discovery:**
|
|
105
|
+
- `list_base2_tools` — Overview of all 6 tools
|
|
106
|
+
- `get_tool_docs` — Detailed documentation for a specific tool
|
|
107
|
+
|
|
108
|
+
**cfhighlander:**
|
|
109
|
+
- `cfhighlander_docs` / `cfhighlander_compile` / `cfhighlander_publish` / `cfhighlander_test` / `cfhighlander_validate`
|
|
110
|
+
|
|
111
|
+
**shelvery:**
|
|
112
|
+
- `shelvery_docs` / `shelvery_create_backups` / `shelvery_clean_backups` / `shelvery_pull_shared_backups`
|
|
113
|
+
|
|
114
|
+
**cfn-guardian:**
|
|
115
|
+
- `guardian_docs` / `guardian_compile` / `guardian_deploy` / `guardian_show_alarms` / `guardian_show_resources`
|
|
116
|
+
|
|
117
|
+
**monitorable:**
|
|
118
|
+
- `monitorable_docs` / `monitorable_audit`
|
|
119
|
+
|
|
120
|
+
**cfn-vpn:**
|
|
121
|
+
- `cfn_vpn_docs` / `cfn_vpn_init` / `cfn_vpn_modify` / `cfn_vpn_routes` / `cfn_vpn_sessions`
|
|
122
|
+
|
|
123
|
+
**bastion-cli:**
|
|
124
|
+
- `bastion_docs` / `bastion_launch` / `bastion_connect` / `bastion_terminate` / `bastion_port_forward`
|
|
125
|
+
|
|
126
|
+
## Prerequisites
|
|
127
|
+
|
|
128
|
+
The MCP server itself only needs Python 3.11+ and the `mcp` package. The CLI tools it wraps need to be installed separately — the server will tell the agent if a tool is missing and how to install it.
|
|
129
|
+
|
|
130
|
+
## Development
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Install dependencies
|
|
134
|
+
pip install -r requirements.txt -r requirements-dev.txt
|
|
135
|
+
|
|
136
|
+
# Run tests
|
|
137
|
+
pytest tests/ -v
|
|
138
|
+
|
|
139
|
+
# Run the server locally (stdio mode)
|
|
140
|
+
python src/app.py
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Architecture
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
base2-mcp/
|
|
147
|
+
├── src/
|
|
148
|
+
│ ├── app.py # FastMCP entry point (stdio transport)
|
|
149
|
+
│ ├── docs/ # Embedded markdown documentation
|
|
150
|
+
│ │ ├── __init__.py # Doc loader utility
|
|
151
|
+
│ │ ├── cfhighlander.md
|
|
152
|
+
│ │ ├── shelvery.md
|
|
153
|
+
│ │ ├── guardian.md
|
|
154
|
+
│ │ ├── monitorable.md
|
|
155
|
+
│ │ ├── cfn_vpn.md
|
|
156
|
+
│ │ └── bastion.md
|
|
157
|
+
│ ├── executor/
|
|
158
|
+
│ │ └── cli_runner.py # Shared subprocess executor
|
|
159
|
+
│ └── tools/ # One module per tool
|
|
160
|
+
│ ├── overview_tools.py # list_base2_tools, get_tool_docs
|
|
161
|
+
│ ├── cfhighlander_tools.py
|
|
162
|
+
│ ├── shelvery_tools.py
|
|
163
|
+
│ ├── guardian_tools.py
|
|
164
|
+
│ ├── monitorable_tools.py
|
|
165
|
+
│ ├── cfn_vpn_tools.py
|
|
166
|
+
│ └── bastion_tools.py
|
|
167
|
+
├── tests/ # pytest suite (56 tests)
|
|
168
|
+
├── pyproject.toml
|
|
169
|
+
├── requirements.txt
|
|
170
|
+
└── requirements-dev.txt
|
|
171
|
+
```
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# base2-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for Base2 open-source AWS tools — documentation, guidance, and CLI execution.
|
|
4
|
+
|
|
5
|
+
## Supported Tools
|
|
6
|
+
|
|
7
|
+
| Tool | Description | Install |
|
|
8
|
+
|------|-------------|---------|
|
|
9
|
+
| [cfhighlander](https://github.com/theonestack/cfhighlander) | CloudFormation DSL and component library | `gem install cfhighlander` |
|
|
10
|
+
| [shelvery](https://github.com/base2Services/shelvery-aws-backups) | Automated AWS backups (EBS, RDS, EC2, Redshift, DocumentDB) | `pip install shelvery` |
|
|
11
|
+
| [cfn-guardian](https://github.com/base2Services/cfn-guardian) | CloudWatch alarm management via CloudFormation | `gem install cfn-guardian` |
|
|
12
|
+
| [monitorable](https://github.com/base2Services/monitorable) | CloudWatch alarm coverage auditing | Clone repo |
|
|
13
|
+
| [cfn-vpn](https://github.com/base2Services/cfn-vpn) | AWS Client VPN management via CloudFormation | `gem install cfn-vpn` |
|
|
14
|
+
| [bastion-cli](https://github.com/base2Services/bastion-cli) | Temporary bastion EC2 instances via Session Manager | [GitHub releases](https://github.com/base2Services/bastion-cli/releases) |
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
### Cursor IDE (Recommended)
|
|
19
|
+
|
|
20
|
+
Add to your `.cursor/mcp.json` (project-level) or `~/.cursor/mcp.json` (global):
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"mcpServers": {
|
|
25
|
+
"base2": {
|
|
26
|
+
"command": "uvx",
|
|
27
|
+
"args": ["--upgrade", "base2-mcp"]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
No manual install needed — `uvx` fetches the package from PyPI automatically and `--upgrade` ensures you always get the latest version on server restart.
|
|
34
|
+
|
|
35
|
+
### Claude Desktop
|
|
36
|
+
|
|
37
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"mcpServers": {
|
|
42
|
+
"base2": {
|
|
43
|
+
"command": "uvx",
|
|
44
|
+
"args": ["--upgrade", "base2-mcp"]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Alternative: pin to a specific version
|
|
51
|
+
|
|
52
|
+
If you need a stable version that won't change unexpectedly:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"base2": {
|
|
58
|
+
"command": "uvx",
|
|
59
|
+
"args": ["base2-mcp==0.1.0"]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Prerequisite: uv
|
|
66
|
+
|
|
67
|
+
`uvx` is part of [uv](https://docs.astral.sh/uv/), a fast Python package manager. Install it with:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# macOS / Linux
|
|
71
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
72
|
+
|
|
73
|
+
# Windows
|
|
74
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
75
|
+
|
|
76
|
+
# Or via pip
|
|
77
|
+
pip install uv
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## What It Does
|
|
81
|
+
|
|
82
|
+
This MCP server gives AI agents two capabilities for each tool:
|
|
83
|
+
|
|
84
|
+
1. **Documentation** — Embedded docs with CLI usage, configuration, examples, and best practices. The agent can read these to understand any tool without you explaining it.
|
|
85
|
+
|
|
86
|
+
2. **CLI Execution** — Wrapper tools that run the actual CLI commands (`cfhighlander cfcompile`, `shelvery ebs create_backups`, `bastion launch`, etc.) and return structured output.
|
|
87
|
+
|
|
88
|
+
### Available MCP Tools
|
|
89
|
+
|
|
90
|
+
**Discovery:**
|
|
91
|
+
- `list_base2_tools` — Overview of all 6 tools
|
|
92
|
+
- `get_tool_docs` — Detailed documentation for a specific tool
|
|
93
|
+
|
|
94
|
+
**cfhighlander:**
|
|
95
|
+
- `cfhighlander_docs` / `cfhighlander_compile` / `cfhighlander_publish` / `cfhighlander_test` / `cfhighlander_validate`
|
|
96
|
+
|
|
97
|
+
**shelvery:**
|
|
98
|
+
- `shelvery_docs` / `shelvery_create_backups` / `shelvery_clean_backups` / `shelvery_pull_shared_backups`
|
|
99
|
+
|
|
100
|
+
**cfn-guardian:**
|
|
101
|
+
- `guardian_docs` / `guardian_compile` / `guardian_deploy` / `guardian_show_alarms` / `guardian_show_resources`
|
|
102
|
+
|
|
103
|
+
**monitorable:**
|
|
104
|
+
- `monitorable_docs` / `monitorable_audit`
|
|
105
|
+
|
|
106
|
+
**cfn-vpn:**
|
|
107
|
+
- `cfn_vpn_docs` / `cfn_vpn_init` / `cfn_vpn_modify` / `cfn_vpn_routes` / `cfn_vpn_sessions`
|
|
108
|
+
|
|
109
|
+
**bastion-cli:**
|
|
110
|
+
- `bastion_docs` / `bastion_launch` / `bastion_connect` / `bastion_terminate` / `bastion_port_forward`
|
|
111
|
+
|
|
112
|
+
## Prerequisites
|
|
113
|
+
|
|
114
|
+
The MCP server itself only needs Python 3.11+ and the `mcp` package. The CLI tools it wraps need to be installed separately — the server will tell the agent if a tool is missing and how to install it.
|
|
115
|
+
|
|
116
|
+
## Development
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Install dependencies
|
|
120
|
+
pip install -r requirements.txt -r requirements-dev.txt
|
|
121
|
+
|
|
122
|
+
# Run tests
|
|
123
|
+
pytest tests/ -v
|
|
124
|
+
|
|
125
|
+
# Run the server locally (stdio mode)
|
|
126
|
+
python src/app.py
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Architecture
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
base2-mcp/
|
|
133
|
+
├── src/
|
|
134
|
+
│ ├── app.py # FastMCP entry point (stdio transport)
|
|
135
|
+
│ ├── docs/ # Embedded markdown documentation
|
|
136
|
+
│ │ ├── __init__.py # Doc loader utility
|
|
137
|
+
│ │ ├── cfhighlander.md
|
|
138
|
+
│ │ ├── shelvery.md
|
|
139
|
+
│ │ ├── guardian.md
|
|
140
|
+
│ │ ├── monitorable.md
|
|
141
|
+
│ │ ├── cfn_vpn.md
|
|
142
|
+
│ │ └── bastion.md
|
|
143
|
+
│ ├── executor/
|
|
144
|
+
│ │ └── cli_runner.py # Shared subprocess executor
|
|
145
|
+
│ └── tools/ # One module per tool
|
|
146
|
+
│ ├── overview_tools.py # list_base2_tools, get_tool_docs
|
|
147
|
+
│ ├── cfhighlander_tools.py
|
|
148
|
+
│ ├── shelvery_tools.py
|
|
149
|
+
│ ├── guardian_tools.py
|
|
150
|
+
│ ├── monitorable_tools.py
|
|
151
|
+
│ ├── cfn_vpn_tools.py
|
|
152
|
+
│ └── bastion_tools.py
|
|
153
|
+
├── tests/ # pytest suite (56 tests)
|
|
154
|
+
├── pyproject.toml
|
|
155
|
+
├── requirements.txt
|
|
156
|
+
└── requirements-dev.txt
|
|
157
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "base2-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP server for Base2 open-source AWS tools — documentation, guidance, and CLI execution"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
authors = [{ name = "Base2 Services" }]
|
|
13
|
+
keywords = ["mcp", "aws", "cloudformation", "backup", "monitoring", "vpn", "bastion"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"mcp[cli]>=1.9.0",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.scripts]
|
|
24
|
+
base2-mcp = "app:main"
|
|
25
|
+
|
|
26
|
+
[tool.hatch.build.targets.wheel]
|
|
27
|
+
packages = ["src"]
|
|
28
|
+
sources = ["src"]
|
|
29
|
+
artifacts = ["*.md"]
|
|
30
|
+
|
|
31
|
+
[tool.pytest.ini_options]
|
|
32
|
+
testpaths = ["tests"]
|
|
33
|
+
asyncio_mode = "auto"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mcp[cli]>=1.9.0
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from mcp.server.fastmcp import FastMCP
|
|
7
|
+
|
|
8
|
+
from tools.overview_tools import register_overview_tools
|
|
9
|
+
from tools.cfhighlander_tools import register_cfhighlander_tools
|
|
10
|
+
from tools.shelvery_tools import register_shelvery_tools
|
|
11
|
+
from tools.guardian_tools import register_guardian_tools
|
|
12
|
+
from tools.monitorable_tools import register_monitorable_tools
|
|
13
|
+
from tools.cfn_vpn_tools import register_cfn_vpn_tools
|
|
14
|
+
from tools.bastion_tools import register_bastion_tools
|
|
15
|
+
|
|
16
|
+
logging.basicConfig(
|
|
17
|
+
level=logging.INFO,
|
|
18
|
+
format="%(asctime)s %(name)s %(levelname)s %(message)s",
|
|
19
|
+
stream=sys.stderr,
|
|
20
|
+
)
|
|
21
|
+
logger = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
mcp = FastMCP(
|
|
24
|
+
name="base2-mcp",
|
|
25
|
+
instructions=(
|
|
26
|
+
"Base2 MCP Server — documentation, guidance, and CLI execution for "
|
|
27
|
+
"Base2 open-source AWS tools.\n\n"
|
|
28
|
+
"Supported tools:\n"
|
|
29
|
+
"- **cfhighlander**: CloudFormation DSL and component library\n"
|
|
30
|
+
"- **shelvery**: Automated AWS backups (EBS, RDS, EC2, Redshift, DocumentDB)\n"
|
|
31
|
+
"- **cfn-guardian**: CloudWatch alarm management via CloudFormation\n"
|
|
32
|
+
"- **monitorable**: CloudWatch alarm coverage auditing\n"
|
|
33
|
+
"- **cfn-vpn**: AWS Client VPN management via CloudFormation\n"
|
|
34
|
+
"- **bastion-cli**: Temporary bastion EC2 instances via Session Manager\n\n"
|
|
35
|
+
"Start with 'list_base2_tools' for an overview of all tools, or "
|
|
36
|
+
"'get_tool_docs' to read detailed documentation for a specific tool."
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
register_overview_tools(mcp)
|
|
41
|
+
register_cfhighlander_tools(mcp)
|
|
42
|
+
register_shelvery_tools(mcp)
|
|
43
|
+
register_guardian_tools(mcp)
|
|
44
|
+
register_monitorable_tools(mcp)
|
|
45
|
+
register_cfn_vpn_tools(mcp)
|
|
46
|
+
register_bastion_tools(mcp)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def main() -> None:
|
|
50
|
+
mcp.run(transport="stdio")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if __name__ == "__main__":
|
|
54
|
+
main()
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
DOCS_DIR = Path(__file__).parent
|
|
7
|
+
|
|
8
|
+
ToolName = Literal[
|
|
9
|
+
"cfhighlander",
|
|
10
|
+
"shelvery",
|
|
11
|
+
"guardian",
|
|
12
|
+
"monitorable",
|
|
13
|
+
"cfn_vpn",
|
|
14
|
+
"bastion",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
TOOL_DOC_FILES: dict[ToolName, str] = {
|
|
18
|
+
"cfhighlander": "cfhighlander.md",
|
|
19
|
+
"shelvery": "shelvery.md",
|
|
20
|
+
"guardian": "guardian.md",
|
|
21
|
+
"monitorable": "monitorable.md",
|
|
22
|
+
"cfn_vpn": "cfn_vpn.md",
|
|
23
|
+
"bastion": "bastion.md",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def load_doc(tool: ToolName) -> str:
|
|
28
|
+
"""Load the embedded markdown documentation for a tool."""
|
|
29
|
+
filename = TOOL_DOC_FILES[tool]
|
|
30
|
+
return (DOCS_DIR / filename).read_text()
|