Skip to content

Commit 911e845

Browse files
authored
feat: add MCP server support for enhanced documentation access (#201)
* feat: add MCP server configuration for enhanced documentation access * feat: add MCP server configuration for enhanced documentation access
1 parent dc02224 commit 911e845

File tree

2 files changed

+103
-8
lines changed

2 files changed

+103
-8
lines changed

.github/workflows/claude.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,31 @@ jobs:
3939
# This is an optional setting that allows Claude to read CI results on PRs
4040
additional_permissions: |
4141
actions: read
42-
42+
43+
# MCP Configuration for Terraform and Context7 documentation access
44+
mcp_config: |
45+
{
46+
"mcpServers": {
47+
"terraform": {
48+
"command": "npx",
49+
"args": [
50+
"-y",
51+
"@modelcontextprotocol/server-terraform@latest"
52+
]
53+
},
54+
"context7": {
55+
"command": "npx",
56+
"args": [
57+
"-y",
58+
"@upstash/context7-mcp@latest"
59+
]
60+
}
61+
}
62+
}
63+
64+
# Allow Bash permissions for pre-commit hooks and documentation updates + MCP tools
65+
allowed_tools: "Bash(pre-commit run --files),Bash(terraform fmt),Bash(terraform validate),Bash(terraform-docs),mcp__terraform-server__getProviderDocs,mcp__terraform-server__resolveProviderDocID,mcp__terraform-server__searchModules,mcp__terraform-server__moduleDetails,mcp__context7__resolve-library-id,mcp__context7__get-library-docs"
66+
4367
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
4468
# model: "claude-opus-4-20250514"
4569

@@ -49,9 +73,6 @@ jobs:
4973
# Optional: Trigger when specific user is assigned to an issue
5074
# assignee_trigger: "claude-bot"
5175

52-
# Optional: Allow Claude to run specific commands
53-
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
54-
5576
# Optional: Add custom instructions for Claude to customize its behavior for your project
5677
# custom_instructions: |
5778
# Follow our coding standards
@@ -61,4 +82,3 @@ jobs:
6182
# Optional: Custom environment variables for Claude
6283
# claude_env: |
6384
# NODE_ENV: test
64-

CLAUDE.md

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ variable "backup_vault_access_policy" {
335335
# Additional validation to prevent overly permissive policies
336336
validation {
337337
condition = var.backup_vault_access_policy == "" ? true : (
338-
!can(regex("\"Principal\"\s*:\s*\"\*\"", var.backup_vault_access_policy)) &&
339-
!can(regex("\"Action\"\s*:\s*\"\*\"", var.backup_vault_access_policy))
338+
!can(regex("\"Principal\"\\s*:\\s*\"\\*\"", var.backup_vault_access_policy)) &&
339+
!can(regex("\"Action\"\\s*:\\s*\"\\*\"", var.backup_vault_access_policy))
340340
)
341341
error_message = "backup_vault_access_policy cannot have wildcard (*) principals or actions for security."
342342
}
@@ -1040,4 +1040,79 @@ terraform {
10401040
9. **16 Example Configurations** - From simple to enterprise-grade scenarios
10411041
10. **Performance Optimization** - Backup job scheduling and resource optimization
10421042

1043-
*Note: This module focuses on AWS Backup best practices and patterns specific to backup and disaster recovery operations.*
1043+
*Note: This module focuses on AWS Backup best practices and patterns specific to backup and disaster recovery operations.*
1044+
1045+
## MCP Server Configuration
1046+
1047+
### Available MCP Servers
1048+
This project is configured to use the following Model Context Protocol (MCP) servers for enhanced documentation access:
1049+
1050+
#### Terraform MCP Server
1051+
**Purpose**: Access up-to-date Terraform and AWS provider documentation
1052+
**Package**: `@modelcontextprotocol/server-terraform`
1053+
1054+
**Local Configuration** (`.mcp.json`):
1055+
```json
1056+
{
1057+
"mcpServers": {
1058+
"terraform": {
1059+
"command": "npx",
1060+
"args": ["-y", "@modelcontextprotocol/server-terraform@latest"]
1061+
}
1062+
}
1063+
}
1064+
```
1065+
1066+
**Usage Examples**:
1067+
- `Look up aws_backup_vault resource documentation`
1068+
- `Find the latest AWS Backup lifecycle policy examples`
1069+
- `Search for AWS Backup Terraform modules`
1070+
- `Get documentation for aws_backup_plan resource`
1071+
1072+
#### Context7 MCP Server
1073+
**Purpose**: Access general library and framework documentation
1074+
**Package**: `@upstash/context7-mcp`
1075+
1076+
**Local Configuration** (`.mcp.json`):
1077+
```json
1078+
{
1079+
"mcpServers": {
1080+
"context7": {
1081+
"command": "npx",
1082+
"args": ["-y", "@upstash/context7-mcp@latest"]
1083+
}
1084+
}
1085+
}
1086+
```
1087+
1088+
**Usage Examples**:
1089+
- `Look up Go testing patterns for Terratest`
1090+
- `Find AWS CLI backup commands documentation`
1091+
- `Get current Terraform best practices`
1092+
- `Search for GitHub Actions workflow patterns`
1093+
1094+
### GitHub Actions Integration
1095+
The MCP servers are automatically available in GitHub Actions through the claude.yml workflow configuration. Claude can access the same documentation in PRs and issues as available locally.
1096+
1097+
### Usage Tips
1098+
1. **Be Specific**: When requesting documentation, specify the exact resource or concept
1099+
2. **Version Awareness**: Both servers provide current, version-specific documentation
1100+
3. **Combine Sources**: Use Terraform MCP for backup-specific docs, Context7 for general development patterns
1101+
4. **Local vs CI**: Same MCP servers work in both local development and GitHub Actions
1102+
1103+
### Example Workflows
1104+
1105+
**Backup Resource Development**:
1106+
```
1107+
@claude I need to add support for backup vault lock. Can you look up the latest aws_backup_vault_lock_configuration documentation and show me how to implement this feature?
1108+
```
1109+
1110+
**Testing Pattern Research**:
1111+
```
1112+
@claude Look up current Terratest patterns for testing AWS Backup resources and help me add comprehensive tests for vault lock functionality.
1113+
```
1114+
1115+
**Security Enhancement**:
1116+
```
1117+
@claude Research the latest AWS Backup security best practices and help me implement enhanced encryption configurations in this module.
1118+
```

0 commit comments

Comments
 (0)