@ratio-mcp/dev-server 1.4.5 → 1.5.1

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.
Files changed (47) hide show
  1. package/README.md +118 -0
  2. package/dist/schemas/orders.json +4 -4
  3. package/dist/schemas/products.json +5 -5
  4. package/dist/server.d.ts.map +1 -1
  5. package/dist/server.js +5 -1
  6. package/dist/server.js.map +1 -1
  7. package/dist/services/session-state.d.ts +0 -2
  8. package/dist/services/session-state.d.ts.map +1 -1
  9. package/dist/services/session-state.js +6 -7
  10. package/dist/services/session-state.js.map +1 -1
  11. package/dist/templates/backend/.env.example +1 -1
  12. package/dist/tools/codegen.d.ts.map +1 -1
  13. package/dist/tools/codegen.js +48 -24
  14. package/dist/tools/codegen.js.map +1 -1
  15. package/dist/tools/hookdeck.d.ts.map +1 -1
  16. package/dist/tools/hookdeck.js +161 -90
  17. package/dist/tools/hookdeck.js.map +1 -1
  18. package/dist/tools/submission.js +1 -1
  19. package/dist/tools/submission.js.map +1 -1
  20. package/dist/tools/webhooks.d.ts.map +1 -1
  21. package/dist/tools/webhooks.js +19 -3
  22. package/dist/tools/webhooks.js.map +1 -1
  23. package/package.json +6 -3
  24. package/dist/orchestrated-index.d.ts +0 -11
  25. package/dist/orchestrated-index.d.ts.map +0 -1
  26. package/dist/orchestrated-index.js +0 -33
  27. package/dist/orchestrated-index.js.map +0 -1
  28. package/dist/orchestrated-server.d.ts +0 -21
  29. package/dist/orchestrated-server.d.ts.map +0 -1
  30. package/dist/orchestrated-server.js +0 -101
  31. package/dist/orchestrated-server.js.map +0 -1
  32. package/dist/services/orchestrator.d.ts +0 -63
  33. package/dist/services/orchestrator.d.ts.map +0 -1
  34. package/dist/services/orchestrator.js +0 -845
  35. package/dist/services/orchestrator.js.map +0 -1
  36. package/dist/services/response-formatter.d.ts +0 -24
  37. package/dist/services/response-formatter.d.ts.map +0 -1
  38. package/dist/services/response-formatter.js +0 -311
  39. package/dist/services/response-formatter.js.map +0 -1
  40. package/dist/store/hookdeck-config.d.ts +0 -7
  41. package/dist/store/hookdeck-config.d.ts.map +0 -1
  42. package/dist/store/hookdeck-config.js +0 -60
  43. package/dist/store/hookdeck-config.js.map +0 -1
  44. package/dist/tools/agent-chat.d.ts +0 -9
  45. package/dist/tools/agent-chat.d.ts.map +0 -1
  46. package/dist/tools/agent-chat.js +0 -465
  47. package/dist/tools/agent-chat.js.map +0 -1
