Skip to content

Commit 2f32ea2

Browse files
authored
fix(mcp): replace api key usage with oauth (#60)
1 parent e9da9fe commit 2f32ea2

File tree

8 files changed

+12
-91
lines changed

8 files changed

+12
-91
lines changed

.github/etc/dictionary.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ cookiecutter
55
dependabot
66
digestabot
77
dockerhub
8-
envrc
98
htmlcov
109
pylance
1110
pythonpath

docs/ai-ide-support.md

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,25 @@
11
# AI IDE Support
22

3-
The AI-Native Python template includes configuration files to work seamlessly with AI-powered development tools.
3+
The AI-Native Python template automatically configures AI-powered development tools during project generation.
44

55
[← Back to Documentation Index](index.md)
66

77

8-
## Tool-agnostic configurations
8+
## Automatic Configuration
99

10-
### .mcp.json
10+
When you generate a new project, the post-generation hook automatically detects which IDEs and AI assistants you have installed and creates appropriate configuration files:
1111

12-
Model Context Protocol configuration pre-set to integrate with:
12+
- Model Context Protocol (MCP) configuration for [Zenable](https://zenable.io) and other MCP servers (if supported tools are detected)
13+
- IDE-specific configuration files based on what's installed (Claude, GitHub Copilot, Cursor, etc.)
14+
- Project-specific context and guidelines tailored to your project
1315

14-
- [Zenable](https://zenable.io)'s MCP server
15-
- [Context7](https://context7.com/)'s MCP server
16-
17-
## Specific IDE configurations
18-
19-
### Claude Code
20-
21-
Every generated project includes a `CLAUDE.md` file with:
16+
These configurations are dynamically generated based on your installed IDEs and project settings, and include:
2217

2318
- Project-specific context and guidelines
2419
- Technology stack information
2520
- Code style rules and patterns
2621
- Common tasks and workflows
27-
28-
### GitHub Copilot Configuration
29-
30-
The template includes `.github/copilot-instructions.md` with:
31-
32-
- Project-specific context for GitHub Copilot
33-
- Code conventions and patterns
34-
- Testing requirements and workflow
22+
- Testing requirements and patterns
3523
- Security considerations
36-
- Common code patterns and examples
37-
- Task automation commands
38-
39-
### Cursor IDE Configuration
40-
41-
The template includes `.cursor/rules/` directory with:
42-
43-
- `project.mdc`: Always-active rules with project info, tech stack, and key commands
44-
- `testing.mdc`: Auto-attached rules for test files with testing guidelines and patterns
4524

4625
For more details on testing configuration and practices, see the [Testing Guide](testing.md).

docs/configuration.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,9 @@ After your project is generated, you are able to make any changes you'd like. He
4040

4141
### Environment Variables
4242

43-
Create or modify the `.envrc` file in your project root:
43+
Set environment variables for development:
4444

4545
```bash
46-
# API Keys
47-
export ZENABLE_API_KEY="your-api-key-here"
48-
49-
# Development settings
5046
export PYTHONPATH="${PWD}/src:${PYTHONPATH}"
5147
export UV_PYTHON_PREFERENCE="only-system"
5248
```

docs/hooks.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,15 @@ The `post_gen_project.py` hook runs after project generation to:
1414
2. Create the project's initial commit
1515
3. Set up GitHub remote (if credentials available)
1616
4. Generate a fully up-to-date `uv.lock` file
17-
5. Create an `.envrc` with API keys
18-
6. Run `task init` to install dependencies
19-
7. Push to GitHub and create an initial release
17+
5. Run `task init` to install dependencies
18+
6. Push to GitHub and create an initial release
2019

2120
### Configuration
2221

2322
Environment variables can be set before running cookiecutter to modify hook behavior:
2423

2524
- `SKIP_GIT_PUSH=true` - Skip automatic Git push
2625
- `RUN_POST_HOOK=false` - Skip the post-generation hook entirely (not recommended)
27-
- `ZENABLE_API_KEY="..."` - Auto-populate API key in .envrc
2826

2927
For more environment variable options, see the [Optional Setup Guide](optional-setup.md#environment-variable-configuration).
3028

docs/optional-setup.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,4 @@ uvx --with gitpython cookiecutter git+ssh://[email protected]/zenable-io/ai-native-
4848

4949
## Environment Variable Configuration
5050

51-
Generated projects include an `.envrc` file for environment-specific settings. API keys can be pre-populated during project generation by setting environment
52-
variables before running cookiecutter (see the [Hooks Guide](hooks.md#configuration)).
53-
54-
To request support for additional API keys, please [open an issue](https://github.com/Zenable-io/ai-native-python/issues/new) or [pull
55-
request](../CONTRIBUTING.md)!
51+
Set environment variables before running cookiecutter to modify hook behavior (see the [Hooks Guide](hooks.md#configuration)).

hooks/post_gen_project.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -122,34 +122,6 @@ def write_context(*, context: dict) -> None:
122122
yaml.dump(context, file)
123123

124124

125-
def populate_envrc() -> None:
126-
"""Create and populate the .envrc file with API key."""
127-
envrc_path = Path(".envrc")
128-
zenable_api_key = os.environ.get("ZENABLE_API_KEY")
129-
130-
if zenable_api_key:
131-
envrc_path.write_text(f'export API_KEY="{zenable_api_key}"\n')
132-
else:
133-
envrc_path.write_text('export API_KEY="<YOUR_ZENABLE_API_KEY>"\n')
134-
135-
# Restrict permissions to read-only, by the owner/current user
136-
envrc_path.chmod(0o600)
137-
138-
139-
def notify_envrc() -> None:
140-
zenable_api_key = os.environ.get("ZENABLE_API_KEY")
141-
print("\n" + "=" * 70)
142-
print("NOTE: Environment Configuration")
143-
print("=" * 70)
144-
print("\nA .envrc file has been created in your project directory")
145-
print("To use services that require API keys, update the .envrc file with your keys")
146-
print("The .envrc file has already been added to your .gitignore")
147-
print("=" * 70 + "\n")
148-
if zenable_api_key:
149-
print("Your ZENABLE_API_KEY has been automatically populated from the environment")
150-
print("=" * 70 + "\n")
151-
152-
153125
def notify_dockerhub_secrets() -> None:
154126
"""Notify user about required Docker Hub secrets for releases."""
155127
# We no longer need this once https://github.com/docker/roadmap/issues/314 is available
@@ -311,18 +283,13 @@ def run_post_gen_hook():
311283
check=True,
312284
)
313285

314-
# Create .envrc file with API key template
315-
populate_envrc()
316-
317286
# Run the initial setup step automatically so pre-commit hooks, etc. are pre-installed. However, if it fails, don't fail the overall repo generation
318287
# (i.e. check=False)
319288
subprocess.run(["task", "init"], check=False, capture_output=True)
320289

321290
# Notify about Docker Hub secrets if Docker Hub publishing is enabled
322291
if cookiecutter_context.get("dockerhub") == "yes":
323292
notify_dockerhub_secrets()
324-
325-
notify_envrc()
326293
except subprocess.CalledProcessError as error:
327294
stdout = error.stdout.decode("utf-8") if error.stdout else "No stdout"
328295
stderr = error.stderr.decode("utf-8") if error.stderr else "No stderr"

{{cookiecutter.project_name|replace(" ", "")}}/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
.mcp.json
21
.task/*
32
.lycheecache
43
sbom.*.json
54
vulns.*.json
65
license-check.*.json
76
{{ cookiecutter.github_org }}_{{ cookiecutter.project_slug }}_*_*.tar
8-
.envrc
97

108
# Created by https://www.toptal.com/developers/gitignore/api/vim,emacs,visualstudiocode,python,macos,windows
119
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,emacs,visualstudiocode,python,macos,windows

{{cookiecutter.project_name|replace(" ", "")}}/Taskfile.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,6 @@ tasks:
3939
# Sync dependencies with uv
4040
- uv sync --frozen --all-extras
4141

42-
init-direnv:
43-
desc: Sets up direnv locally
44-
internal: true
45-
status:
46-
- '{{ '{{if eq .GITHUB_ACTIONS "true"}}exit 0{{end}}' }}'
47-
cmds:
48-
- task: brew-install
49-
vars:
50-
TOOLS: direnv
51-
- direnv allow
52-
5342
init-pre-commit:
5443
desc: Install the pre-commit hooks
5544
internal: true
@@ -77,7 +66,6 @@ tasks:
7766
desc: Initialize the repo for local use; intended to be run after git clone
7867
cmds:
7968
- task: init-uv
80-
- task: init-direnv
8169
- task: init-pre-commit
8270
- task: init-docker-multiplatform
8371

0 commit comments

Comments
 (0)