vibes-plug 2.14.1 → 3.9.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/rules/vibes-plug-core.md +5 -0
- package/.cursor/rules/vibes-plug-core.mdc +7 -2
- package/.cursorrules +8 -2
- package/AGENTS.md +23 -2
- package/CHANGELOG.md +114 -0
- package/CLAUDE.md +10 -3
- package/README.md +216 -611
- package/bin/vibes.mjs +1104 -0
- package/package.json +11 -3
- package/plugin.json +4 -3
- package/scripts/check-anti-slop.mjs +53 -0
- package/scripts/install.js +3 -1
- package/scripts/update_skills.js +1 -1
- package/scripts/update_skills.mjs +86 -0
- package/scripts/validate-skills.mjs +111 -0
- package/skills/accessibility-testing-expert/SKILL.md +117 -116
- package/skills/affective-computing-emotion-ai/SKILL.md +83 -0
- package/skills/agentic-coding-workflow-expert/SKILL.md +297 -0
- package/skills/agentic-memory-architect/SKILL.md +52 -0
- package/skills/agentic-micro-economy-architect/SKILL.md +92 -0
- package/skills/ai-llm-integration-expert/SKILL.md +330 -194
- package/skills/ai-media-generation-expert/SKILL.md +173 -172
- package/skills/ai-prompt-engineering-expert/SKILL.md +204 -134
- package/skills/ai-safety-governance-expert/SKILL.md +223 -0
- package/skills/angular-expert/SKILL.md +149 -148
- package/skills/anti-slop/SKILL.md +134 -133
- package/skills/api-design-expert/SKILL.md +4 -3
- package/skills/api-gateway-proxy-expert/SKILL.md +3 -2
- package/skills/app-analyzer-optimizer/SKILL.md +4 -3
- package/skills/apple-ecosystem-expert/SKILL.md +6 -5
- package/skills/astro-framework-expert/SKILL.md +201 -200
- package/skills/async-queue-temporal-expert/SKILL.md +218 -217
- package/skills/authentication-identity-expert/SKILL.md +174 -173
- package/skills/autonomous-red-teamer/SKILL.md +338 -203
- package/skills/autonomous-tdd-debugger/SKILL.md +6 -5
- package/skills/biome-linter-formatter-expert/SKILL.md +90 -89
- package/skills/blockchain-web3-expert/SKILL.md +116 -115
- package/skills/brainstorming/SKILL.md +392 -377
- package/skills/browser-automation-expert/SKILL.md +260 -222
- package/skills/bun-runtime-expert/SKILL.md +5 -4
- package/skills/chatbot-messaging-expert/SKILL.md +115 -114
- package/skills/ci-cd-devops-architect/SKILL.md +3 -2
- package/skills/cloud-hosting-expert/SKILL.md +5 -4
- package/skills/coderabbit/SKILL.md +5 -4
- package/skills/compliance-gdpr-privacy-expert/SKILL.md +3 -2
- package/skills/composable-mach-architect/SKILL.md +338 -0
- package/skills/cron-scheduler-expert/SKILL.md +5 -4
- package/skills/data-pipeline-etl-expert/SKILL.md +3 -2
- package/skills/data-telemetry-expert/SKILL.md +5 -4
- package/skills/data-visualization-expert/SKILL.md +155 -154
- package/skills/database-orm-expert/SKILL.md +166 -165
- package/skills/deep-research-analyst/SKILL.md +182 -136
- package/skills/dependency-upgrade-migrator/SKILL.md +11 -10
- package/skills/design-system-architect/SKILL.md +4 -3
- package/skills/desktop-electron-expert/SKILL.md +129 -128
- package/skills/documentation-site-expert/SKILL.md +60 -59
- package/skills/doku-mcp-server/SKILL.md +5 -4
- package/skills/doku-payment-gateway/SKILL.md +250 -232
- package/skills/domain-driven-design-expert/SKILL.md +3 -2
- package/skills/e2e-testing-expert/SKILL.md +5 -4
- package/skills/ecommerce-expert/SKILL.md +88 -87
- package/skills/email-notification-expert/SKILL.md +5 -4
- package/skills/ephemeral-generative-ui-architect/SKILL.md +88 -0
- package/skills/error-resilience-expert/SKILL.md +14 -13
- package/skills/event-driven-architect/SKILL.md +5 -4
- package/skills/feature-flag-analytics-expert/SKILL.md +3 -2
- package/skills/file-upload-media-expert/SKILL.md +5 -4
- package/skills/firebase-security-expert/SKILL.md +5 -4
- package/skills/form-validation-expert/SKILL.md +7 -6
- package/skills/frontier-ai-models-expert/SKILL.md +116 -0
- package/skills/fullstack-expert/SKILL.md +185 -184
- package/skills/gemini-agent-booster/SKILL.md +248 -172
- package/skills/geospatial-maps-expert/SKILL.md +81 -80
- package/skills/global-a11y-i18n-expert/SKILL.md +5 -4
- package/skills/glsl-shader-expert/SKILL.md +191 -190
- package/skills/go-programming-expert/SKILL.md +5 -4
- package/skills/graph-rag-knowledge-expert/SKILL.md +201 -200
- package/skills/graphql-apollo-expert/SKILL.md +5 -4
- package/skills/headless-cms-expert/SKILL.md +182 -181
- package/skills/hig/SKILL.md +5 -4
- package/skills/js-backend-expert/SKILL.md +219 -218
- package/skills/legacy-code-translator/SKILL.md +6 -5
- package/skills/llm-finops-router/SKILL.md +52 -0
- package/skills/local-slm-edge-ai-expert/SKILL.md +168 -167
- package/skills/logging-error-tracking-expert/SKILL.md +5 -4
- package/skills/mcp-server-architect/SKILL.md +315 -307
- package/skills/micro-frontend-architect/SKILL.md +5 -4
- package/skills/mobile-expo-expert/SKILL.md +5 -4
- package/skills/modern-css-native-expert/SKILL.md +190 -189
- package/skills/monorepo-architect/SKILL.md +5 -4
- package/skills/mpa-orchestrator/SKILL.md +41 -4
- package/skills/multi-agent-orchestration/SKILL.md +388 -254
- package/skills/mvc-expert/SKILL.md +5 -4
- package/skills/n8n-automation-expert/SKILL.md +90 -89
- package/skills/nextjs-app-router-expert/SKILL.md +3 -2
- package/skills/openapi-swagger-codegen-expert/SKILL.md +4 -3
- package/skills/payment-gateway-expert/SKILL.md +131 -128
- package/skills/pdf-document-generation-expert/SKILL.md +92 -91
- package/skills/performance-web-vitals/SKILL.md +5 -4
- package/skills/post-quantum-crypto-migrator/SKILL.md +3 -2
- package/skills/prd-architect/SKILL.md +183 -182
- package/skills/proactive-background-watcher/SKILL.md +5 -4
- package/skills/production-ready-hardener/SKILL.md +10 -9
- package/skills/pwa-offline-first-expert/SKILL.md +227 -226
- package/skills/pydantic-ai-expert/SKILL.md +162 -161
- package/skills/python-programming-expert/SKILL.md +5 -4
- package/skills/rate-limit-abuse-prevention/SKILL.md +5 -4
- package/skills/realtime-collaboration-expert/SKILL.md +3 -2
- package/skills/rich-text-editor-expert/SKILL.md +178 -177
- package/skills/rust-programming-expert/SKILL.md +5 -4
- package/skills/saas-architect/SKILL.md +155 -154
- package/skills/saas-billing/SKILL.md +394 -382
- package/skills/saas-multi-tenant/SKILL.md +7 -6
- package/skills/scalability-clean-code/SKILL.md +5 -4
- package/skills/search-engine-expert/SKILL.md +90 -89
- package/skills/self-healing-cloud-orchestrator/SKILL.md +3 -2
- package/skills/senior-frontend/SKILL.md +14 -9
- package/skills/seo/SKILL.md +4 -4
- package/skills/session-memory-manager/SKILL.md +129 -128
- package/skills/solidjs-expert/SKILL.md +81 -80
- package/skills/spa-orchestrator/SKILL.md +5 -4
- package/skills/sse-websocket-streaming-expert/SKILL.md +3 -2
- package/skills/state-management-expert/SKILL.md +5 -4
- package/skills/supabase-security-expert/SKILL.md +5 -4
- package/skills/svelte-sveltekit-expert/SKILL.md +92 -91
- package/skills/svg-animation-motion-expert/SKILL.md +3 -2
- package/skills/synthetic-data-finetuning-expert/SKILL.md +156 -155
- package/skills/tailwind-expert/SKILL.md +62 -5
- package/skills/tanstack-query-expert/SKILL.md +5 -4
- package/skills/tauri-expert/SKILL.md +5 -4
- package/skills/typescript-expert/SKILL.md +5 -4
- package/skills/ui-ux-pro-max/SKILL.md +7 -6
- package/skills/vector-db-rag-expert/SKILL.md +209 -208
- package/skills/vercel-ai-sdk-expert/SKILL.md +226 -181
- package/skills/voice-ai-realtime-agent/SKILL.md +243 -242
- package/skills/vue-frontend-expert/SKILL.md +5 -4
- package/skills/wasm-edge-computing-expert/SKILL.md +3 -2
- package/skills/web-3d-graphics-expert/SKILL.md +314 -313
- package/skills/web-game-engine-expert/SKILL.md +330 -329
- package/skills/web-scraper/SKILL.md +158 -157
- package/skills/website-design-cloner/SKILL.md +5 -4
- package/skills/webxr-ar-vr-expert/SKILL.md +163 -162
- package/skills/wordpress-headless-expert/SKILL.md +145 -144
- package/skills/zero-tech-debt-auditor/SKILL.md +115 -0
- package/skills/zero-to-prod-orchestrator/SKILL.md +281 -229
- package/skills/zero-trust-secret-vault/SKILL.md +3 -2
- package/BLUEPRINT.md +0 -319
- package/skills/bootstrap-to-modern/SKILL.md +0 -94
- package/skills/multiple-entry-points/SKILL.md +0 -91
- package/skills/secure-fuzz-testing/SKILL.md +0 -207
- package/skills/visual-qa-vision-agent/SKILL.md +0 -71
|
@@ -1,308 +1,316 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mcp-server-architect
|
|
3
|
-
description: "Ultimate guide for designing, building, and security-hardening modern AI Tools/Bots via Model Context Protocol (MCP v1.x) in TypeScript and Python / Panduan utama merancang, membangun, dan mengamankan AI Tools/Bots modern melalui Model Context Protocol (MCP) dalam TypeScript dan Python."
|
|
4
|
-
author: "Roedy Rustam"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
import {
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
'
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
from
|
|
115
|
-
from
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
'
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
)
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
app.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
return
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
1
|
+
---
|
|
2
|
+
name: mcp-server-architect
|
|
3
|
+
description: "Ultimate guide for designing, building, and security-hardening modern AI Tools/Bots via Model Context Protocol (MCP v1.x) in TypeScript and Python / Panduan utama merancang, membangun, dan mengamankan AI Tools/Bots modern melalui Model Context Protocol (MCP) dalam TypeScript dan Python."
|
|
4
|
+
author: "Roedy Rustam"
|
|
5
|
+
version: "3.0.0"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# MCP Server Architect (Modern AI Tools & Agentic Protocol)
|
|
9
|
+
|
|
10
|
+
[English](#english) | [Bahasa Indonesia](#bahasa-indonesia)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<a name="english"></a>
|
|
15
|
+
## English
|
|
16
|
+
|
|
17
|
+
### Orchestration & Integration
|
|
18
|
+
Connects and orchestrates with relevant domain skills: `ai-llm-integration-expert` for core LLM routing and RAG pipelines, `mcp-client-orchestrator` for agent client consumption, and `doku-mcp-server` for payments integration examples. Ensure cohesive execution when spawning subagents.
|
|
19
|
+
|
|
20
|
+
### Description
|
|
21
|
+
Ultimate architectural guide for engineering high-performance, production-ready AI Tools/Bots via the **Model Context Protocol (MCP v1.x)**. Enforces the use of `FastMCP` (Python) and `@modelcontextprotocol/sdk` (TypeScript). Mandates strict security guardrails, schema validation, stateful resource streaming, and support for both Standard Stdio and Streamable HTTP / Server-Sent Events (SSE) transports.
|
|
22
|
+
|
|
23
|
+
### Trigger Conditions
|
|
24
|
+
- Building an MCP server to expose tools, resources, or prompt templates to AI agents.
|
|
25
|
+
- Integrating backend APIs, file systems, or databases as MCP agent tools.
|
|
26
|
+
- Implementing stateful, real-time MCP servers (resource subscriptions, log tailing, live metrics).
|
|
27
|
+
- Securing and auditing MCP servers exposing sensitive financial or production data.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### SDK Selection (Mandatory Standard)
|
|
32
|
+
1. **Python**: `FastMCP` (FastAPI-like high-level DX for MCP tools, resources, and prompt templates).
|
|
33
|
+
2. **TypeScript**: `@modelcontextprotocol/sdk` (official SDK using the `McpServer` high-level abstraction with `zod`).
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### Production Implementation Recipes
|
|
38
|
+
|
|
39
|
+
#### Recipe 1: Production TypeScript MCP Server (Streamable HTTP / SSE)
|
|
40
|
+
```typescript
|
|
41
|
+
import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
42
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
43
|
+
import express from 'express';
|
|
44
|
+
import { z } from 'zod';
|
|
45
|
+
|
|
46
|
+
// Initialize the high-level MCP Server
|
|
47
|
+
const server = new McpServer({
|
|
48
|
+
name: 'enterprise-analytics-mcp',
|
|
49
|
+
version: '1.0.0',
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Register a type-safe Tool with Zod validation
|
|
53
|
+
server.tool(
|
|
54
|
+
'calculate_metrics',
|
|
55
|
+
'Calculates business analytics metrics across timeframes',
|
|
56
|
+
{
|
|
57
|
+
metricName: z.enum(['arr', 'churn', 'cac', 'ltv']).describe('The metric to compute'),
|
|
58
|
+
quarter: z.string().regex(/^Q[1-4]-202[0-9]$/).describe('Target quarter, e.g., Q1-2026'),
|
|
59
|
+
},
|
|
60
|
+
async ({ metricName, quarter }) => {
|
|
61
|
+
// Implement business logic with database access
|
|
62
|
+
const mockData = { arr: '$2.4M', churn: '1.2%', cac: '$450', ltv: '$9,200' };
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: 'text',
|
|
67
|
+
text: JSON.stringify({ metric: metricName, quarter, value: mockData[metricName] }),
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// Register a Resource Template with dynamic URI
|
|
75
|
+
server.resource(
|
|
76
|
+
'system_health',
|
|
77
|
+
new ResourceTemplate('system://health/{service}', { list: undefined }),
|
|
78
|
+
async (uri, { service }) => {
|
|
79
|
+
return {
|
|
80
|
+
contents: [
|
|
81
|
+
{
|
|
82
|
+
uri: uri.href,
|
|
83
|
+
text: JSON.stringify({ service, status: 'HEALTHY', latencyMs: 14, timestamp: new Date().toISOString() }),
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Expose via Express with SSE Transport
|
|
91
|
+
const app = express();
|
|
92
|
+
let transport: SSEServerTransport | null = null;
|
|
93
|
+
|
|
94
|
+
app.get('/sse', async (req, res) => {
|
|
95
|
+
transport = new SSEServerTransport('/messages', res);
|
|
96
|
+
await server.connect(transport);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
app.post('/messages', async (req, res) => {
|
|
100
|
+
if (transport) {
|
|
101
|
+
await transport.handlePostMessage(req, res);
|
|
102
|
+
} else {
|
|
103
|
+
res.status(400).send('Transport not established');
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
app.listen(3001, () => {
|
|
108
|
+
console.log('MCP Server listening on http://localhost:3001/sse');
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Recipe 2: Production FastMCP Server (Python)
|
|
113
|
+
```python
|
|
114
|
+
from fastmcp import FastMCP, Context
|
|
115
|
+
from pydantic import BaseModel, Field
|
|
116
|
+
from typing import Literal
|
|
117
|
+
|
|
118
|
+
mcp = FastMCP("enterprise-vault-mcp", dependencies=["pydantic"])
|
|
119
|
+
|
|
120
|
+
class QueryParams(BaseModel):
|
|
121
|
+
account_id: str = Field(..., description="UUID of customer account")
|
|
122
|
+
status_filter: Literal["active", "suspended", "all"] = Field("active", description="Status filter")
|
|
123
|
+
|
|
124
|
+
@mcp.tool(name="fetch_account_summary", description="Retrieves account telemetry and balance")
|
|
125
|
+
async def fetch_account_summary(params: QueryParams, ctx: Context) -> str:
|
|
126
|
+
ctx.info(f"Auditing request for account: {params.account_id}")
|
|
127
|
+
|
|
128
|
+
# Secure business logic with RLS validation
|
|
129
|
+
result = {
|
|
130
|
+
"account_id": params.account_id,
|
|
131
|
+
"balance_usd": 125430.50,
|
|
132
|
+
"tier": "enterprise",
|
|
133
|
+
"status": params.status_filter
|
|
134
|
+
}
|
|
135
|
+
return str(result)
|
|
136
|
+
|
|
137
|
+
@mcp.resource("config://app-settings")
|
|
138
|
+
def get_app_settings() -> str:
|
|
139
|
+
"""Provides application configuration context to the agent."""
|
|
140
|
+
return '{"environment": "production", "rate_limit_rpm": 600, "region": "ap-southeast-1"}'
|
|
141
|
+
|
|
142
|
+
if __name__ == "__main__":
|
|
143
|
+
# Runs standard Stdio transport or streamable HTTP
|
|
144
|
+
mcp.run(transport="stdio")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
### Security & Operational Guardrails
|
|
150
|
+
1. **OAuth 2.1 & Bearer Authentication**: Bind session tokens to transport connections. Validate claims before executing any tool logic.
|
|
151
|
+
2. **Schema Strictness**: Never use untyped payloads. Every argument must have explicit types, range constraints, and descriptions to guide LLM tool-calling accuracy.
|
|
152
|
+
3. **Row-Level Security (RLS)**: Enforce tenant and user context propagation to the database layer.
|
|
153
|
+
4. **Circuit Breakers & Rate Limits**: Cap consecutive tool executions per agent turn to prevent endless agentic recursive loops.
|
|
154
|
+
5. **Idempotency**: All destructive or state-mutating tools must require an `idempotency_key` argument.
|
|
155
|
+
|
|
156
|
+
### Agent MCP Client Consumption & Tool Discovery
|
|
157
|
+
When acting as an AI Agent consuming external MCP servers:
|
|
158
|
+
1. **Dynamic Tool Discovery**: Check `list_resources` or `mcp_config.json` before assuming external capabilities do not exist.
|
|
159
|
+
2. **Defensive Schema Querying**: Never guess database schema or table names. Always execute `list_tables` or `get_schema` before generating SQL queries (`execute_sql`).
|
|
160
|
+
3. **Cross-System Workflow Loop**: Dynamically chain tools across domains: GitHub MCP (find issue) -> `grep_search` (locate file) -> `autonomous-tdd-debugger` (test & fix) -> GitHub MCP (create PR).
|
|
161
|
+
4. **Rate Limit Awareness**: Avoid rapid unthrottled loops against external MCP servers.
|
|
162
|
+
|
|
163
|
+
### High-Throughput / Batched MCP Tool Execution (Gemini 4 Pro Readiness)
|
|
164
|
+
- Ensure your MCP endpoints can handle **Massive Parallel Tool Execution** as models shift towards Agentic MoE architectures.
|
|
165
|
+
- Implement parallel sub-processing in tools that expect to be called concurrently (e.g., using Promise.all or syncio.gather for batch database queries instead of blocking sequentially).
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
<a name="bahasa-indonesia"></a>
|
|
170
|
+
## Bahasa Indonesia
|
|
171
|
+
|
|
172
|
+
### Integrasi Orkestrasi
|
|
173
|
+
Terhubung dan mengorkestrasi dengan skill domain relevan: `ai-llm-integration-expert` untuk perutean LLM inti dan pipeline RAG, `mcp-client-orchestrator` untuk konsumsi klien agen, serta `doku-mcp-server` untuk contoh integrasi pembayaran.
|
|
174
|
+
|
|
175
|
+
### Deskripsi
|
|
176
|
+
Panduan arsitektur utama untuk membangun AI Tools/Bots modern dan siap produksi via **Model Context Protocol (MCP v1.x)**. Mewajibkan penggunaan `FastMCP` (Python) dan `@modelcontextprotocol/sdk` (TypeScript). Menerapkan pengamanan ketat, validasi skema, streaming resource stateful, serta dukungan transport Standar Stdio maupun Streamable HTTP / SSE.
|
|
177
|
+
|
|
178
|
+
### Kondisi Pemicu
|
|
179
|
+
- Membangun server MCP untuk mengekspos alat (*tools*), resource, atau template prompt ke agen AI.
|
|
180
|
+
- Mengintegrasikan API backend, sistem file, atau database sebagai alat agen AI.
|
|
181
|
+
- Mengimplementasikan server MCP stateful dan real-time (langganan resource, tailing log, metrik langsung).
|
|
182
|
+
- Mengamankan server MCP yang mengekspos data finansial atau produksi yang sensitif.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
### Standar Pemilihan SDK (Wajib)
|
|
187
|
+
1. **Python**: `FastMCP` (pengalaman developer tingkat tinggi ala FastAPI untuk tools, resource, dan template prompt).
|
|
188
|
+
2. **TypeScript**: `@modelcontextprotocol/sdk` (SDK resmi menggunakan abstraksi `McpServer` dengan `zod`).
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
### Resep Implementasi Produksi
|
|
193
|
+
|
|
194
|
+
#### Resep 1: Server MCP TypeScript Produksi (Streamable HTTP / SSE)
|
|
195
|
+
```typescript
|
|
196
|
+
import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
197
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
198
|
+
import express from 'express';
|
|
199
|
+
import { z } from 'zod';
|
|
200
|
+
|
|
201
|
+
const server = new McpServer({
|
|
202
|
+
name: 'enterprise-analytics-mcp',
|
|
203
|
+
version: '1.0.0',
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// Pendaftaran Tool dengan validasi ketat Zod
|
|
207
|
+
server.tool(
|
|
208
|
+
'calculate_metrics',
|
|
209
|
+
'Menghitung metrik analitik bisnis untuk kuartal tertentu',
|
|
210
|
+
{
|
|
211
|
+
metricName: z.enum(['arr', 'churn', 'cac', 'ltv']).describe('Metrik yang ingin dihitung'),
|
|
212
|
+
quarter: z.string().regex(/^Q[1-4]-202[0-9]$/).describe('Target kuartal, misal: Q1-2026'),
|
|
213
|
+
},
|
|
214
|
+
async ({ metricName, quarter }) => {
|
|
215
|
+
const data = { arr: '$2.4M', churn: '1.2%', cac: '$450', ltv: '$9,200' };
|
|
216
|
+
return {
|
|
217
|
+
content: [
|
|
218
|
+
{
|
|
219
|
+
type: 'text',
|
|
220
|
+
text: JSON.stringify({ metrik: metricName, kuartal: quarter, nilai: data[metricName] }),
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
// Pendaftaran Template Resource dengan URI Dinamis
|
|
228
|
+
server.resource(
|
|
229
|
+
'system_health',
|
|
230
|
+
new ResourceTemplate('system://health/{service}', { list: undefined }),
|
|
231
|
+
async (uri, { service }) => {
|
|
232
|
+
return {
|
|
233
|
+
contents: [
|
|
234
|
+
{
|
|
235
|
+
uri: uri.href,
|
|
236
|
+
text: JSON.stringify({ layanan: service, status: 'HEALTHY', latensiMs: 14, waktu: new Date().toISOString() }),
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
const app = express();
|
|
244
|
+
let transport: SSEServerTransport | null = null;
|
|
245
|
+
|
|
246
|
+
app.get('/sse', async (req, res) => {
|
|
247
|
+
transport = new SSEServerTransport('/messages', res);
|
|
248
|
+
await server.connect(transport);
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
app.post('/messages', async (req, res) => {
|
|
252
|
+
if (transport) {
|
|
253
|
+
await transport.handlePostMessage(req, res);
|
|
254
|
+
} else {
|
|
255
|
+
res.status(400).send('Transport belum terhubung');
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
app.listen(3001, () => {
|
|
260
|
+
console.log('Server MCP berjalan pada http://localhost:3001/sse');
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Resep 2: Server FastMCP Produksi (Python)
|
|
265
|
+
```python
|
|
266
|
+
from fastmcp import FastMCP, Context
|
|
267
|
+
from pydantic import BaseModel, Field
|
|
268
|
+
from typing import Literal
|
|
269
|
+
|
|
270
|
+
mcp = FastMCP("enterprise-vault-mcp", dependencies=["pydantic"])
|
|
271
|
+
|
|
272
|
+
class ParameterAkun(BaseModel):
|
|
273
|
+
account_id: str = Field(..., description="UUID akun pengguna")
|
|
274
|
+
status_filter: Literal["active", "suspended", "all"] = Field("active", description="Filter status")
|
|
275
|
+
|
|
276
|
+
@mcp.tool(name="ambil_ringkasan_akun", description="Mengambil telemetri dan saldo akun")
|
|
277
|
+
async def ambil_ringkasan_akun(params: ParameterAkun, ctx: Context) -> str:
|
|
278
|
+
ctx.info(f"Memproses permintaan untuk akun: {params.account_id}")
|
|
279
|
+
hasil = {
|
|
280
|
+
"account_id": params.account_id,
|
|
281
|
+
"saldo_usd": 125430.50,
|
|
282
|
+
"tier": "enterprise",
|
|
283
|
+
"status": params.status_filter
|
|
284
|
+
}
|
|
285
|
+
return str(hasil)
|
|
286
|
+
|
|
287
|
+
@mcp.resource("config://app-settings")
|
|
288
|
+
def ambil_pengaturan_aplikasi() -> str:
|
|
289
|
+
"""Menyediakan konteks konfigurasi aplikasi ke agen AI."""
|
|
290
|
+
return '{"environment": "production", "rate_limit_rpm": 600, "region": "ap-southeast-1"}'
|
|
291
|
+
|
|
292
|
+
if __name__ == "__main__":
|
|
293
|
+
mcp.run(transport="stdio")
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
### Keamanan & Batasan Operasional
|
|
299
|
+
1. **Otentikasi OAuth 2.1 & Bearer**: Ikat token sesi ke koneksi transport. Validasi hak akses sebelum mengeksekusi logika alat.
|
|
300
|
+
2. **Validasi Skema Ketat**: Hindari penggunaan parameter tanpa tipe data yang jelas. Setiap argumen wajib memiliki tipe data, batas nilai, dan deskripsi.
|
|
301
|
+
3. **Row-Level Security (RLS)**: Teruskan identitas pengguna dan penyewa (tenant) ke lapisan database driver.
|
|
302
|
+
4. **Circuit Breakers & Rate Limits**: Batasi pemanggilan tool berulang dalam satu giliran respon untuk mencegah perulangan tak terkontrol (*infinite loops*).
|
|
303
|
+
5. **Idempotency**: Semua tool yang memodifikasi data wajib mendukung argumen `idempotency_key`.
|
|
304
|
+
|
|
305
|
+
### Konsumsi Klien MCP & Eksplorasi Tool oleh Agen
|
|
306
|
+
Ketika agen bertindak sebagai Klien MCP:
|
|
307
|
+
1. **Eksplorasi Tool Dinamis**: Periksa `list_resources` atau konfigurasi MCP sebelum menyimpulkan kapabilitas tidak tersedia.
|
|
308
|
+
2. **Kueri Skema Defensif**: Jangan pernah menebak nama tabel/skema. Selalu gunakan `list_tables` atau `get_schema` sebelum membuat kueri SQL.
|
|
309
|
+
3. **Alur Kerja Lintas Sistem**: Rangkaikan pemanggilan tool antar-domain: GitHub MCP -> pencarian kode lokal -> perbaikan otonom -> Pull Request GitHub.
|
|
310
|
+
4. **Kesadaran Batas Frekuensi**: Hindari loop pemanggilan berulang tanpa jeda waktu saat memanggil server MCP eksternal.
|
|
311
|
+
|
|
312
|
+
## Integrasi Orkestrasi
|
|
308
313
|
- Terintegrasi dengan: `ai-llm-integration-expert`, `doku-mcp-server`, `zero-trust-secret-vault`.
|
|
314
|
+
### Eksekusi Tool MCP Batch / Throughput Tinggi (Kesiapan Gemini 4 Pro)
|
|
315
|
+
- Pastikan endpoint MCP Anda mampu menangani **Eksekusi Tool Paralel Masif** seiring transisi model menuju arsitektur Agentic MoE.
|
|
316
|
+
- Terapkan pemrosesan sub-tugas paralel pada tools yang mungkin dipanggil secara bersamaan (misal: gunakan Promise.all atau syncio.gather untuk query batch, alih-alih mengeblok secara berurutan).
|