@@ -1,101 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { DEV_SERVER_NAME, DEV_SERVER_VERSION } from '@ratio-mcp/shared';
3
- import { allDevTools } from './tools/index.js';
4
- import { logger } from './utils/logger.js';
5
- import { checkToolPrerequisites } from './services/tool-guard.js';
6
- import { recordToolSuccess } from './services/session-state.js';
7
- /**
8
- * Create the Tool-First Ratio Dev MCP Server.
9
- *
10
- * Exposes all tools individually (not a single agent_chat).
11
- * Each tool call passes through the prerequisite guard.
12
- * The LLM decides what to call based on user intent and get_status output.
13
- *
14
- * Guard enforcement:
15
- * - If prerequisites are met → tool executes normally
16
- * - If prerequisites are NOT met → returns structured error with:
17
- * - What's missing
18
- * - The full chain of tools needed to unblock
19
- * - A hint for the LLM to self-correct
20
- *
21
- * Session recording:
22
- * - On success, tool results are parsed to extract context (appId, scopes, etc.)
23
- * - This context drives future guard checks
24
- */
25
- export function createOrchestratedServer() {
26
- const server = new McpServer({
27
- name: `${DEV_SERVER_NAME}-orchestrated`,
28
- version: DEV_SERVER_VERSION,
29
- });
30
- // Register all tools with guard middleware
31
- for (const tool of allDevTools) {
32
- const shape = tool.inputSchema.shape;
33
- server.tool(tool.name, tool.description, shape, async (args) => {
34
- logger.toolCall(tool.name, args);
35
- const startTime = Date.now();
36
- // ── Guard: check prerequisites before executing ──────────────
37
- const guard = checkToolPrerequisites(tool.name);
38
- if (!guard.allowed) {
39
- const duration = Date.now() - startTime;
40
- logger.info(`BLOCKED ${tool.name} (${duration}ms): ${guard.message}`);
41
- return {
42
- content: [
43
- {
44
- type: 'text',
45
- text: JSON.stringify({
46
- error: true,
47
- blocked: true,
48
- tool: tool.name,
49
- message: guard.message,
50
- required_tools: guard.requiredTools,
51
- chain: guard.chain,
52
- hint: guard.hint || `Call ${guard.requiredTools?.join(' → ')} first, then retry ${tool.name}.`,
53
- doc_hint: 'If you are unsure about any platform detail, call lookup_docs or get_status before proceeding.',
54
- }, null, 2),
55
- },
56
- ],
57
- isError: true,
58
- };
59
- }
60
- // ── Execute tool ────────────────────────────────────────────
61
- try {
62
- const result = await tool.handler(args);
63
- const duration = Date.now() - startTime;
64
- logger.toolResult(tool.name, duration, result);
65
- // Record success in session state
66
- recordToolSuccess(tool.name, result);
67
- return {
68
- content: [
69
- {
70
- type: 'text',
71
- text: JSON.stringify(result, null, 2),
72
- },
73
- ],
74
- };
75
- }
76
- catch (error) {
77
- const duration = Date.now() - startTime;
78
- logger.toolError(tool.name, duration, error);
79
- const message = error instanceof Error ? error.message : String(error);
80
- return {
81
- content: [
82
- {
83
- type: 'text',
84
- text: JSON.stringify({
85
- error: true,
86
- message,
87
- tool: tool.name,
88
- doc_hint: 'If this error is about an API detail, call lookup_docs to verify the correct usage.',
89
- }, null, 2),
90
- },
91
- ],
92
- isError: true,
93
- };
94
- }
95
- });
96
- logger.debug(`Registered tool: ${tool.name}`);
97
- }
98
- logger.info(`${DEV_SERVER_NAME}-orchestrated initialized with ${allDevTools.length} tools (tool-first architecture)`);
99
- return server;
100
- }
101
- //# sourceMappingURL=orchestrated-server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orchestrated-server.js","sourceRoot":"","sources":["../src/orchestrated-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAA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rB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gCACnB,KAAK,EAAE,IAAI;gCACX,OAAO;gCACP,IAAI,EAAE,IAAI,CAAC,IAAI;gCACf,QAAQ,EAAE,qFAAqF;6BAChG,EAAE,IAAI,EAAE,CAAC,CAAC;yBACZ;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;QACH,CAAC,CACF,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,eAAe,kCAAkC,WAAW,CAAC,MAAM,kCAAkC,CAAC,CAAC;IACtH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Phase definitions in the Ratio app development lifecycle.
3
- * Each phase represents a logical group of activities that must be completed in order.
4
- */
5
- export type Phase = 'auth' | 'app_setup' | 'requirements' | 'webhooks' | 'frontend_build' | 'review_wait' | 'publish_oauth' | 'backend_codegen' | 'complete';
6
- /**
7
- * Result returned by the orchestrator showing exactly what to do next.
8
- * The caller uses this to invoke the correct tool with the right arguments.
9
- */
10
- export interface OrchestratorResult {
11
- phase: Phase;
12
- step: string;
13
- toolToCall: string;
14
- toolArgs: Record<string, unknown>;
15
- needsInput: boolean;
16
- inputPrompt?: string;
17
- inputFields?: string[];
18
- message: string;
19
- phase_description: string;
20
- progress: {
21
- current: number;
22
- total: number;
23
- percentage: number;
24
- };
25
- }
26
- /**
27
- * Main orchestrator function: determines the exact next step based on session state.
28
- *
29
- * @param userInput - Optional user input (credentials, selections, configuration details)
30
- * @returns OrchestratorResult describing what to do next
31
- */
32
- export declare function getNextStep(userInput?: Record<string, unknown>): OrchestratorResult;
33
- /**
34
- * Get the current phase without computing the next step details.
35
- * Useful for status checks and phase-only queries.
36
- */
37
- export declare function getCurrentPhase(): Phase;
38
- /**
39
- * Get a human-friendly description of a phase.
40
- */
41
- export declare function getPhaseDescription(phase: Phase): string;
42
- /**
43
- * Check if a phase can be skipped by the user.
44
- * Currently only webhooks is optional.
45
- */
46
- export declare function canSkipPhase(phase: Phase): boolean;
47
- /**
48
- * Get the total number of steps across all phases.
49
- */
50
- export declare function getTotalSteps(): number;
51
- /**
52
- * Get metadata about a specific phase (description, step count, skippable).
53
- */
54
- export declare function getPhaseMetadata(phase: Phase): {
55
- description: string;
56
- skippable: boolean;
57
- stepCount: number;
58
- };
59
- /**
60
- * Helper: Get all phases in order.
61
- */
62
- export declare function getAllPhases(): Phase[];
63
- //# sourceMappingURL=orchestrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/services/orchestrator.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,MAAM,MAAM,KAAK,GACb,MAAM,GACN,WAAW,GACX,cAAc,GACd,UAAU,GACV,gBAAgB,GAChB,aAAa,GACb,eAAe,GACf,iBAAiB,GACjB,UAAU,CAAC;AAEf;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAEjC,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IAGb,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAGlC,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAGvB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAoyBD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,kBAAkB,CA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