Skip to content

Commit 0e9e8f9

Browse files
committed
feat: Laravel Forge MCP Server
0 parents  commit 0e9e8f9

File tree

507 files changed

+48494
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

507 files changed

+48494
-0
lines changed

.cursorrules

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Regras do Projeto Laravel Forge MCP
2+
3+
4+
5+
## ⛔ Regras Invioláveis — SEMPRE APLICAR
6+
7+
8+
9+
### Antes de Implementar
10+
11+
**OBRIGATÓRIO**: Este é um servidor MCP para Laravel Forge. Consulte a estrutura antes de criar novas tools.
12+
13+
14+
15+
### Tipagem e Código
16+
17+
- **PHP 8.2+ estrito**: TODOS parâmetros, retornos e propriedades tipados
18+
- **Visibilidade explícita**: SEMPRE `public`, `private` ou `protected`
19+
- **Naming completo**: Sem abreviações (ex: `serverId` não `srvId`)
20+
- **Laravel moderno**: Dependency injection, DTOs com `spatie/laravel-data`
21+
- **Sem facades**: Preferir injection sobre facades quando possível
22+
- **Estrutura**: Early return, sem comentários óbvios, código limpo
23+
24+
25+
26+
### Nomenclatura MCP Tools
27+
28+
- **Formato**: `{action}-{resource}-tool` (ex: `list-servers-tool`, `create-site-tool`)
29+
- **Actions**: `list`, `get`, `create`, `update`, `delete`, `restart`, `deploy`
30+
- **Localização**: Todas em `app/Mcp/Tools/`
31+
32+
33+
34+
### Validação Automática
35+
36+
Após edições, SEMPRE:
37+
38+
1. Verificar linter errors com `read_lints()`
39+
2. Executar `./vendor/bin/pint` para formatação
40+
3. Executar `./vendor/bin/phpstan analyse` para análise estática
41+
4. Rodar `php artisan test` se modificar lógica
42+
43+
44+
45+
### Commits
46+
47+
- Conventional Commits em português
48+
- ❌ NUNCA adicionar créditos de IA
49+
50+
51+
52+
### Estrutura do Projeto
53+
54+
- `app/Mcp/Tools/` - Ferramentas MCP (102 tools)
55+
- `app/Mcp/Resources/` - Recursos MCP (docs, guidelines)
56+
- `app/Mcp/Prompts/` - Prompts MCP (workflows)
57+
- `app/Mcp/Servers/` - Configuração servidor MCP
58+
- `app/Services/Forge/` - Serviços de integração Forge API
59+
- `tests/Feature/` - Testes de feature (Pest PHP)
60+
- `tests/Unit/` - Testes unitários
61+
62+
63+
64+
### Comandos Úteis
65+
66+
```bash
67+
php artisan test # Rodar testes
68+
./vendor/bin/pint # Formatar código
69+
./vendor/bin/phpstan analyse # Análise estática
70+
php artisan mcp:start forge # Iniciar servidor MCP
71+
```
72+
73+
74+
75+
### Documentação
76+
77+
- [Laravel Forge Docs](https://forge.laravel.com/docs)
78+
- [Forge API Docs](https://forge.laravel.com/api-documentation)
79+
- [Laravel Forge SDK](https://github.com/laravel/forge-sdk)
80+
- [Model Context Protocol](https://modelcontextprotocol.io)
81+
82+
83+
84+
---
85+
86+
87+
88+
**Stack**: Laravel 12 + MCP Protocol + Forge SDK | Auth: `FORGE_API_TOKEN` via `.env`
89+
90+
91+
92+
**Prioridade**: Tipagem > Visibilidade > Naming > Estrutura > Testes

.dockerignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Git
2+
.git
3+
.github
4+
.gitignore
5+
.gitattributes
6+
7+
# Dependencies
8+
node_modules
9+
vendor
10+
11+
# Environment
12+
.env
13+
.env.*
14+
!.env.example
15+
16+
# Testing
17+
tests
18+
phpunit.xml
19+
.phpunit.result.cache
20+
21+
# Development
22+
.vscode
23+
.idea
24+
.claude
25+
26+
# Documentation
27+
*.md
28+
!README.md
29+
docs
30+
31+
# Build artifacts
32+
storage/app/*
33+
storage/framework/cache/*
34+
storage/framework/sessions/*
35+
storage/framework/views/*
36+
storage/logs/*
37+
bootstrap/cache/*
38+
39+
# Keep necessary directories
40+
!storage/app/.gitignore
41+
!storage/framework/.gitignore
42+
!storage/framework/cache/.gitignore
43+
!storage/framework/sessions/.gitignore
44+
!storage/framework/views/.gitignore
45+
!storage/logs/.gitignore
46+
!bootstrap/cache/.gitignore
47+
48+
# Misc
49+
.DS_Store
50+
Thumbs.db
51+
*.log
52+
.phpunit.cache

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml,blade.php,css,js,json,xml}]
15+
indent_size = 2
16+
17+
[compose.yaml]
18+
indent_size = 4

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
APP_NAME="Forge MCP"
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
LOG_LEVEL=debug
9+
10+
FILESYSTEM_DISK=local
11+
12+
FORGE_API_TOKEN=

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
10+
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
# Optional: Filter by PR author
16+
# if: |
17+
# github.event.pull_request.user.login == 'external-contributor' ||
18+
# github.event.pull_request.user.login == 'new-developer' ||
19+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: read
25+
issues: read
26+
id-token: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Run Claude Code Review
35+
id: claude-review
36+
uses: anthropics/claude-code-action@v1
37+
with:
38+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+
prompt: |
40+
REPO: ${{ github.repository }}
41+
PR NUMBER: ${{ github.event.pull_request.number }}
42+
43+
Please review this pull request and provide feedback on:
44+
- Code quality and best practices
45+
- Potential bugs or issues
46+
- Performance considerations
47+
- Security concerns
48+
- Test coverage
49+
50+
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
51+
52+
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
53+
54+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55+
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
56+
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'

.github/workflows/claude.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
actions: read # Required for Claude to read CI results on PRs
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Run Claude Code
34+
id: claude
35+
uses: anthropics/claude-code-action@v1
36+
with:
37+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38+
39+
# This is an optional setting that allows Claude to read CI results on PRs
40+
additional_permissions: |
41+
actions: read
42+
43+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44+
# prompt: 'Update the pull request description to include a summary of changes.'
45+
46+
# Optional: Add claude_args to customize behavior and configuration
47+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48+
# or https://docs.claude.com/en/docs/claude-code/cli-reference for available options
49+
# claude_args: '--allowed-tools Bash(gh pr:*)'

.github/workflows/docker.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Docker Build & Push
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
tags: ["v*"]
7+
workflow_dispatch:
8+
9+
env:
10+
IMAGE_NAME: ddrcn/forge-mcp
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Login to Docker Hub
30+
uses: docker/login-action@v3
31+
with:
32+
username: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
35+
- name: Extract metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.IMAGE_NAME }}
40+
tags: |
41+
type=ref,event=branch
42+
type=semver,pattern={{version}}
43+
type=semver,pattern={{major}}.{{minor}}
44+
type=raw,value=latest,enable={{is_default_branch}}
45+
46+
- name: Build and push
47+
uses: docker/build-push-action@v5
48+
with:
49+
context: .
50+
platforms: linux/amd64,linux/arm64
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max
56+
57+
- name: Update Docker Hub description
58+
uses: peter-evans/dockerhub-description@v4
59+
with:
60+
username: ${{ secrets.DOCKERHUB_USERNAME }}
61+
password: ${{ secrets.DOCKERHUB_TOKEN }}
62+
repository: ddrcn/forge-mcp
63+
readme-filepath: ./README.md

0 commit comments

Comments
 (0)