vibes-plug 1.0.0 → 2.5.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/.github/workflows/publish.yml +20 -0
- package/AGENTS.md +66 -0
- package/BLUEPRINT.md +152 -60
- package/CHANGELOG.md +50 -0
- package/README.md +346 -194
- package/package.json +25 -25
- package/plugin.json +1 -1
- package/skills/ai-cost-token-optimizer/SKILL.md +52 -0
- package/skills/ai-llm-integration-expert/SKILL.md +180 -162
- package/skills/api-design-expert/SKILL.md +314 -310
- package/skills/app-analyzer-optimizer/SKILL.md +193 -189
- package/skills/apple-ecosystem-expert/SKILL.md +142 -0
- package/skills/async-queue-temporal-expert/SKILL.md +54 -0
- package/skills/authentication-identity-expert/SKILL.md +251 -20
- package/skills/auto-doc-updater/SKILL.md +214 -204
- package/skills/autonomous-chaos-monkey/SKILL.md +63 -0
- package/skills/autonomous-red-teamer/SKILL.md +59 -0
- package/skills/autonomous-swarm-director/SKILL.md +69 -0
- package/skills/autonomous-tdd-debugger/SKILL.md +65 -0
- package/skills/bootstrap-to-modern/SKILL.md +90 -86
- package/skills/brainstorming/SKILL.md +373 -353
- package/skills/browser-automation-expert/SKILL.md +46 -0
- package/skills/ci-cd-devops-architect/SKILL.md +72 -45
- package/skills/cloud-hosting-expert/SKILL.md +244 -244
- package/skills/coderabbit/SKILL.md +192 -192
- package/skills/cron-scheduler-expert/SKILL.md +298 -0
- package/skills/data-telemetry-expert/SKILL.md +213 -213
- package/skills/database-orm-expert/SKILL.md +294 -294
- package/skills/dependency-upgrade-migrator/SKILL.md +295 -0
- package/skills/design-system-architect/SKILL.md +27 -10
- package/skills/doku-mcp-server/SKILL.md +251 -0
- package/skills/doku-payment-gateway/SKILL.md +227 -0
- package/skills/e2e-testing-expert/SKILL.md +315 -315
- package/skills/edge-serverless-db-expert/SKILL.md +43 -0
- package/skills/email-notification-expert/SKILL.md +362 -0
- package/skills/error-resilience-expert/SKILL.md +480 -0
- package/skills/event-driven-architect/SKILL.md +81 -81
- package/skills/feature-flag-analytics-expert/SKILL.md +46 -0
- package/skills/file-upload-media-expert/SKILL.md +431 -0
- package/skills/form-validation-expert/SKILL.md +401 -0
- package/skills/fullstack-expert/SKILL.md +202 -202
- package/skills/fullstack-expert/references/api_design_guide.md +466 -466
- package/skills/fullstack-expert/references/multi_language_backend.md +528 -528
- package/skills/fullstack-expert/scripts/api_contract_validator.py +253 -253
- package/skills/fullstack-expert/scripts/architecture_analyzer.py +326 -326
- package/skills/gemini-agent-booster/SKILL.md +135 -135
- package/skills/global-a11y-i18n-expert/SKILL.md +81 -81
- package/skills/glsl-shader-expert/SKILL.md +101 -0
- package/skills/go-programming-expert/SKILL.md +295 -295
- package/skills/graphql-apollo-expert/SKILL.md +108 -0
- package/skills/hig/SKILL.md +188 -188
- package/skills/hyper-context-synthesizer/SKILL.md +55 -0
- package/skills/js-backend-expert/SKILL.md +34 -9
- package/skills/legacy-code-translator/SKILL.md +65 -0
- package/skills/llm-cost-arbitrage-router/SKILL.md +59 -0
- package/skills/logging-error-tracking-expert/SKILL.md +338 -0
- package/skills/mcp-client-orchestrator/SKILL.md +70 -0
- package/skills/mcp-server-architect/SKILL.md +194 -194
- package/skills/micro-frontend-architect/SKILL.md +106 -0
- package/skills/mobile-expo-expert/SKILL.md +186 -186
- package/skills/mobile-push-notification-expert/SKILL.md +51 -0
- package/skills/monday-design-aesthetic/SKILL.md +67 -67
- package/skills/monorepo-architect/SKILL.md +227 -227
- package/skills/mpa-orchestrator/SKILL.md +101 -101
- package/skills/multi-agent-orchestration/SKILL.md +234 -234
- package/skills/multiple-entry-points/SKILL.md +55 -55
- package/skills/mvc-expert/SKILL.md +231 -231
- package/skills/payment-gateway-expert/SKILL.md +45 -45
- package/skills/performance-web-vitals/SKILL.md +332 -332
- package/skills/post-quantum-crypto-migrator/SKILL.md +57 -0
- package/skills/prd-architect/SKILL.md +201 -191
- package/skills/proactive-background-watcher/SKILL.md +62 -0
- package/skills/production-ready-hardener/PRODUCTION_READINESS_REPORT.md +67 -0
- package/skills/production-ready-hardener/SKILL.md +173 -186
- package/skills/production-ready-hardener/references/production_checklist.md +161 -161
- package/skills/production-ready-hardener/scripts/production_readiness_scanner.py +881 -875
- package/skills/project-context-mapper/SKILL.md +79 -0
- package/skills/python-programming-expert/SKILL.md +263 -132
- package/skills/rate-limit-abuse-prevention/SKILL.md +371 -0
- package/skills/realtime-collaboration-expert/SKILL.md +45 -45
- package/skills/rust-programming-expert/SKILL.md +235 -235
- package/skills/saas-billing/SKILL.md +377 -377
- package/skills/saas-multi-tenant/SKILL.md +251 -237
- package/skills/saas-mvp-launcher/SKILL.md +10 -0
- package/skills/saas-transformer/SKILL.md +187 -144
- package/skills/saas-transformer/references/billing_integration_guide.md +401 -401
- package/skills/saas-transformer/references/feature_gating_patterns.md +137 -137
- package/skills/saas-transformer/references/saas_transformation_checklist.md +121 -121
- package/skills/saas-transformer/scripts/saas_transformation_scanner.py +39 -29
- package/skills/scalability-clean-code/SKILL.md +229 -229
- package/skills/self-evolving-memory-graph/SKILL.md +75 -0
- package/skills/self-healing-cloud-orchestrator/SKILL.md +57 -0
- package/skills/senior-frontend/SKILL.md +161 -161
- package/skills/senior-fullstack/SKILL.md +167 -167
- package/skills/seo/SKILL.md +235 -225
- package/skills/seo-geo/SKILL.md +188 -188
- package/skills/session-context-loader/SKILL.md +77 -0
- package/skills/session-handoff-resume/SKILL.md +158 -158
- package/skills/skill_baru/SKILL.md +172 -147
- package/skills/spa-orchestrator/SKILL.md +288 -288
- package/skills/state-management-expert/SKILL.md +272 -272
- package/skills/supabase-security-expert/SKILL.md +243 -243
- package/skills/tailwind-expert/SKILL.md +188 -188
- package/skills/tanstack-query-expert/SKILL.md +199 -199
- package/skills/token-saver/SKILL.md +119 -111
- package/skills/typescript-expert/SKILL.md +324 -279
- package/skills/ui-components-expert/SKILL.md +263 -46
- package/skills/ui-ux-pro-max/SKILL.md +202 -201
- package/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-310.pyc +0 -0
- package/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-310.pyc +0 -0
- package/skills/ui_ux_expert/SKILL.md +17 -6
- package/skills/vector-db-rag-expert/SKILL.md +52 -0
- package/skills/vibe-code-gardener/SKILL.md +181 -173
- package/skills/visual-qa-vision-agent/SKILL.md +65 -0
- package/skills/vue-frontend-expert/SKILL.md +126 -0
- package/skills/web-3d-graphics-expert/SKILL.md +131 -0
- package/skills/web-game-engine-expert/SKILL.md +96 -0
- package/skills/web-scraper/SKILL.md +207 -205
- package/skills/website-design-cloner/SKILL.md +174 -0
- package/skills/webxr-ar-vr-expert/SKILL.md +117 -0
- package/skills/zero-to-prod-orchestrator/SKILL.md +206 -180
- package/skills/zero-trust-secret-vault/SKILL.md +40 -0
- package/vibes-swarm-demo.gif +0 -0
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mcp-server-architect
|
|
3
|
-
description: "Expert guide for designing, building, and security-hardening Model Context Protocol (MCP) servers and tool integrations in TypeScript, Python, and Go / Panduan ahli merancang, membangun, dan mengamankan server Model Context Protocol (MCP) dan integrasi tool dalam TypeScript, Python, dan Go."
|
|
4
|
-
author: "Roedy Rustam"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# MCP Server Architect (v1.9+ Edition)
|
|
8
|
-
|
|
9
|
-
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
<a name="english"></a>
|
|
14
|
-
## English
|
|
15
|
-
|
|
16
|
-
### Description
|
|
17
|
-
Expert guide for designing, building, and security-hardening **Model Context Protocol (MCP)** servers and client integrations. Covers MCP v1.9+ specification (including the new Streamable HTTP transport), tool/resource/prompt design, Zod validation, OAuth 2.1 authorization, and multi-server orchestration patterns for production AI applications.
|
|
18
|
-
|
|
19
|
-
### Trigger Conditions
|
|
20
|
-
- Building an MCP server to expose tools, resources, or prompt templates to AI agents.
|
|
21
|
-
- Integrating third-party APIs or databases as MCP tools for LLM consumption.
|
|
22
|
-
- Implementing MCP client logic in an AI agent or chatbot.
|
|
23
|
-
- Securing MCP servers with OAuth 2.1 and permission scoping.
|
|
24
|
-
- Deploying MCP servers to edge/serverless environments.
|
|
25
|
-
|
|
26
|
-
### MCP v1.9+ Specification Overview
|
|
27
|
-
|
|
28
|
-
MCP standardizes how AI models interact with external tools and data. The 2026 specification (v1.9) introduces:
|
|
29
|
-
|
|
30
|
-
| Feature | Description |
|
|
31
|
-
|---|---|
|
|
32
|
-
| **Streamable HTTP** | New bidirectional transport via HTTP streaming — replaces SSE for cloud deployments |
|
|
33
|
-
| **stdio** | Original transport for local/CLI tools — still recommended for local MCP |
|
|
34
|
-
| **OAuth 2.1** | Standard authorization flow for MCP servers requiring user consent |
|
|
35
|
-
| **Tool Annotations** | `readOnlyHint`, `destructiveHint`, `idempotentHint` for safer agent decisions |
|
|
36
|
-
| **Audio Content** | Support for audio data in tool responses |
|
|
37
|
-
| **Resource Links** | Resources can now link to external URIs |
|
|
38
|
-
|
|
39
|
-
### Core MCP Concepts
|
|
40
|
-
|
|
41
|
-
| Primitive | What It Is | Example |
|
|
42
|
-
|---|---|---|
|
|
43
|
-
| **Tool** | Executable function the LLM can call | `search_database`, `send_email` |
|
|
44
|
-
| **Resource** | Read-only data the LLM can read | File contents, DB records |
|
|
45
|
-
| **Prompt** | Reusable prompt templates | `code_review_prompt` |
|
|
46
|
-
| **Sampling** | Server requests LLM completion | Agent asks LLM to classify |
|
|
47
|
-
|
|
48
|
-
### Building an MCP Server (TypeScript)
|
|
49
|
-
|
|
50
|
-
#### 1. Setup with `@modelcontextprotocol/sdk`
|
|
51
|
-
```typescript
|
|
52
|
-
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
53
|
-
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
54
|
-
import { z } from 'zod';
|
|
55
|
-
|
|
56
|
-
const server = new McpServer({
|
|
57
|
-
name: 'my-api-server',
|
|
58
|
-
version: '1.0.0',
|
|
59
|
-
});
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
#### 2. Define Tools with Zod Validation
|
|
63
|
-
```typescript
|
|
64
|
-
server.tool(
|
|
65
|
-
'search_products',
|
|
66
|
-
'Search the product catalog by query and category',
|
|
67
|
-
{
|
|
68
|
-
query: z.string().min(1).describe('Search query string'),
|
|
69
|
-
category: z.enum(['electronics', 'clothing', 'books']).optional(),
|
|
70
|
-
limit: z.number().int().min(1).max(50).default(10),
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
readOnlyHint: true, // v1.9 annotation: this tool does not modify state
|
|
74
|
-
idempotentHint: true, // safe to call multiple times
|
|
75
|
-
},
|
|
76
|
-
async ({ query, category, limit }) => {
|
|
77
|
-
const results = await productDB.search({ query, category, limit });
|
|
78
|
-
return {
|
|
79
|
-
content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
#### 3. Expose Resources
|
|
86
|
-
```typescript
|
|
87
|
-
server.resource(
|
|
88
|
-
'company-docs',
|
|
89
|
-
'docs://{path}',
|
|
90
|
-
{ mimeType: 'text/markdown' },
|
|
91
|
-
async (uri) => {
|
|
92
|
-
const path = uri.pathname;
|
|
93
|
-
const content = await fs.readFile(`./docs${path}`, 'utf-8');
|
|
94
|
-
return { contents: [{ uri: uri.href, mimeType: 'text/markdown', text: content }] };
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
#### 4. Streamable HTTP Transport (v1.9 — Production Deployment)
|
|
100
|
-
```typescript
|
|
101
|
-
import express from 'express';
|
|
102
|
-
|
|
103
|
-
const app = express();
|
|
104
|
-
app.use(express.json());
|
|
105
|
-
|
|
106
|
-
app.all('/mcp', async (req, res) => {
|
|
107
|
-
const transport = new StreamableHTTPServerTransport({
|
|
108
|
-
sessionIdGenerator: () => crypto.randomUUID(),
|
|
109
|
-
});
|
|
110
|
-
await server.connect(transport);
|
|
111
|
-
await transport.handleRequest(req, res, req.body);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
app.listen(3000, () => console.log('MCP Server running on :3000'));
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
#### 5. OAuth 2.1 Authorization (Secure MCP)
|
|
118
|
-
For MCP servers requiring user consent (e.g., accessing user's GitHub repos):
|
|
119
|
-
```typescript
|
|
120
|
-
import { ProxyOAuthServerProvider } from '@modelcontextprotocol/sdk/server/auth/providers/proxyOAuth.js';
|
|
121
|
-
|
|
122
|
-
const authProvider = new ProxyOAuthServerProvider({
|
|
123
|
-
endpoints: {
|
|
124
|
-
authorizationUrl: 'https://github.com/login/oauth/authorize',
|
|
125
|
-
tokenUrl: 'https://github.com/login/oauth/access_token',
|
|
126
|
-
},
|
|
127
|
-
clientId: process.env.GITHUB_CLIENT_ID!,
|
|
128
|
-
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
129
|
-
scopes: ['repo', 'read:user'],
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
server.setAuthProvider(authProvider);
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Security Hardening
|
|
136
|
-
|
|
137
|
-
- **Validate ALL inputs**: Every tool parameter must be validated with Zod before execution. Never trust LLM-generated inputs directly.
|
|
138
|
-
- **Principle of Least Privilege**: Each tool should only request the minimum permissions needed.
|
|
139
|
-
- **Rate Limiting**: Implement per-session rate limits to prevent prompt injection loops.
|
|
140
|
-
- **Sanitize Outputs**: Never return raw database records with sensitive fields (passwords, API keys). Always filter/select only what's needed.
|
|
141
|
-
- **Audit Logging**: Log every tool call with session ID, tool name, parameters, and result status.
|
|
142
|
-
- **Tool Annotations**: Use `destructiveHint: true` for tools that modify or delete data — agents should ask for human confirmation before calling these.
|
|
143
|
-
|
|
144
|
-
### Multi-Server Orchestration
|
|
145
|
-
When building AI apps with multiple MCP servers:
|
|
146
|
-
```typescript
|
|
147
|
-
// Client connecting to multiple MCP servers
|
|
148
|
-
const client = new McpClient({ name: 'my-agent', version: '1.0.0' });
|
|
149
|
-
|
|
150
|
-
// Connect to multiple specialized servers
|
|
151
|
-
await client.connect(new StdioTransport({ command: 'node', args: ['file-server.js'] }));
|
|
152
|
-
await client.connect(new StreamableHTTPTransport({ url: 'https://api.mydb.com/mcp' }));
|
|
153
|
-
|
|
154
|
-
// List all available tools across servers
|
|
155
|
-
const { tools } = await client.listTools();
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
<a name="bahasa-indonesia"></a>
|
|
161
|
-
## Bahasa Indonesia
|
|
162
|
-
|
|
163
|
-
### Deskripsi
|
|
164
|
-
Panduan ahli untuk merancang, membangun, dan mengamankan server **Model Context Protocol (MCP)** dan integrasi klien. Mencakup spesifikasi MCP v1.9+ (termasuk transport Streamable HTTP baru), desain tool/resource/prompt, validasi Zod, otorisasi OAuth 2.1, dan pola orkestrasi multi-server untuk aplikasi AI produksi.
|
|
165
|
-
|
|
166
|
-
### Kondisi Pemicu
|
|
167
|
-
- Membangun MCP server untuk mengekspos tool, resource, atau prompt template ke agen AI.
|
|
168
|
-
- Mengintegrasikan API pihak ketiga atau database sebagai MCP tool untuk konsumsi LLM.
|
|
169
|
-
- Mengimplementasikan logika klien MCP dalam agen AI atau chatbot.
|
|
170
|
-
- Mengamankan MCP server dengan OAuth 2.1 dan pembatasan izin.
|
|
171
|
-
- Men-deploy MCP server ke lingkungan edge/serverless.
|
|
172
|
-
|
|
173
|
-
### Ringkasan Spesifikasi MCP v1.9+
|
|
174
|
-
|
|
175
|
-
MCP menstandarisasi cara model AI berinteraksi dengan tool dan data eksternal. Spesifikasi 2026 (v1.9) memperkenalkan:
|
|
176
|
-
- **Streamable HTTP**: Transport dua arah baru via HTTP streaming — menggantikan SSE untuk deployment cloud.
|
|
177
|
-
- **Tool Annotations**: `readOnlyHint`, `destructiveHint`, `idempotentHint` untuk keputusan agen yang lebih aman.
|
|
178
|
-
- **OAuth 2.1**: Alur otorisasi standar untuk MCP server yang memerlukan izin pengguna.
|
|
179
|
-
|
|
180
|
-
### Membangun MCP Server (TypeScript)
|
|
181
|
-
|
|
182
|
-
Gunakan `@modelcontextprotocol/sdk` untuk TypeScript. Definisikan tool dengan validasi Zod yang ketat, tambahkan anotasi v1.9 (`readOnlyHint`, `destructiveHint`), dan gunakan Streamable HTTP transport untuk deployment cloud produksi.
|
|
183
|
-
|
|
184
|
-
### Keamanan MCP
|
|
185
|
-
|
|
186
|
-
- **Validasi SEMUA input**: Setiap parameter tool harus divalidasi dengan Zod sebelum eksekusi.
|
|
187
|
-
- **Prinsip Least Privilege**: Setiap tool hanya boleh meminta izin minimum yang diperlukan.
|
|
188
|
-
- **Rate Limiting**: Batasi panggilan per sesi untuk mencegah loop prompt injection.
|
|
189
|
-
- **Sanitasi Output**: Jangan pernah mengembalikan field sensitif (password, API key).
|
|
190
|
-
- **Audit Logging**: Catat setiap panggilan tool dengan session ID, nama tool, parameter, dan status hasil.
|
|
191
|
-
- **Anotasi Tool**: Gunakan `destructiveHint: true` untuk tool yang memodifikasi/menghapus data — agen harus meminta konfirmasi manusia sebelum memanggilnya.
|
|
192
|
-
|
|
193
|
-
### Orkestrasi Multi-Server
|
|
194
|
-
Klien MCP dapat terhubung ke beberapa server sekaligus, menyatukan semua tool dari server yang berbeda menjadi satu daftar yang tersedia untuk agen.
|
|
1
|
+
---
|
|
2
|
+
name: mcp-server-architect
|
|
3
|
+
description: "Expert guide for designing, building, and security-hardening Model Context Protocol (MCP) servers and tool integrations in TypeScript, Python, and Go / Panduan ahli merancang, membangun, dan mengamankan server Model Context Protocol (MCP) dan integrasi tool dalam TypeScript, Python, dan Go."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# MCP Server Architect (v1.9+ Edition)
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
Expert guide for designing, building, and security-hardening **Model Context Protocol (MCP)** servers and client integrations. Covers MCP v1.9+ specification (including the new Streamable HTTP transport), tool/resource/prompt design, Zod validation, OAuth 2.1 authorization, and multi-server orchestration patterns for production AI applications.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
- Building an MCP server to expose tools, resources, or prompt templates to AI agents.
|
|
21
|
+
- Integrating third-party APIs or databases as MCP tools for LLM consumption.
|
|
22
|
+
- Implementing MCP client logic in an AI agent or chatbot.
|
|
23
|
+
- Securing MCP servers with OAuth 2.1 and permission scoping.
|
|
24
|
+
- Deploying MCP servers to edge/serverless environments.
|
|
25
|
+
|
|
26
|
+
### MCP v1.9+ Specification Overview
|
|
27
|
+
|
|
28
|
+
MCP standardizes how AI models interact with external tools and data. The 2026 specification (v1.9) introduces:
|
|
29
|
+
|
|
30
|
+
| Feature | Description |
|
|
31
|
+
|---|---|
|
|
32
|
+
| **Streamable HTTP** | New bidirectional transport via HTTP streaming — replaces SSE for cloud deployments |
|
|
33
|
+
| **stdio** | Original transport for local/CLI tools — still recommended for local MCP |
|
|
34
|
+
| **OAuth 2.1** | Standard authorization flow for MCP servers requiring user consent |
|
|
35
|
+
| **Tool Annotations** | `readOnlyHint`, `destructiveHint`, `idempotentHint` for safer agent decisions |
|
|
36
|
+
| **Audio Content** | Support for audio data in tool responses |
|
|
37
|
+
| **Resource Links** | Resources can now link to external URIs |
|
|
38
|
+
|
|
39
|
+
### Core MCP Concepts
|
|
40
|
+
|
|
41
|
+
| Primitive | What It Is | Example |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| **Tool** | Executable function the LLM can call | `search_database`, `send_email` |
|
|
44
|
+
| **Resource** | Read-only data the LLM can read | File contents, DB records |
|
|
45
|
+
| **Prompt** | Reusable prompt templates | `code_review_prompt` |
|
|
46
|
+
| **Sampling** | Server requests LLM completion | Agent asks LLM to classify |
|
|
47
|
+
|
|
48
|
+
### Building an MCP Server (TypeScript)
|
|
49
|
+
|
|
50
|
+
#### 1. Setup with `@modelcontextprotocol/sdk`
|
|
51
|
+
```typescript
|
|
52
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
53
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
54
|
+
import { z } from 'zod';
|
|
55
|
+
|
|
56
|
+
const server = new McpServer({
|
|
57
|
+
name: 'my-api-server',
|
|
58
|
+
version: '1.0.0',
|
|
59
|
+
});
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### 2. Define Tools with Zod Validation
|
|
63
|
+
```typescript
|
|
64
|
+
server.tool(
|
|
65
|
+
'search_products',
|
|
66
|
+
'Search the product catalog by query and category',
|
|
67
|
+
{
|
|
68
|
+
query: z.string().min(1).describe('Search query string'),
|
|
69
|
+
category: z.enum(['electronics', 'clothing', 'books']).optional(),
|
|
70
|
+
limit: z.number().int().min(1).max(50).default(10),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
readOnlyHint: true, // v1.9 annotation: this tool does not modify state
|
|
74
|
+
idempotentHint: true, // safe to call multiple times
|
|
75
|
+
},
|
|
76
|
+
async ({ query, category, limit }) => {
|
|
77
|
+
const results = await productDB.search({ query, category, limit });
|
|
78
|
+
return {
|
|
79
|
+
content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### 3. Expose Resources
|
|
86
|
+
```typescript
|
|
87
|
+
server.resource(
|
|
88
|
+
'company-docs',
|
|
89
|
+
'docs://{path}',
|
|
90
|
+
{ mimeType: 'text/markdown' },
|
|
91
|
+
async (uri) => {
|
|
92
|
+
const path = uri.pathname;
|
|
93
|
+
const content = await fs.readFile(`./docs${path}`, 'utf-8');
|
|
94
|
+
return { contents: [{ uri: uri.href, mimeType: 'text/markdown', text: content }] };
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
#### 4. Streamable HTTP Transport (v1.9 — Production Deployment)
|
|
100
|
+
```typescript
|
|
101
|
+
import express from 'express';
|
|
102
|
+
|
|
103
|
+
const app = express();
|
|
104
|
+
app.use(express.json());
|
|
105
|
+
|
|
106
|
+
app.all('/mcp', async (req, res) => {
|
|
107
|
+
const transport = new StreamableHTTPServerTransport({
|
|
108
|
+
sessionIdGenerator: () => crypto.randomUUID(),
|
|
109
|
+
});
|
|
110
|
+
await server.connect(transport);
|
|
111
|
+
await transport.handleRequest(req, res, req.body);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
app.listen(3000, () => console.log('MCP Server running on :3000'));
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### 5. OAuth 2.1 Authorization (Secure MCP)
|
|
118
|
+
For MCP servers requiring user consent (e.g., accessing user's GitHub repos):
|
|
119
|
+
```typescript
|
|
120
|
+
import { ProxyOAuthServerProvider } from '@modelcontextprotocol/sdk/server/auth/providers/proxyOAuth.js';
|
|
121
|
+
|
|
122
|
+
const authProvider = new ProxyOAuthServerProvider({
|
|
123
|
+
endpoints: {
|
|
124
|
+
authorizationUrl: 'https://github.com/login/oauth/authorize',
|
|
125
|
+
tokenUrl: 'https://github.com/login/oauth/access_token',
|
|
126
|
+
},
|
|
127
|
+
clientId: process.env.GITHUB_CLIENT_ID!,
|
|
128
|
+
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
|
129
|
+
scopes: ['repo', 'read:user'],
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
server.setAuthProvider(authProvider);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Security Hardening
|
|
136
|
+
|
|
137
|
+
- **Validate ALL inputs**: Every tool parameter must be validated with Zod before execution. Never trust LLM-generated inputs directly.
|
|
138
|
+
- **Principle of Least Privilege**: Each tool should only request the minimum permissions needed.
|
|
139
|
+
- **Rate Limiting**: Implement per-session rate limits to prevent prompt injection loops.
|
|
140
|
+
- **Sanitize Outputs**: Never return raw database records with sensitive fields (passwords, API keys). Always filter/select only what's needed.
|
|
141
|
+
- **Audit Logging**: Log every tool call with session ID, tool name, parameters, and result status.
|
|
142
|
+
- **Tool Annotations**: Use `destructiveHint: true` for tools that modify or delete data — agents should ask for human confirmation before calling these.
|
|
143
|
+
|
|
144
|
+
### Multi-Server Orchestration
|
|
145
|
+
When building AI apps with multiple MCP servers:
|
|
146
|
+
```typescript
|
|
147
|
+
// Client connecting to multiple MCP servers
|
|
148
|
+
const client = new McpClient({ name: 'my-agent', version: '1.0.0' });
|
|
149
|
+
|
|
150
|
+
// Connect to multiple specialized servers
|
|
151
|
+
await client.connect(new StdioTransport({ command: 'node', args: ['file-server.js'] }));
|
|
152
|
+
await client.connect(new StreamableHTTPTransport({ url: 'https://api.mydb.com/mcp' }));
|
|
153
|
+
|
|
154
|
+
// List all available tools across servers
|
|
155
|
+
const { tools } = await client.listTools();
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
<a name="bahasa-indonesia"></a>
|
|
161
|
+
## Bahasa Indonesia
|
|
162
|
+
|
|
163
|
+
### Deskripsi
|
|
164
|
+
Panduan ahli untuk merancang, membangun, dan mengamankan server **Model Context Protocol (MCP)** dan integrasi klien. Mencakup spesifikasi MCP v1.9+ (termasuk transport Streamable HTTP baru), desain tool/resource/prompt, validasi Zod, otorisasi OAuth 2.1, dan pola orkestrasi multi-server untuk aplikasi AI produksi.
|
|
165
|
+
|
|
166
|
+
### Kondisi Pemicu
|
|
167
|
+
- Membangun MCP server untuk mengekspos tool, resource, atau prompt template ke agen AI.
|
|
168
|
+
- Mengintegrasikan API pihak ketiga atau database sebagai MCP tool untuk konsumsi LLM.
|
|
169
|
+
- Mengimplementasikan logika klien MCP dalam agen AI atau chatbot.
|
|
170
|
+
- Mengamankan MCP server dengan OAuth 2.1 dan pembatasan izin.
|
|
171
|
+
- Men-deploy MCP server ke lingkungan edge/serverless.
|
|
172
|
+
|
|
173
|
+
### Ringkasan Spesifikasi MCP v1.9+
|
|
174
|
+
|
|
175
|
+
MCP menstandarisasi cara model AI berinteraksi dengan tool dan data eksternal. Spesifikasi 2026 (v1.9) memperkenalkan:
|
|
176
|
+
- **Streamable HTTP**: Transport dua arah baru via HTTP streaming — menggantikan SSE untuk deployment cloud.
|
|
177
|
+
- **Tool Annotations**: `readOnlyHint`, `destructiveHint`, `idempotentHint` untuk keputusan agen yang lebih aman.
|
|
178
|
+
- **OAuth 2.1**: Alur otorisasi standar untuk MCP server yang memerlukan izin pengguna.
|
|
179
|
+
|
|
180
|
+
### Membangun MCP Server (TypeScript)
|
|
181
|
+
|
|
182
|
+
Gunakan `@modelcontextprotocol/sdk` untuk TypeScript. Definisikan tool dengan validasi Zod yang ketat, tambahkan anotasi v1.9 (`readOnlyHint`, `destructiveHint`), dan gunakan Streamable HTTP transport untuk deployment cloud produksi.
|
|
183
|
+
|
|
184
|
+
### Keamanan MCP
|
|
185
|
+
|
|
186
|
+
- **Validasi SEMUA input**: Setiap parameter tool harus divalidasi dengan Zod sebelum eksekusi.
|
|
187
|
+
- **Prinsip Least Privilege**: Setiap tool hanya boleh meminta izin minimum yang diperlukan.
|
|
188
|
+
- **Rate Limiting**: Batasi panggilan per sesi untuk mencegah loop prompt injection.
|
|
189
|
+
- **Sanitasi Output**: Jangan pernah mengembalikan field sensitif (password, API key).
|
|
190
|
+
- **Audit Logging**: Catat setiap panggilan tool dengan session ID, nama tool, parameter, dan status hasil.
|
|
191
|
+
- **Anotasi Tool**: Gunakan `destructiveHint: true` untuk tool yang memodifikasi/menghapus data — agen harus meminta konfirmasi manusia sebelum memanggilnya.
|
|
192
|
+
|
|
193
|
+
### Orkestrasi Multi-Server
|
|
194
|
+
Klien MCP dapat terhubung ke beberapa server sekaligus, menyatukan semua tool dari server yang berbeda menjadi satu daftar yang tersedia untuk agen.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: micro-frontend-architect
|
|
3
|
+
description: "Expert guide for designing Micro-Frontend architectures using Webpack Module Federation, Vite Federation, and Single-SPA for large scale Vue and React applications."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Micro-Frontend Architect
|
|
8
|
+
|
|
9
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<a name="english"></a>
|
|
14
|
+
## English
|
|
15
|
+
|
|
16
|
+
### Description
|
|
17
|
+
Production-grade guidance for breaking down monolithic frontend applications into scalable, independently deployable **Micro-Frontends (MFE)**. Covers integration via **Webpack Module Federation**, **Vite Federation**, and run-time container orchestration using patterns suitable for massive Enterprise applications in Vue or React.
|
|
18
|
+
|
|
19
|
+
### Trigger Conditions
|
|
20
|
+
Activate this skill when the user is:
|
|
21
|
+
- Splitting a large frontend codebase into multiple smaller apps (Host and Remotes).
|
|
22
|
+
- Configuring Webpack Module Federation (`ModuleFederationPlugin`).
|
|
23
|
+
- Setting up Vite with `@originjs/vite-plugin-federation`.
|
|
24
|
+
- Asking about sharing dependencies (e.g., sharing a single instance of Vue, React, or Pinia across apps).
|
|
25
|
+
- Designing a cross-team frontend deployment strategy.
|
|
26
|
+
|
|
27
|
+
### Core Concepts
|
|
28
|
+
|
|
29
|
+
#### 1. Module Federation Concept
|
|
30
|
+
Module federation allows a JavaScript application to dynamically load code from another application at runtime.
|
|
31
|
+
- **Host (Shell):** The main container application that loads remote modules.
|
|
32
|
+
- **Remote:** The micro-frontend application exposing components or logic.
|
|
33
|
+
|
|
34
|
+
#### 2. Vite Federation Example
|
|
35
|
+
```javascript
|
|
36
|
+
// vite.config.js (Remote App)
|
|
37
|
+
import federation from '@originjs/vite-plugin-federation'
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
plugins: [
|
|
41
|
+
federation({
|
|
42
|
+
name: 'remote_app',
|
|
43
|
+
filename: 'remoteEntry.js',
|
|
44
|
+
exposes: {
|
|
45
|
+
'./Button': './src/components/Button.vue',
|
|
46
|
+
},
|
|
47
|
+
shared: ['vue', 'pinia'] // Critical: Share core dependencies!
|
|
48
|
+
})
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// vite.config.js (Host App)
|
|
53
|
+
import federation from '@originjs/vite-plugin-federation'
|
|
54
|
+
|
|
55
|
+
export default {
|
|
56
|
+
plugins: [
|
|
57
|
+
federation({
|
|
58
|
+
name: 'host_app',
|
|
59
|
+
remotes: {
|
|
60
|
+
remote_app: 'http://localhost:5001/assets/remoteEntry.js',
|
|
61
|
+
},
|
|
62
|
+
shared: ['vue', 'pinia']
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### 3. State Management Across MFEs
|
|
69
|
+
- **Avoid Global State if Possible:** Micro-frontends should ideally not share business state. Communicate via custom DOM events, URL parameters, or a thin Event Bus.
|
|
70
|
+
- **Shared Store (Pinia/Zustand):** If state sharing is absolutely required, the Host app should instantiate the store and share the dependency instance via Federation.
|
|
71
|
+
|
|
72
|
+
### Best Practices
|
|
73
|
+
- **Strict Dependency Sharing:** Always mark core libraries (`react`, `react-dom`, `vue`, `vue-router`) as `singleton: true` and `shared` to prevent the browser from downloading and running multiple instances of the framework.
|
|
74
|
+
- **CSS Isolation:** Ensure CSS from one Micro-Frontend does not bleed into another. Use CSS Modules, scoped CSS, or Shadow DOM.
|
|
75
|
+
- **Independent Deployments:** The core value of MFE is that Team A can deploy the Remote App without requiring Team B to rebuild the Host App.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### Integration with Other Skills (MANDATORY)
|
|
80
|
+
This skill works best when combined with:
|
|
81
|
+
- `vue-frontend-expert` / `senior-frontend` — For building the individual micro-apps.
|
|
82
|
+
- `design-system-architect` — For ensuring all MFEs consume a shared, versioned UI component library.
|
|
83
|
+
- `monorepo-architect` — For managing the codebases of multiple MFEs in a single Turborepo/pnpm workspace.
|
|
84
|
+
|
|
85
|
+
### Referenced By Orchestrators (MANDATORY)
|
|
86
|
+
- `brainstorming` — Add to "Architecture & Scale".
|
|
87
|
+
- `zero-to-prod-orchestrator` — Phase 2 (Architecture Strategy).
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
<a name="bahasa-indonesia"></a>
|
|
92
|
+
## Bahasa Indonesia
|
|
93
|
+
|
|
94
|
+
### Deskripsi
|
|
95
|
+
Panduan arsitektur untuk memecah aplikasi frontend raksasa menjadi **Micro-Frontends (MFE)** yang terukur dan dapat di-deploy secara independen. Mencakup **Webpack Module Federation** dan **Vite Federation**.
|
|
96
|
+
|
|
97
|
+
### Kondisi Pemicu
|
|
98
|
+
- Memecah aplikasi (monolith) Vue atau React menjadi beberapa sub-aplikasi.
|
|
99
|
+
- Mengkonfigurasi plugin *Module Federation*.
|
|
100
|
+
- Mencari cara untuk membagi *dependency* (seperti Vue atau React) agar tidak di-download dua kali oleh browser.
|
|
101
|
+
|
|
102
|
+
### Panduan Singkat
|
|
103
|
+
- **Host vs Remote:** *Host* adalah cangkang (shell) utama aplikasi Anda, *Remote* adalah aplikasi kecil (fitur) yang dimuat oleh Host secara dinamis di runtime.
|
|
104
|
+
- **Berbagi Dependensi (Shared):** Sangat krusial! Pastikan framework utama (`vue`, `react`, `pinia`, `vue-router`) ditandai sebagai `shared` (dan seringkali `singleton`). Jika tidak, aplikasi akan error karena ada 2 instance Vue/React yang berjalan bersamaan.
|
|
105
|
+
- **Isolasi CSS:** Pastikan gaya CSS dari MFE A tidak merusak MFE B. Gunakan *CSS Modules* atau kapsulasi *Scoped CSS*.
|
|
106
|
+
- **Komunikasi Data:** Hindari penggunaan Global State (Redux/Pinia) lintas MFE jika memungkinkan. Gunakan *Custom Event Listener* di `window` atau passing props/URL untuk menjaga tiap MFE tetap independen.
|