autoworkflow 3.1.5 → 3.6.0
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.
- package/.claude/commands/analyze.md +19 -0
- package/.claude/commands/audit.md +26 -0
- package/.claude/commands/build.md +39 -0
- package/.claude/commands/commit.md +25 -0
- package/.claude/commands/fix.md +23 -0
- package/.claude/commands/plan.md +18 -0
- package/.claude/commands/suggest.md +23 -0
- package/.claude/commands/verify.md +18 -0
- package/.claude/hooks/post-bash-router.sh +20 -0
- package/.claude/hooks/post-commit.sh +140 -0
- package/.claude/hooks/post-edit.sh +190 -17
- package/.claude/hooks/pre-edit.sh +221 -0
- package/.claude/hooks/session-check.sh +90 -0
- package/.claude/settings.json +56 -6
- package/.claude/settings.local.json +5 -1
- package/.claude/skills/actix.md +337 -0
- package/.claude/skills/alembic.md +504 -0
- package/.claude/skills/angular.md +237 -0
- package/.claude/skills/api-design.md +187 -0
- package/.claude/skills/aspnet-core.md +377 -0
- package/.claude/skills/astro.md +245 -0
- package/.claude/skills/auth-clerk.md +327 -0
- package/.claude/skills/auth-firebase.md +367 -0
- package/.claude/skills/auth-nextauth.md +359 -0
- package/.claude/skills/auth-supabase.md +368 -0
- package/.claude/skills/axum.md +386 -0
- package/.claude/skills/blazor.md +456 -0
- package/.claude/skills/chi.md +348 -0
- package/.claude/skills/code-review.md +133 -0
- package/.claude/skills/csharp.md +296 -0
- package/.claude/skills/css-modules.md +325 -0
- package/.claude/skills/cypress.md +343 -0
- package/.claude/skills/debugging.md +133 -0
- package/.claude/skills/diesel.md +392 -0
- package/.claude/skills/django.md +301 -0
- package/.claude/skills/docker.md +319 -0
- package/.claude/skills/doctrine.md +473 -0
- package/.claude/skills/documentation.md +182 -0
- package/.claude/skills/dotnet.md +409 -0
- package/.claude/skills/drizzle.md +293 -0
- package/.claude/skills/echo.md +321 -0
- package/.claude/skills/eloquent.md +256 -0
- package/.claude/skills/emotion.md +426 -0
- package/.claude/skills/entity-framework.md +370 -0
- package/.claude/skills/express.md +316 -0
- package/.claude/skills/fastapi.md +329 -0
- package/.claude/skills/fastify.md +299 -0
- package/.claude/skills/fiber.md +315 -0
- package/.claude/skills/flask.md +322 -0
- package/.claude/skills/gin.md +342 -0
- package/.claude/skills/git.md +116 -0
- package/.claude/skills/github-actions.md +353 -0
- package/.claude/skills/go.md +377 -0
- package/.claude/skills/gorm.md +409 -0
- package/.claude/skills/graphql.md +478 -0
- package/.claude/skills/hibernate.md +379 -0
- package/.claude/skills/hono.md +306 -0
- package/.claude/skills/java.md +400 -0
- package/.claude/skills/jest.md +313 -0
- package/.claude/skills/jpa.md +282 -0
- package/.claude/skills/kotlin.md +347 -0
- package/.claude/skills/kubernetes.md +363 -0
- package/.claude/skills/laravel.md +414 -0
- package/.claude/skills/mcp-browser.md +320 -0
- package/.claude/skills/mcp-database.md +219 -0
- package/.claude/skills/mcp-fetch.md +241 -0
- package/.claude/skills/mcp-filesystem.md +204 -0
- package/.claude/skills/mcp-github.md +217 -0
- package/.claude/skills/mcp-memory.md +240 -0
- package/.claude/skills/mcp-search.md +218 -0
- package/.claude/skills/mcp-slack.md +262 -0
- package/.claude/skills/micronaut.md +388 -0
- package/.claude/skills/mongodb.md +319 -0
- package/.claude/skills/mongoose.md +355 -0
- package/.claude/skills/mysql.md +281 -0
- package/.claude/skills/nestjs.md +335 -0
- package/.claude/skills/nextjs-app-router.md +260 -0
- package/.claude/skills/nextjs-pages.md +172 -0
- package/.claude/skills/nuxt.md +202 -0
- package/.claude/skills/openapi.md +489 -0
- package/.claude/skills/performance.md +199 -0
- package/.claude/skills/php.md +398 -0
- package/.claude/skills/playwright.md +371 -0
- package/.claude/skills/postgresql.md +257 -0
- package/.claude/skills/prisma.md +293 -0
- package/.claude/skills/pydantic.md +304 -0
- package/.claude/skills/pytest.md +313 -0
- package/.claude/skills/python.md +272 -0
- package/.claude/skills/quarkus.md +377 -0
- package/.claude/skills/react.md +230 -0
- package/.claude/skills/redis.md +391 -0
- package/.claude/skills/refactoring.md +143 -0
- package/.claude/skills/remix.md +246 -0
- package/.claude/skills/rest-api.md +490 -0
- package/.claude/skills/rocket.md +366 -0
- package/.claude/skills/rust.md +341 -0
- package/.claude/skills/sass.md +380 -0
- package/.claude/skills/sea-orm.md +382 -0
- package/.claude/skills/security.md +167 -0
- package/.claude/skills/sequelize.md +395 -0
- package/.claude/skills/spring-boot.md +416 -0
- package/.claude/skills/sqlalchemy.md +269 -0
- package/.claude/skills/sqlx-rust.md +408 -0
- package/.claude/skills/state-jotai.md +346 -0
- package/.claude/skills/state-mobx.md +353 -0
- package/.claude/skills/state-pinia.md +431 -0
- package/.claude/skills/state-redux.md +337 -0
- package/.claude/skills/state-tanstack-query.md +434 -0
- package/.claude/skills/state-zustand.md +340 -0
- package/.claude/skills/styled-components.md +403 -0
- package/.claude/skills/svelte.md +238 -0
- package/.claude/skills/sveltekit.md +207 -0
- package/.claude/skills/symfony.md +437 -0
- package/.claude/skills/tailwind.md +279 -0
- package/.claude/skills/terraform.md +394 -0
- package/.claude/skills/testing-library.md +371 -0
- package/.claude/skills/trpc.md +426 -0
- package/.claude/skills/typeorm.md +368 -0
- package/.claude/skills/vitest.md +330 -0
- package/.claude/skills/vue.md +202 -0
- package/.claude/skills/warp.md +365 -0
- package/README.md +163 -52
- package/package.json +1 -1
- package/system/triggers.md +256 -17
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# MCP Database Skill
|
|
2
|
+
|
|
3
|
+
## PostgreSQL Server Configuration
|
|
4
|
+
\`\`\`json
|
|
5
|
+
// claude_desktop_config.json or .claude/settings.json
|
|
6
|
+
{
|
|
7
|
+
"mcpServers": {
|
|
8
|
+
"postgres": {
|
|
9
|
+
"command": "npx",
|
|
10
|
+
"args": ["-y", "@modelcontextprotocol/server-postgres"],
|
|
11
|
+
"env": {
|
|
12
|
+
"POSTGRES_CONNECTION_STRING": "postgresql://user:password@localhost:5432/dbname"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
\`\`\`
|
|
18
|
+
|
|
19
|
+
## SQLite Server Configuration
|
|
20
|
+
\`\`\`json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"sqlite": {
|
|
24
|
+
"command": "npx",
|
|
25
|
+
"args": ["-y", "@modelcontextprotocol/server-sqlite", "/path/to/database.db"]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
\`\`\`
|
|
30
|
+
|
|
31
|
+
## MySQL Server Configuration
|
|
32
|
+
\`\`\`json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"mysql": {
|
|
36
|
+
"command": "npx",
|
|
37
|
+
"args": ["-y", "@benborla29/mcp-server-mysql"],
|
|
38
|
+
"env": {
|
|
39
|
+
"MYSQL_HOST": "localhost",
|
|
40
|
+
"MYSQL_PORT": "3306",
|
|
41
|
+
"MYSQL_USER": "root",
|
|
42
|
+
"MYSQL_PASSWORD": "password",
|
|
43
|
+
"MYSQL_DATABASE": "mydb"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
## Available Tools
|
|
51
|
+
|
|
52
|
+
### Query Operations
|
|
53
|
+
\`\`\`
|
|
54
|
+
query
|
|
55
|
+
- sql: string (SELECT query)
|
|
56
|
+
- Returns: array of rows
|
|
57
|
+
|
|
58
|
+
execute
|
|
59
|
+
- sql: string (INSERT, UPDATE, DELETE)
|
|
60
|
+
- Returns: affected rows count
|
|
61
|
+
|
|
62
|
+
describe_table
|
|
63
|
+
- table_name: string
|
|
64
|
+
- Returns: column definitions
|
|
65
|
+
|
|
66
|
+
list_tables
|
|
67
|
+
- Returns: array of table names
|
|
68
|
+
\`\`\`
|
|
69
|
+
|
|
70
|
+
### Schema Inspection
|
|
71
|
+
\`\`\`
|
|
72
|
+
get_schema
|
|
73
|
+
- Returns full database schema
|
|
74
|
+
|
|
75
|
+
list_indexes
|
|
76
|
+
- table_name?: string
|
|
77
|
+
- Returns: index definitions
|
|
78
|
+
|
|
79
|
+
list_foreign_keys
|
|
80
|
+
- table_name: string
|
|
81
|
+
- Returns: foreign key constraints
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
## Common Query Patterns
|
|
85
|
+
|
|
86
|
+
### Schema Exploration
|
|
87
|
+
\`\`\`sql
|
|
88
|
+
-- List all tables with row counts (PostgreSQL)
|
|
89
|
+
SELECT schemaname, tablename,
|
|
90
|
+
n_live_tup as row_count
|
|
91
|
+
FROM pg_stat_user_tables
|
|
92
|
+
ORDER BY n_live_tup DESC;
|
|
93
|
+
|
|
94
|
+
-- Get column info for a table
|
|
95
|
+
SELECT column_name, data_type, is_nullable, column_default
|
|
96
|
+
FROM information_schema.columns
|
|
97
|
+
WHERE table_name = 'users';
|
|
98
|
+
|
|
99
|
+
-- Find foreign key relationships
|
|
100
|
+
SELECT tc.table_name, kcu.column_name,
|
|
101
|
+
ccu.table_name AS foreign_table,
|
|
102
|
+
ccu.column_name AS foreign_column
|
|
103
|
+
FROM information_schema.table_constraints AS tc
|
|
104
|
+
JOIN information_schema.key_column_usage AS kcu
|
|
105
|
+
ON tc.constraint_name = kcu.constraint_name
|
|
106
|
+
JOIN information_schema.constraint_column_usage AS ccu
|
|
107
|
+
ON ccu.constraint_name = tc.constraint_name
|
|
108
|
+
WHERE constraint_type = 'FOREIGN KEY';
|
|
109
|
+
\`\`\`
|
|
110
|
+
|
|
111
|
+
### Data Analysis
|
|
112
|
+
\`\`\`sql
|
|
113
|
+
-- Recent records with pagination
|
|
114
|
+
SELECT * FROM orders
|
|
115
|
+
ORDER BY created_at DESC
|
|
116
|
+
LIMIT 20 OFFSET 0;
|
|
117
|
+
|
|
118
|
+
-- Aggregate statistics
|
|
119
|
+
SELECT
|
|
120
|
+
DATE_TRUNC('day', created_at) as date,
|
|
121
|
+
COUNT(*) as count,
|
|
122
|
+
SUM(amount) as total
|
|
123
|
+
FROM orders
|
|
124
|
+
WHERE created_at > NOW() - INTERVAL '30 days'
|
|
125
|
+
GROUP BY DATE_TRUNC('day', created_at)
|
|
126
|
+
ORDER BY date DESC;
|
|
127
|
+
|
|
128
|
+
-- Find duplicates
|
|
129
|
+
SELECT email, COUNT(*) as count
|
|
130
|
+
FROM users
|
|
131
|
+
GROUP BY email
|
|
132
|
+
HAVING COUNT(*) > 1;
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
### Safe Data Modifications
|
|
136
|
+
\`\`\`sql
|
|
137
|
+
-- Preview before UPDATE
|
|
138
|
+
SELECT * FROM users
|
|
139
|
+
WHERE last_login < NOW() - INTERVAL '1 year';
|
|
140
|
+
|
|
141
|
+
-- Soft delete pattern
|
|
142
|
+
UPDATE users
|
|
143
|
+
SET deleted_at = NOW()
|
|
144
|
+
WHERE id = 123;
|
|
145
|
+
|
|
146
|
+
-- Batch update with limit
|
|
147
|
+
UPDATE products
|
|
148
|
+
SET price = price * 1.1
|
|
149
|
+
WHERE category = 'electronics'
|
|
150
|
+
AND updated_at < NOW() - INTERVAL '1 month'
|
|
151
|
+
LIMIT 100;
|
|
152
|
+
\`\`\`
|
|
153
|
+
|
|
154
|
+
## Transaction Patterns
|
|
155
|
+
\`\`\`sql
|
|
156
|
+
-- Multi-step operation (run as single execute)
|
|
157
|
+
BEGIN;
|
|
158
|
+
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
|
|
159
|
+
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
|
|
160
|
+
INSERT INTO transfers (from_id, to_id, amount) VALUES (1, 2, 100);
|
|
161
|
+
COMMIT;
|
|
162
|
+
|
|
163
|
+
-- Rollback on error
|
|
164
|
+
BEGIN;
|
|
165
|
+
-- operations here
|
|
166
|
+
ROLLBACK; -- if something goes wrong
|
|
167
|
+
\`\`\`
|
|
168
|
+
|
|
169
|
+
## Performance Analysis
|
|
170
|
+
\`\`\`sql
|
|
171
|
+
-- PostgreSQL: Analyze query plan
|
|
172
|
+
EXPLAIN ANALYZE SELECT * FROM orders
|
|
173
|
+
WHERE user_id = 123;
|
|
174
|
+
|
|
175
|
+
-- Find slow queries (PostgreSQL)
|
|
176
|
+
SELECT query, mean_time, calls
|
|
177
|
+
FROM pg_stat_statements
|
|
178
|
+
ORDER BY mean_time DESC
|
|
179
|
+
LIMIT 10;
|
|
180
|
+
|
|
181
|
+
-- Find missing indexes
|
|
182
|
+
SELECT relname, seq_scan, seq_tup_read,
|
|
183
|
+
idx_scan, idx_tup_fetch
|
|
184
|
+
FROM pg_stat_user_tables
|
|
185
|
+
WHERE seq_scan > idx_scan
|
|
186
|
+
ORDER BY seq_tup_read DESC;
|
|
187
|
+
\`\`\`
|
|
188
|
+
|
|
189
|
+
## Security Best Practices
|
|
190
|
+
\`\`\`bash
|
|
191
|
+
# Connection string security
|
|
192
|
+
# NEVER commit credentials to version control
|
|
193
|
+
|
|
194
|
+
# Use environment variables
|
|
195
|
+
export POSTGRES_CONNECTION_STRING="postgresql://..."
|
|
196
|
+
|
|
197
|
+
# Use read-only user for exploration
|
|
198
|
+
CREATE ROLE readonly_user WITH LOGIN PASSWORD 'xxx';
|
|
199
|
+
GRANT CONNECT ON DATABASE mydb TO readonly_user;
|
|
200
|
+
GRANT USAGE ON SCHEMA public TO readonly_user;
|
|
201
|
+
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly_user;
|
|
202
|
+
\`\`\`
|
|
203
|
+
|
|
204
|
+
## ❌ DON'T
|
|
205
|
+
- Run DELETE or TRUNCATE without WHERE clause
|
|
206
|
+
- Execute unverified queries on production
|
|
207
|
+
- Expose connection strings in code
|
|
208
|
+
- Use root/admin credentials for exploration
|
|
209
|
+
- Run expensive queries without LIMIT
|
|
210
|
+
- Forget to use transactions for multi-step operations
|
|
211
|
+
|
|
212
|
+
## ✅ DO
|
|
213
|
+
- Use read-only credentials when possible
|
|
214
|
+
- Preview data before modifications (SELECT first)
|
|
215
|
+
- Use LIMIT for exploratory queries
|
|
216
|
+
- Analyze query plans for expensive operations
|
|
217
|
+
- Use parameterized queries in applications
|
|
218
|
+
- Back up data before major modifications
|
|
219
|
+
- Use transactions for atomic operations
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# MCP Fetch Skill
|
|
2
|
+
|
|
3
|
+
## Server Configuration
|
|
4
|
+
\`\`\`json
|
|
5
|
+
// claude_desktop_config.json or .claude/settings.json
|
|
6
|
+
{
|
|
7
|
+
"mcpServers": {
|
|
8
|
+
"fetch": {
|
|
9
|
+
"command": "npx",
|
|
10
|
+
"args": ["-y", "@modelcontextprotocol/server-fetch"]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
\`\`\`
|
|
15
|
+
|
|
16
|
+
## Available Tools
|
|
17
|
+
|
|
18
|
+
### fetch
|
|
19
|
+
\`\`\`
|
|
20
|
+
fetch
|
|
21
|
+
- url: string (URL to fetch)
|
|
22
|
+
- method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS'
|
|
23
|
+
- headers?: object (key-value pairs)
|
|
24
|
+
- body?: string (request body for POST/PUT/PATCH)
|
|
25
|
+
- Returns: {
|
|
26
|
+
status: number,
|
|
27
|
+
statusText: string,
|
|
28
|
+
headers: object,
|
|
29
|
+
body: string,
|
|
30
|
+
ok: boolean
|
|
31
|
+
}
|
|
32
|
+
\`\`\`
|
|
33
|
+
|
|
34
|
+
## HTTP Methods
|
|
35
|
+
|
|
36
|
+
### GET Request
|
|
37
|
+
\`\`\`
|
|
38
|
+
fetch:
|
|
39
|
+
url: "https://api.example.com/users"
|
|
40
|
+
method: "GET"
|
|
41
|
+
headers:
|
|
42
|
+
Accept: "application/json"
|
|
43
|
+
Authorization: "Bearer token123"
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
### POST Request with JSON
|
|
47
|
+
\`\`\`
|
|
48
|
+
fetch:
|
|
49
|
+
url: "https://api.example.com/users"
|
|
50
|
+
method: "POST"
|
|
51
|
+
headers:
|
|
52
|
+
Content-Type: "application/json"
|
|
53
|
+
Authorization: "Bearer token123"
|
|
54
|
+
body: '{"name": "John", "email": "john@example.com"}'
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
### PUT Request (Update)
|
|
58
|
+
\`\`\`
|
|
59
|
+
fetch:
|
|
60
|
+
url: "https://api.example.com/users/123"
|
|
61
|
+
method: "PUT"
|
|
62
|
+
headers:
|
|
63
|
+
Content-Type: "application/json"
|
|
64
|
+
body: '{"name": "John Updated"}'
|
|
65
|
+
\`\`\`
|
|
66
|
+
|
|
67
|
+
### DELETE Request
|
|
68
|
+
\`\`\`
|
|
69
|
+
fetch:
|
|
70
|
+
url: "https://api.example.com/users/123"
|
|
71
|
+
method: "DELETE"
|
|
72
|
+
headers:
|
|
73
|
+
Authorization: "Bearer token123"
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
## Authentication Patterns
|
|
77
|
+
|
|
78
|
+
### Bearer Token
|
|
79
|
+
\`\`\`
|
|
80
|
+
headers:
|
|
81
|
+
Authorization: "Bearer eyJhbGciOiJIUzI1NiIs..."
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
### API Key
|
|
85
|
+
\`\`\`
|
|
86
|
+
# In header
|
|
87
|
+
headers:
|
|
88
|
+
X-API-Key: "your-api-key"
|
|
89
|
+
|
|
90
|
+
# In query string
|
|
91
|
+
url: "https://api.example.com/data?api_key=your-key"
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
### Basic Auth
|
|
95
|
+
\`\`\`
|
|
96
|
+
headers:
|
|
97
|
+
Authorization: "Basic base64(username:password)"
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
## Common Headers
|
|
101
|
+
\`\`\`
|
|
102
|
+
Content-Type: "application/json" # JSON body
|
|
103
|
+
Content-Type: "application/x-www-form-urlencoded" # Form data
|
|
104
|
+
Content-Type: "multipart/form-data" # File uploads
|
|
105
|
+
Accept: "application/json" # Expect JSON response
|
|
106
|
+
Accept: "text/html" # Expect HTML
|
|
107
|
+
User-Agent: "MCP-Fetch/1.0" # Custom user agent
|
|
108
|
+
Cache-Control: "no-cache" # Skip cache
|
|
109
|
+
If-None-Match: "etag-value" # Conditional request
|
|
110
|
+
\`\`\`
|
|
111
|
+
|
|
112
|
+
## Response Handling
|
|
113
|
+
|
|
114
|
+
### Check Status
|
|
115
|
+
\`\`\`
|
|
116
|
+
Response:
|
|
117
|
+
ok: true/false (status 200-299)
|
|
118
|
+
status: 200, 201, 400, 401, 404, 500, etc.
|
|
119
|
+
statusText: "OK", "Not Found", etc.
|
|
120
|
+
|
|
121
|
+
Common status codes:
|
|
122
|
+
200 - OK (GET success)
|
|
123
|
+
201 - Created (POST success)
|
|
124
|
+
204 - No Content (DELETE success)
|
|
125
|
+
400 - Bad Request (invalid input)
|
|
126
|
+
401 - Unauthorized (auth required)
|
|
127
|
+
403 - Forbidden (no permission)
|
|
128
|
+
404 - Not Found
|
|
129
|
+
429 - Too Many Requests (rate limited)
|
|
130
|
+
500 - Internal Server Error
|
|
131
|
+
\`\`\`
|
|
132
|
+
|
|
133
|
+
### Parse Response Body
|
|
134
|
+
\`\`\`
|
|
135
|
+
# JSON response
|
|
136
|
+
body: '{"id": 1, "name": "John"}'
|
|
137
|
+
Parse as JSON to access data
|
|
138
|
+
|
|
139
|
+
# HTML response
|
|
140
|
+
body: '<!DOCTYPE html>...'
|
|
141
|
+
May need to extract specific content
|
|
142
|
+
|
|
143
|
+
# Error response
|
|
144
|
+
body: '{"error": "Invalid input", "code": "VALIDATION_ERROR"}'
|
|
145
|
+
Check ok=false and parse error details
|
|
146
|
+
\`\`\`
|
|
147
|
+
|
|
148
|
+
## Common API Patterns
|
|
149
|
+
|
|
150
|
+
### REST API CRUD
|
|
151
|
+
\`\`\`
|
|
152
|
+
# List resources
|
|
153
|
+
GET /api/users
|
|
154
|
+
|
|
155
|
+
# Get single resource
|
|
156
|
+
GET /api/users/123
|
|
157
|
+
|
|
158
|
+
# Create resource
|
|
159
|
+
POST /api/users
|
|
160
|
+
Body: {"name": "John"}
|
|
161
|
+
|
|
162
|
+
# Update resource
|
|
163
|
+
PUT /api/users/123 (full update)
|
|
164
|
+
PATCH /api/users/123 (partial update)
|
|
165
|
+
|
|
166
|
+
# Delete resource
|
|
167
|
+
DELETE /api/users/123
|
|
168
|
+
\`\`\`
|
|
169
|
+
|
|
170
|
+
### Pagination
|
|
171
|
+
\`\`\`
|
|
172
|
+
# Offset-based
|
|
173
|
+
GET /api/users?page=2&limit=20
|
|
174
|
+
|
|
175
|
+
# Cursor-based
|
|
176
|
+
GET /api/users?cursor=abc123&limit=20
|
|
177
|
+
|
|
178
|
+
# Response headers
|
|
179
|
+
Link: <url?page=3>; rel="next"
|
|
180
|
+
X-Total-Count: 100
|
|
181
|
+
\`\`\`
|
|
182
|
+
|
|
183
|
+
### Query Parameters
|
|
184
|
+
\`\`\`
|
|
185
|
+
# Filtering
|
|
186
|
+
GET /api/users?status=active&role=admin
|
|
187
|
+
|
|
188
|
+
# Sorting
|
|
189
|
+
GET /api/users?sort=created_at&order=desc
|
|
190
|
+
|
|
191
|
+
# Field selection
|
|
192
|
+
GET /api/users?fields=id,name,email
|
|
193
|
+
|
|
194
|
+
# Search
|
|
195
|
+
GET /api/users?q=john
|
|
196
|
+
\`\`\`
|
|
197
|
+
|
|
198
|
+
## Error Handling
|
|
199
|
+
\`\`\`
|
|
200
|
+
1. Check response.ok first
|
|
201
|
+
2. If false, parse error body
|
|
202
|
+
3. Handle specific status codes:
|
|
203
|
+
- 401: Refresh auth token
|
|
204
|
+
- 429: Wait and retry (check Retry-After header)
|
|
205
|
+
- 5xx: Retry with backoff
|
|
206
|
+
|
|
207
|
+
Common error response formats:
|
|
208
|
+
{
|
|
209
|
+
"error": "message",
|
|
210
|
+
"code": "ERROR_CODE",
|
|
211
|
+
"details": [...]
|
|
212
|
+
}
|
|
213
|
+
\`\`\`
|
|
214
|
+
|
|
215
|
+
## Rate Limiting
|
|
216
|
+
\`\`\`
|
|
217
|
+
Check response headers:
|
|
218
|
+
X-RateLimit-Limit: 100
|
|
219
|
+
X-RateLimit-Remaining: 45
|
|
220
|
+
X-RateLimit-Reset: 1640000000
|
|
221
|
+
|
|
222
|
+
If 429 status:
|
|
223
|
+
Retry-After: 60 (seconds to wait)
|
|
224
|
+
\`\`\`
|
|
225
|
+
|
|
226
|
+
## ❌ DON'T
|
|
227
|
+
- Expose API keys in logs or output
|
|
228
|
+
- Ignore rate limits
|
|
229
|
+
- Skip error handling
|
|
230
|
+
- Hardcode credentials in requests
|
|
231
|
+
- Trust user input in URLs (injection risk)
|
|
232
|
+
- Fetch from untrusted URLs
|
|
233
|
+
|
|
234
|
+
## ✅ DO
|
|
235
|
+
- Use HTTPS for all requests
|
|
236
|
+
- Handle all response status codes
|
|
237
|
+
- Respect rate limits and Retry-After
|
|
238
|
+
- Validate URLs before fetching
|
|
239
|
+
- Use appropriate Content-Type headers
|
|
240
|
+
- Parse and validate response data
|
|
241
|
+
- Log requests for debugging (without secrets)
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# MCP Filesystem Skill
|
|
2
|
+
|
|
3
|
+
## Server Configuration
|
|
4
|
+
\`\`\`json
|
|
5
|
+
// claude_desktop_config.json or .claude/settings.json
|
|
6
|
+
{
|
|
7
|
+
"mcpServers": {
|
|
8
|
+
"filesystem": {
|
|
9
|
+
"command": "npx",
|
|
10
|
+
"args": [
|
|
11
|
+
"-y",
|
|
12
|
+
"@modelcontextprotocol/server-filesystem",
|
|
13
|
+
"/Users/username/projects",
|
|
14
|
+
"/Users/username/documents"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
\`\`\`
|
|
20
|
+
|
|
21
|
+
## Security: Allowed Directories
|
|
22
|
+
\`\`\`bash
|
|
23
|
+
# The server ONLY allows access to explicitly listed directories
|
|
24
|
+
# Each path argument grants access to that directory and all subdirectories
|
|
25
|
+
|
|
26
|
+
# Example: Grant access to multiple project folders
|
|
27
|
+
"args": [
|
|
28
|
+
"-y",
|
|
29
|
+
"@modelcontextprotocol/server-filesystem",
|
|
30
|
+
"/Users/me/work/project-a",
|
|
31
|
+
"/Users/me/work/project-b",
|
|
32
|
+
"/Users/me/shared/configs"
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
# NEVER grant access to:
|
|
36
|
+
# - Home directory root (~/)
|
|
37
|
+
# - System directories (/etc, /usr, /System)
|
|
38
|
+
# - Credential directories (~/.ssh, ~/.aws)
|
|
39
|
+
\`\`\`
|
|
40
|
+
|
|
41
|
+
## Available Tools
|
|
42
|
+
|
|
43
|
+
### Read Operations
|
|
44
|
+
\`\`\`
|
|
45
|
+
read_file
|
|
46
|
+
- path: string (absolute path to file)
|
|
47
|
+
- Returns: file contents as string
|
|
48
|
+
|
|
49
|
+
read_multiple_files
|
|
50
|
+
- paths: string[] (array of file paths)
|
|
51
|
+
- Returns: array of { path, content } or { path, error }
|
|
52
|
+
|
|
53
|
+
get_file_info
|
|
54
|
+
- path: string
|
|
55
|
+
- Returns: {
|
|
56
|
+
size: number (bytes),
|
|
57
|
+
created: string (ISO date),
|
|
58
|
+
modified: string (ISO date),
|
|
59
|
+
accessed: string (ISO date),
|
|
60
|
+
isDirectory: boolean,
|
|
61
|
+
isFile: boolean,
|
|
62
|
+
permissions: string
|
|
63
|
+
}
|
|
64
|
+
\`\`\`
|
|
65
|
+
|
|
66
|
+
### Write Operations
|
|
67
|
+
\`\`\`
|
|
68
|
+
write_file
|
|
69
|
+
- path: string (absolute path)
|
|
70
|
+
- content: string (file content)
|
|
71
|
+
- Returns: success confirmation
|
|
72
|
+
|
|
73
|
+
edit_file
|
|
74
|
+
- path: string
|
|
75
|
+
- edits: array of {
|
|
76
|
+
oldText: string,
|
|
77
|
+
newText: string
|
|
78
|
+
}
|
|
79
|
+
- dryRun?: boolean (preview changes without writing)
|
|
80
|
+
- Returns: diff preview or success confirmation
|
|
81
|
+
|
|
82
|
+
create_directory
|
|
83
|
+
- path: string
|
|
84
|
+
- Returns: success confirmation
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
### Directory Operations
|
|
88
|
+
\`\`\`
|
|
89
|
+
list_directory
|
|
90
|
+
- path: string (directory path)
|
|
91
|
+
- Returns: array of entries with name, type (file/directory)
|
|
92
|
+
|
|
93
|
+
list_allowed_directories
|
|
94
|
+
- Returns: array of paths the server can access
|
|
95
|
+
|
|
96
|
+
move_file
|
|
97
|
+
- source: string
|
|
98
|
+
- destination: string
|
|
99
|
+
- Returns: success confirmation
|
|
100
|
+
|
|
101
|
+
search_files
|
|
102
|
+
- path: string (directory to search in)
|
|
103
|
+
- pattern: string (glob pattern like "*.ts" or "**/*.json")
|
|
104
|
+
- excludePatterns?: string[] (patterns to exclude)
|
|
105
|
+
- Returns: array of matching file paths
|
|
106
|
+
\`\`\`
|
|
107
|
+
|
|
108
|
+
## Common Patterns
|
|
109
|
+
|
|
110
|
+
### Project Structure Analysis
|
|
111
|
+
\`\`\`
|
|
112
|
+
1. list_directory on root to understand structure
|
|
113
|
+
2. search_files for specific file types ("**/*.ts")
|
|
114
|
+
3. read_multiple_files for key config files:
|
|
115
|
+
- package.json
|
|
116
|
+
- tsconfig.json
|
|
117
|
+
- .env.example
|
|
118
|
+
\`\`\`
|
|
119
|
+
|
|
120
|
+
### Safe File Editing
|
|
121
|
+
\`\`\`
|
|
122
|
+
1. read_file to get current content
|
|
123
|
+
2. Use edit_file with dryRun: true to preview
|
|
124
|
+
3. Review diff output
|
|
125
|
+
4. Apply with dryRun: false
|
|
126
|
+
\`\`\`
|
|
127
|
+
|
|
128
|
+
### Batch File Operations
|
|
129
|
+
\`\`\`
|
|
130
|
+
// Read all TypeScript files in src/
|
|
131
|
+
1. search_files with path: "/project/src", pattern: "**/*.ts"
|
|
132
|
+
2. read_multiple_files with resulting paths
|
|
133
|
+
3. Analyze contents
|
|
134
|
+
|
|
135
|
+
// Create new component structure
|
|
136
|
+
1. create_directory for component folder
|
|
137
|
+
2. write_file for each file (index.ts, Component.tsx, styles.ts)
|
|
138
|
+
\`\`\`
|
|
139
|
+
|
|
140
|
+
### Configuration Updates
|
|
141
|
+
\`\`\`
|
|
142
|
+
1. read_file: package.json
|
|
143
|
+
2. Parse JSON content
|
|
144
|
+
3. Modify dependencies
|
|
145
|
+
4. write_file with updated content
|
|
146
|
+
\`\`\`
|
|
147
|
+
|
|
148
|
+
## Glob Pattern Reference
|
|
149
|
+
\`\`\`bash
|
|
150
|
+
* # Match any file in current directory
|
|
151
|
+
** # Match all files recursively
|
|
152
|
+
*.ts # All TypeScript files in current directory
|
|
153
|
+
**/*.ts # All TypeScript files recursively
|
|
154
|
+
**/*.{ts,tsx} # All .ts and .tsx files
|
|
155
|
+
src/**/* # All files in src/ subdirectories
|
|
156
|
+
!node_modules # Exclude (in excludePatterns)
|
|
157
|
+
!**/*.test.ts # Exclude test files
|
|
158
|
+
\`\`\`
|
|
159
|
+
|
|
160
|
+
## Path Handling
|
|
161
|
+
\`\`\`bash
|
|
162
|
+
# Always use absolute paths
|
|
163
|
+
/Users/username/project/src/index.ts # Correct
|
|
164
|
+
./src/index.ts # Incorrect
|
|
165
|
+
src/index.ts # Incorrect
|
|
166
|
+
|
|
167
|
+
# Path traversal is blocked
|
|
168
|
+
/allowed/path/../../../etc/passwd # Blocked by server
|
|
169
|
+
|
|
170
|
+
# Symlinks
|
|
171
|
+
# Server follows symlinks but validates final path
|
|
172
|
+
# is within allowed directories
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
## File Size Considerations
|
|
176
|
+
\`\`\`bash
|
|
177
|
+
# Large files may be truncated or cause issues
|
|
178
|
+
# For large files:
|
|
179
|
+
# - Read in chunks if supported
|
|
180
|
+
# - Use search_files to find specific files
|
|
181
|
+
# - Consider streaming alternatives
|
|
182
|
+
|
|
183
|
+
# Recommended limits:
|
|
184
|
+
# - Text files: < 1MB ideal
|
|
185
|
+
# - Log files: use tail/head in bash instead
|
|
186
|
+
# - Binary files: not supported
|
|
187
|
+
\`\`\`
|
|
188
|
+
|
|
189
|
+
## ❌ DON'T
|
|
190
|
+
- Grant access to home directory root
|
|
191
|
+
- Include ~/.ssh, ~/.aws, or credential directories
|
|
192
|
+
- Write to system directories
|
|
193
|
+
- Overwrite files without reading first
|
|
194
|
+
- Ignore the allowed directories restriction
|
|
195
|
+
- Use relative paths
|
|
196
|
+
|
|
197
|
+
## ✅ DO
|
|
198
|
+
- Use minimal directory access grants
|
|
199
|
+
- Preview edits with dryRun before applying
|
|
200
|
+
- Use read_multiple_files for batch operations
|
|
201
|
+
- Check file existence with get_file_info
|
|
202
|
+
- Use search_files with exclusion patterns
|
|
203
|
+
- Validate paths are within allowed directories
|
|
204
|
+
- Use absolute paths in all operations
|