sopo-mcp 1.0.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.
Files changed (78) hide show
  1. package/.dockerignore +10 -0
  2. package/.env +7 -0
  3. package/.ghaymah.json +20 -0
  4. package/Dockerfile +37 -0
  5. package/GUIDE.md +311 -0
  6. package/README.md +143 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +94 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/prompts/sopo.prompts.d.ts +8 -0
  12. package/dist/prompts/sopo.prompts.d.ts.map +1 -0
  13. package/dist/prompts/sopo.prompts.js +102 -0
  14. package/dist/prompts/sopo.prompts.js.map +1 -0
  15. package/dist/resources/platform.resources.d.ts +9 -0
  16. package/dist/resources/platform.resources.d.ts.map +1 -0
  17. package/dist/resources/platform.resources.js +143 -0
  18. package/dist/resources/platform.resources.js.map +1 -0
  19. package/dist/sopo-client.d.ts +51 -0
  20. package/dist/sopo-client.d.ts.map +1 -0
  21. package/dist/sopo-client.js +145 -0
  22. package/dist/sopo-client.js.map +1 -0
  23. package/dist/tools/aggregate-request.tools.d.ts +8 -0
  24. package/dist/tools/aggregate-request.tools.d.ts.map +1 -0
  25. package/dist/tools/aggregate-request.tools.js +57 -0
  26. package/dist/tools/aggregate-request.tools.js.map +1 -0
  27. package/dist/tools/auth.tools.d.ts +12 -0
  28. package/dist/tools/auth.tools.d.ts.map +1 -0
  29. package/dist/tools/auth.tools.js +152 -0
  30. package/dist/tools/auth.tools.js.map +1 -0
  31. package/dist/tools/collection.tools.d.ts +8 -0
  32. package/dist/tools/collection.tools.d.ts.map +1 -0
  33. package/dist/tools/collection.tools.js +54 -0
  34. package/dist/tools/collection.tools.js.map +1 -0
  35. package/dist/tools/gateway-plugin.tools.d.ts +8 -0
  36. package/dist/tools/gateway-plugin.tools.d.ts.map +1 -0
  37. package/dist/tools/gateway-plugin.tools.js +64 -0
  38. package/dist/tools/gateway-plugin.tools.js.map +1 -0
  39. package/dist/tools/gateway-route.tools.d.ts +8 -0
  40. package/dist/tools/gateway-route.tools.d.ts.map +1 -0
  41. package/dist/tools/gateway-route.tools.js +68 -0
  42. package/dist/tools/gateway-route.tools.js.map +1 -0
  43. package/dist/tools/gateway.tools.d.ts +8 -0
  44. package/dist/tools/gateway.tools.d.ts.map +1 -0
  45. package/dist/tools/gateway.tools.js +56 -0
  46. package/dist/tools/gateway.tools.js.map +1 -0
  47. package/dist/tools/observability.tools.d.ts +9 -0
  48. package/dist/tools/observability.tools.d.ts.map +1 -0
  49. package/dist/tools/observability.tools.js +54 -0
  50. package/dist/tools/observability.tools.js.map +1 -0
  51. package/dist/tools/service-target.tools.d.ts +8 -0
  52. package/dist/tools/service-target.tools.d.ts.map +1 -0
  53. package/dist/tools/service-target.tools.js +52 -0
  54. package/dist/tools/service-target.tools.js.map +1 -0
  55. package/dist/tools/service.tools.d.ts +8 -0
  56. package/dist/tools/service.tools.d.ts.map +1 -0
  57. package/dist/tools/service.tools.js +67 -0
  58. package/dist/tools/service.tools.js.map +1 -0
  59. package/dist/tools/user-profile.tools.d.ts +8 -0
  60. package/dist/tools/user-profile.tools.d.ts.map +1 -0
  61. package/dist/tools/user-profile.tools.js +46 -0
  62. package/dist/tools/user-profile.tools.js.map +1 -0
  63. package/package.json +33 -0
  64. package/src/index.ts +115 -0
  65. package/src/prompts/sopo.prompts.ts +128 -0
  66. package/src/resources/platform.resources.ts +163 -0
  67. package/src/sopo-client.ts +180 -0
  68. package/src/tools/aggregate-request.tools.ts +83 -0
  69. package/src/tools/auth.tools.ts +187 -0
  70. package/src/tools/collection.tools.ts +80 -0
  71. package/src/tools/gateway-plugin.tools.ts +90 -0
  72. package/src/tools/gateway-route.tools.ts +94 -0
  73. package/src/tools/gateway.tools.ts +82 -0
  74. package/src/tools/observability.tools.ts +87 -0
  75. package/src/tools/service-target.tools.ts +78 -0
  76. package/src/tools/service.tools.ts +93 -0
  77. package/src/tools/user-profile.tools.ts +72 -0
  78. package/tsconfig.json +19 -0
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Sopo MCP Server — Prompts
3
+ *
4
+ * Predefined prompt templates that guide the AI for common Sopo operations.
5
+ */
6
+ import { z } from 'zod';
7
+ export function registerPrompts(server) {
8
+ // ── Setup New Gateway (Guided Workflow) ───────────────────────
9
+ server.prompt('setup_new_gateway', 'Guided workflow to set up a complete API gateway from scratch — creates gateway, service, service target, and route.', {
10
+ gateway_name: z.string().describe('Name for the new gateway'),
11
+ upstream_url: z.string().describe('URL of the upstream backend to route to'),
12
+ route_path: z.string().describe('The incoming request path to handle'),
13
+ }, async (args) => ({
14
+ messages: [{
15
+ role: 'user',
16
+ content: {
17
+ type: 'text',
18
+ text: `I want to set up a new API gateway in Sopo. Please execute these steps in order:
19
+
20
+ 1. **Create a gateway** named "${args.gateway_name}" in "single" mode (active).
21
+ 2. **Create a service** named "${args.gateway_name}-service" under the new gateway with protocol "http" and lb_policy "round_robin".
22
+ 3. **Create a service target** with URL "${args.upstream_url}" pointing to the new service.
23
+ 4. **Create a route** with path "${args.route_path}" on the new gateway pointing to the new service.
24
+
25
+ After each step, confirm the ID of the created resource. If any step fails, stop and report the error.`,
26
+ },
27
+ }],
28
+ }));
29
+ // ── Diagnose Gateway ──────────────────────────────────────────
30
+ server.prompt('diagnose_gateway', 'Diagnose the health and configuration of a specific gateway by reviewing its resources, routes, plugins, and recent metrics.', {
31
+ gateway_name: z.string().describe('Name of the gateway to diagnose'),
32
+ }, async (args) => ({
33
+ messages: [{
34
+ role: 'user',
35
+ content: {
36
+ type: 'text',
37
+ text: `Please diagnose the gateway "${args.gateway_name}" in Sopo. Do the following:
38
+
39
+ 1. **List all gateways** and find the one named "${args.gateway_name}".
40
+ 2. **List all services** and filter those belonging to this gateway.
41
+ 3. **List all service targets** and check if the services have healthy upstream URLs.
42
+ 4. **List all routes** belonging to this gateway.
43
+ 5. **List all plugins** attached to this gateway or its routes.
44
+ 6. **Get resource stats** for an overview.
45
+ 7. **Fetch recent request logs** and look for errors or high latency.
46
+ 8. **Get hourly metrics** to check traffic trends.
47
+
48
+ Provide a summary with:
49
+ - ✅ Things that look good
50
+ - ⚠️ Potential issues or misconfigurations
51
+ - 🔧 Recommended actions`,
52
+ },
53
+ }],
54
+ }));
55
+ // ── Full Platform Report ──────────────────────────────────────
56
+ server.prompt('platform_report', 'Generate a comprehensive report of the entire Sopo platform — all resources, configuration, and metrics.', {}, async () => ({
57
+ messages: [{
58
+ role: 'user',
59
+ content: {
60
+ type: 'text',
61
+ text: `Generate a complete Sopo platform report. Please:
62
+
63
+ 1. **Check system health** (call check_health).
64
+ 2. **Get resource stats** for overall counts.
65
+ 3. **List all gateways** with their details.
66
+ 4. **List all services** with health check configs.
67
+ 5. **List all service targets** with their URLs and weights.
68
+ 6. **List all routes** with their path mappings.
69
+ 7. **List all plugins** with their configs.
70
+ 8. **List all collections** if any exist.
71
+ 9. **Get user profile** to show the current user's slug.
72
+ 10. **Fetch hourly metrics** to show recent traffic.
73
+
74
+ Format everything as a structured, readable report with sections for each resource type.`,
75
+ },
76
+ }],
77
+ }));
78
+ // ── Add Plugin to Gateway ─────────────────────────────────────
79
+ server.prompt('add_plugin_to_gateway', 'Attach a middleware plugin (like API key auth, rate limiting, or CORS) to a gateway.', {
80
+ gateway_name: z.string().describe('Name of the gateway'),
81
+ plugin_type: z.string().describe('Plugin type (e.g. "apikey", "rate_limit", "cors")'),
82
+ }, async (args) => ({
83
+ messages: [{
84
+ role: 'user',
85
+ content: {
86
+ type: 'text',
87
+ text: `I want to add a "${args.plugin_type}" plugin to the gateway "${args.gateway_name}". Please:
88
+
89
+ 1. **List all gateways** and find the one named "${args.gateway_name}" to get its ID.
90
+ 2. **Create a gateway plugin** with:
91
+ - name: "${args.plugin_type}"
92
+ - phase: "access" (or the appropriate phase for this plugin type)
93
+ - gateway_id: (the ID found above)
94
+ - enabled: true
95
+ - A sensible default plugin_config for "${args.plugin_type}"
96
+
97
+ Explain what the plugin does and what its configuration means.`,
98
+ },
99
+ }],
100
+ }));
101
+ }
102
+ //# sourceMappingURL=sopo.prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sopo.prompts.js","sourceRoot":"","sources":["../../src/prompts/sopo.prompts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,UAAU,eAAe,CAAC,MAAiB;IAE/C,iEAAiE;IACjE,MAAM,CAAC,MAAM,CACX,mBAAmB,EACnB,sHAAsH,EACtH;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QAC7D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;QAC5E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;KACvE,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACf,QAAQ,EAAE,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;iCAEiB,IAAI,CAAC,YAAY;iCACjB,IAAI,CAAC,YAAY;2CACP,IAAI,CAAC,YAAY;mCACzB,IAAI,CAAC,UAAU;;uGAEqD;iBAC9F;aACF,CAAC;KACH,CAAC,CACH,CAAC;IAEF,iEAAiE;IACjE,MAAM,CAAC,MAAM,CACX,kBAAkB,EAClB,8HAA8H,EAC9H;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;KACrE,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACf,QAAQ,EAAE,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,gCAAgC,IAAI,CAAC,YAAY;;mDAEd,IAAI,CAAC,YAAY;;;;;;;;;;;;yBAY3C;iBAChB;aACF,CAAC;KACH,CAAC,CACH,CAAC;IAEF,iEAAiE;IACjE,MAAM,CAAC,MAAM,CACX,iBAAiB,EACjB,0GAA0G,EAC1G,EAAE,EACF,KAAK,IAAI,EAAE,CAAC,CAAC;QACX,QAAQ,EAAE,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;;;;;;;;;;;;yFAayE;iBAChF;aACF,CAAC;KACH,CAAC,CACH,CAAC;IAEF,iEAAiE;IACjE,MAAM,CAAC,MAAM,CACX,uBAAuB,EACvB,sFAAsF,EACtF;QACE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QACxD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;KACtF,EACD,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACf,QAAQ,EAAE,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,oBAAoB,IAAI,CAAC,WAAW,4BAA4B,IAAI,CAAC,YAAY;;mDAE9C,IAAI,CAAC,YAAY;;cAEtD,IAAI,CAAC,WAAW;;;;6CAIe,IAAI,CAAC,WAAW;;+DAEE;iBACtD;aACF,CAAC;KACH,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Sopo MCP Server — Resources
3
+ *
4
+ * MCP Resources provide read-only context to AI models about the Sopo platform.
5
+ * These are data sources the AI can read at any time to understand the system.
6
+ */
7
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
8
+ export declare function registerResources(server: McpServer): void;
9
+ //# sourceMappingURL=platform.resources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.resources.d.ts","sourceRoot":"","sources":["../../src/resources/platform.resources.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwJzD"}
@@ -0,0 +1,143 @@
1
+ /**
2
+ * Sopo MCP Server — Resources
3
+ *
4
+ * MCP Resources provide read-only context to AI models about the Sopo platform.
5
+ * These are data sources the AI can read at any time to understand the system.
6
+ */
7
+ import { sopoGet } from '../sopo-client.js';
8
+ export function registerResources(server) {
9
+ // ── Platform Overview Resource ────────────────────────────────
10
+ server.resource('sopo-platform-overview', 'sopo://platform/overview', {
11
+ description: 'Overview of the Sopo API Gateway platform, its architecture, domain model, and available API endpoints.',
12
+ mimeType: 'text/markdown',
13
+ }, async () => ({
14
+ contents: [{
15
+ uri: 'sopo://platform/overview',
16
+ mimeType: 'text/markdown',
17
+ text: `# Sopo API Gateway Platform
18
+
19
+ ## What is Sopo?
20
+ Sopo is a full-featured **API Gateway management platform**. It allows users to create and manage API gateways that route, load-balance, and apply middleware to incoming HTTP requests.
21
+
22
+ ## Architecture
23
+ - **Backend** (Node.js/TypeScript + Express): The BFF (Backend-for-Frontend) layer that exposes REST APIs and proxies GraphQL to Hasura.
24
+ - **Hasura**: GraphQL engine connected to PostgreSQL (metadata) and ClickHouse (logs/metrics).
25
+ - **Go Gateway Server**: The actual reverse proxy that processes live traffic based on the configuration defined via the Backend.
26
+ - **Frontend** (Next.js): Dashboard UI for managing gateways.
27
+
28
+ ## Domain Model (Hierarchy)
29
+ \`\`\`
30
+ User
31
+ └── Gateway (API Gateway instance)
32
+ ├── Service (upstream backend)
33
+ │ └── ServiceTarget (URL + weight for load balancing)
34
+ ├── GatewayRoute (path → service mapping)
35
+ │ └── AggregateRequest (parallel sub-requests)
36
+ ├── GatewayPlugin (middleware: auth, rate-limit, cors, etc.)
37
+ └── Collection (organizational group, Pro mode only)
38
+ \`\`\`
39
+
40
+ ## Key Concepts
41
+ - **Gateway**: A logical API gateway that users create. Has modes: "single" (simple) and "pro" (collections).
42
+ - **Service**: Represents an upstream backend with health checking and load balancing configuration.
43
+ - **ServiceTarget**: An actual URL endpoint for a service. Multiple targets enable load balancing.
44
+ - **GatewayRoute**: Maps an incoming path/method to a downstream service.
45
+ - **AggregateRequest**: Defines sub-requests for parallel fan-out on a single route.
46
+ - **GatewayPlugin**: Middleware (e.g., apikey, rate_limit, cors) attached to a gateway or route. Mutually exclusive: gateway_id OR route_id.
47
+ - **Collection**: Organizational grouping of routes/services (Pro mode only).
48
+ - **UserProfile**: Contains the user's slug (URL namespace).
49
+
50
+ ## Available API Endpoints
51
+ All protected routes require a valid JWT Bearer token.
52
+
53
+ ### System
54
+ - \`GET /health\` — Health check
55
+
56
+ ### Gateway CRUD (/api/v1/gateways)
57
+ - POST / — Create gateway
58
+ - GET / — List gateways
59
+ - PATCH /:id — Update gateway
60
+ - DELETE /:id — Delete gateway
61
+
62
+ ### Service CRUD (/api/v1/services)
63
+ - POST / — Create service (requires gateway_id)
64
+ - GET / — List services
65
+ - PATCH /:id — Update service
66
+ - DELETE /:id — Delete service
67
+
68
+ ### Service Targets CRUD (/api/v1/service-targets)
69
+ - POST / — Create target (requires service_id)
70
+ - GET / — List targets
71
+ - PATCH /:id — Update target
72
+ - DELETE /:id — Delete target
73
+
74
+ ### Gateway Routes CRUD (/api/v1/gateway-routes)
75
+ - POST / — Create route (requires gateway_id + service_id)
76
+ - GET / — List routes
77
+ - PATCH /:id — Update route
78
+ - DELETE /:id — Delete route
79
+
80
+ ### Aggregate Requests CRUD (/api/v1/aggregate-requests)
81
+ - POST / — Create aggregate request (requires route_id + service_id)
82
+ - GET / — List aggregate requests
83
+ - PATCH /:id — Update aggregate request
84
+ - DELETE /:id — Delete aggregate request
85
+
86
+ ### Gateway Plugins CRUD (/api/v1/gateway-plugins)
87
+ - POST / — Create plugin (requires gateway_id XOR route_id)
88
+ - GET / — List plugins
89
+ - PATCH /:id — Update plugin
90
+ - DELETE /:id — Delete plugin
91
+
92
+ ### Collections CRUD (/api/v1/collections)
93
+ - POST / — Create collection (requires gateway_id)
94
+ - GET / — List collections
95
+ - PATCH /:id — Update collection
96
+ - DELETE /:id — Delete collection
97
+
98
+ ### User Profiles (/api/v1/user-profiles)
99
+ - POST / — Create profile (set slug)
100
+ - GET / — Get profile
101
+ - PATCH / — Update slug
102
+ - DELETE / — Delete profile
103
+
104
+ ### Logs & Metrics (/api/v1/logs)
105
+ - GET /requests — Recent request logs
106
+ - GET /hourly-metrics — Hourly aggregated metrics
107
+ - GET /hourly-metrics-mv — Hourly metrics (materialized view)
108
+
109
+ ### Stats (/api/v1/stats)
110
+ - GET /resources — Resource counts (gateways, services, routes, plugins)
111
+ `,
112
+ }],
113
+ }));
114
+ // ── Dynamic Resource: Current Gateway Config ──────────────────
115
+ server.resource('sopo-gateway-config', 'sopo://gateways/current-config', {
116
+ description: 'Live snapshot of all gateways and their configuration owned by the authenticated user.',
117
+ mimeType: 'application/json',
118
+ }, async () => {
119
+ const result = await sopoGet('/api/v1/gateways');
120
+ return {
121
+ contents: [{
122
+ uri: 'sopo://gateways/current-config',
123
+ mimeType: 'application/json',
124
+ text: JSON.stringify(result.success ? result.data : { error: result.error }, null, 2),
125
+ }],
126
+ };
127
+ });
128
+ // ── Dynamic Resource: Current Stats ───────────────────────────
129
+ server.resource('sopo-resource-stats', 'sopo://stats/resources', {
130
+ description: 'Live resource counts for the authenticated user (gateways, services, routes, plugins).',
131
+ mimeType: 'application/json',
132
+ }, async () => {
133
+ const result = await sopoGet('/api/v1/stats/resources');
134
+ return {
135
+ contents: [{
136
+ uri: 'sopo://stats/resources',
137
+ mimeType: 'application/json',
138
+ text: JSON.stringify(result.success ? result.data : { error: result.error }, null, 2),
139
+ }],
140
+ };
141
+ });
142
+ }
143
+ //# sourceMappingURL=platform.resources.js.map
@@ -0,0 +1 @@
1
+ {"version":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AwF;QACrG,QAAQ,EAAE,kBAAkB;KAC7B,EACD,KAAK,IAAI,EAAE;QACT,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,yBAAyB,CAAC,CAAC;QACxD,OAAO;YACL,QAAQ,EAAE,CAAC;oBACT,GAAG,EAAE,wBAAwB;oBAC7B,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACtF,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Sopo MCP Server — HTTP Client
3
+ *
4
+ * Handles all communication with the Sopo Backend REST API.
5
+ * Manages authentication headers and error normalization.
6
+ */
7
+ export interface SopoConfig {
8
+ backendUrl: string;
9
+ accessToken: string;
10
+ }
11
+ export interface SopoResponse<T = any> {
12
+ success: boolean;
13
+ data?: T;
14
+ error?: string;
15
+ statusCode: number;
16
+ }
17
+ export declare function configureSopoClient(cfg: SopoConfig): void;
18
+ /**
19
+ * Updates the access token at runtime (e.g., after login or token refresh).
20
+ * All subsequent API calls will use the new token.
21
+ */
22
+ export declare function updateAccessToken(newToken: string): void;
23
+ /**
24
+ * Stores the refresh token in memory for automatic token refresh.
25
+ */
26
+ export declare function setRefreshToken(token: string): void;
27
+ /**
28
+ * Retrieves the stored refresh token (if any).
29
+ */
30
+ export declare function getRefreshToken(): string | null;
31
+ /**
32
+ * Returns the backend base URL for direct fetch calls (e.g., auth endpoints).
33
+ */
34
+ export declare function getBackendUrl(): string;
35
+ /**
36
+ * Performs a GET request to the Sopo Backend.
37
+ */
38
+ export declare function sopoGet<T = any>(path: string): Promise<SopoResponse<T>>;
39
+ /**
40
+ * Performs a POST request to the Sopo Backend.
41
+ */
42
+ export declare function sopoPost<T = any>(path: string, body: any): Promise<SopoResponse<T>>;
43
+ /**
44
+ * Performs a PATCH request to the Sopo Backend.
45
+ */
46
+ export declare function sopoPatch<T = any>(path: string, body: any): Promise<SopoResponse<T>>;
47
+ /**
48
+ * Performs a DELETE request to the Sopo Backend.
49
+ */
50
+ export declare function sopoDelete<T = any>(path: string): Promise<SopoResponse<T>>;
51
+ //# sourceMappingURL=sopo-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sopo-client.d.ts","sourceRoot":"","sources":["../src/sopo-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,GAAG;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAEzD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAKxD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AASD;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAYD;;GAEG;AACH,wBAAsB,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAqB7E;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAsBzF;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAsB1F;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAqBhF"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Sopo MCP Server — HTTP Client
3
+ *
4
+ * Handles all communication with the Sopo Backend REST API.
5
+ * Manages authentication headers and error normalization.
6
+ */
7
+ let config = null;
8
+ let storedRefreshToken = null;
9
+ export function configureSopoClient(cfg) {
10
+ config = cfg;
11
+ }
12
+ /**
13
+ * Updates the access token at runtime (e.g., after login or token refresh).
14
+ * All subsequent API calls will use the new token.
15
+ */
16
+ export function updateAccessToken(newToken) {
17
+ if (!config) {
18
+ throw new Error('Sopo client not configured. Call configureSopoClient() first.');
19
+ }
20
+ config.accessToken = newToken;
21
+ }
22
+ /**
23
+ * Stores the refresh token in memory for automatic token refresh.
24
+ */
25
+ export function setRefreshToken(token) {
26
+ storedRefreshToken = token;
27
+ }
28
+ /**
29
+ * Retrieves the stored refresh token (if any).
30
+ */
31
+ export function getRefreshToken() {
32
+ return storedRefreshToken;
33
+ }
34
+ function getConfig() {
35
+ if (!config) {
36
+ throw new Error('Sopo client not configured. Call configureSopoClient() first.');
37
+ }
38
+ return config;
39
+ }
40
+ /**
41
+ * Returns the backend base URL for direct fetch calls (e.g., auth endpoints).
42
+ */
43
+ export function getBackendUrl() {
44
+ return getConfig().backendUrl;
45
+ }
46
+ function buildHeaders() {
47
+ const cfg = getConfig();
48
+ return {
49
+ 'Content-Type': 'application/json',
50
+ 'Authorization': cfg.accessToken.startsWith('Bearer ')
51
+ ? cfg.accessToken
52
+ : `Bearer ${cfg.accessToken}`,
53
+ };
54
+ }
55
+ /**
56
+ * Performs a GET request to the Sopo Backend.
57
+ */
58
+ export async function sopoGet(path) {
59
+ const cfg = getConfig();
60
+ const url = `${cfg.backendUrl}${path}`;
61
+ try {
62
+ const response = await fetch(url, {
63
+ method: 'GET',
64
+ headers: buildHeaders(),
65
+ });
66
+ const body = await response.json().catch(() => null);
67
+ if (!response.ok) {
68
+ const errorMsg = body?.error?.message || body?.message || `HTTP ${response.status}`;
69
+ return { success: false, error: errorMsg, statusCode: response.status };
70
+ }
71
+ return { success: true, data: body, statusCode: response.status };
72
+ }
73
+ catch (err) {
74
+ return { success: false, error: err.message || 'Network error', statusCode: 0 };
75
+ }
76
+ }
77
+ /**
78
+ * Performs a POST request to the Sopo Backend.
79
+ */
80
+ export async function sopoPost(path, body) {
81
+ const cfg = getConfig();
82
+ const url = `${cfg.backendUrl}${path}`;
83
+ try {
84
+ const response = await fetch(url, {
85
+ method: 'POST',
86
+ headers: buildHeaders(),
87
+ body: JSON.stringify(body),
88
+ });
89
+ const responseBody = await response.json().catch(() => null);
90
+ if (!response.ok) {
91
+ const errorMsg = responseBody?.error?.message || responseBody?.message || `HTTP ${response.status}`;
92
+ return { success: false, error: errorMsg, statusCode: response.status };
93
+ }
94
+ return { success: true, data: responseBody, statusCode: response.status };
95
+ }
96
+ catch (err) {
97
+ return { success: false, error: err.message || 'Network error', statusCode: 0 };
98
+ }
99
+ }
100
+ /**
101
+ * Performs a PATCH request to the Sopo Backend.
102
+ */
103
+ export async function sopoPatch(path, body) {
104
+ const cfg = getConfig();
105
+ const url = `${cfg.backendUrl}${path}`;
106
+ try {
107
+ const response = await fetch(url, {
108
+ method: 'PATCH',
109
+ headers: buildHeaders(),
110
+ body: JSON.stringify(body),
111
+ });
112
+ const responseBody = await response.json().catch(() => null);
113
+ if (!response.ok) {
114
+ const errorMsg = responseBody?.error?.message || responseBody?.message || `HTTP ${response.status}`;
115
+ return { success: false, error: errorMsg, statusCode: response.status };
116
+ }
117
+ return { success: true, data: responseBody, statusCode: response.status };
118
+ }
119
+ catch (err) {
120
+ return { success: false, error: err.message || 'Network error', statusCode: 0 };
121
+ }
122
+ }
123
+ /**
124
+ * Performs a DELETE request to the Sopo Backend.
125
+ */
126
+ export async function sopoDelete(path) {
127
+ const cfg = getConfig();
128
+ const url = `${cfg.backendUrl}${path}`;
129
+ try {
130
+ const response = await fetch(url, {
131
+ method: 'DELETE',
132
+ headers: buildHeaders(),
133
+ });
134
+ const responseBody = await response.json().catch(() => null);
135
+ if (!response.ok) {
136
+ const errorMsg = responseBody?.error?.message || responseBody?.message || `HTTP ${response.status}`;
137
+ return { success: false, error: errorMsg, statusCode: response.status };
138
+ }
139
+ return { success: true, data: responseBody, statusCode: response.status };
140
+ }
141
+ catch (err) {
142
+ return { success: false, error: err.message || 'Network error', statusCode: 0 };
143
+ }
144
+ }
145
+ //# sourceMappingURL=sopo-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sopo-client.js","sourceRoot":"","sources":["../src/sopo-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,IAAI,MAAM,GAAsB,IAAI,CAAC;AACrC,IAAI,kBAAkB,GAAkB,IAAI,CAAC;AAE7C,MAAM,UAAU,mBAAmB,CAAC,GAAe;IACjD,MAAM,GAAG,GAAG,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAChC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,kBAAkB,GAAG,KAAK,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,S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ACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAU,IAAY;IACpD,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,UAAU,GAAG,IAAI,EAAE,CAAC;IAEvC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,YAAY,EAAE;SACxB,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QAE7D,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,QAAQ,GAAG,YAAY,EAAE,KAAK,EAAE,OAAO,IAAI,YAAY,EAAE,OAAO,IAAI,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC;YACpG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC1E,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAiB,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,IAAI,eAAe,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IAClF,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sopo MCP Server — Aggregate Request Tools
3
+ *
4
+ * CRUD tools for managing Aggregate Requests (parallel sub-requests on a single route).
5
+ */
6
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ export declare function registerAggregateRequestTools(server: McpServer): void;
8
+ //# sourceMappingURL=aggregate-request.tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-request.tools.d.ts","sourceRoot":"","sources":["../../src/tools/aggregate-request.tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAwErE"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Sopo MCP Server — Aggregate Request Tools
3
+ *
4
+ * CRUD tools for managing Aggregate Requests (parallel sub-requests on a single route).
5
+ */
6
+ import { z } from 'zod';
7
+ import { sopoGet, sopoPost, sopoPatch, sopoDelete } from '../sopo-client.js';
8
+ export function registerAggregateRequestTools(server) {
9
+ // ── List Aggregate Requests ───────────────────────────────────
10
+ server.tool('list_aggregate_requests', 'List all aggregate request configurations. Returns id, route_id, service_id, key_name, method, target_path, and timeout.', {}, async () => {
11
+ const result = await sopoGet('/api/v1/aggregate-requests');
12
+ if (!result.success) {
13
+ return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
14
+ }
15
+ return { content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }] };
16
+ });
17
+ // ── Create Aggregate Request ──────────────────────────────────
18
+ server.tool('create_aggregate_request', 'Define a sub-request for parallel execution on a gateway route. Requires route_id, service_id, and key_name. Both IDs must reference existing resources.', {
19
+ route_id: z.string().uuid().describe('UUID of the parent gateway route (must exist)'),
20
+ service_id: z.string().uuid().describe('UUID of the service to call (must exist)'),
21
+ key_name: z.string().describe('Key name for the response merge (e.g. "users")'),
22
+ method: z.string().optional().describe('HTTP method for this sub-request'),
23
+ target_path: z.string().optional().describe('Target path for this sub-request'),
24
+ timeout: z.string().optional().describe('Timeout for this sub-request'),
25
+ }, async (args) => {
26
+ const result = await sopoPost('/api/v1/aggregate-requests', args);
27
+ if (!result.success) {
28
+ return { content: [{ type: 'text', text: `Error creating aggregate request: ${result.error}` }], isError: true };
29
+ }
30
+ return { content: [{ type: 'text', text: `Aggregate request created:\n${JSON.stringify(result.data, null, 2)}` }] };
31
+ });
32
+ // ── Update Aggregate Request ──────────────────────────────────
33
+ server.tool('update_aggregate_request', 'Update an aggregate request configuration by UUID.', {
34
+ id: z.string().uuid().describe('UUID of the aggregate request'),
35
+ method: z.string().optional().describe('New HTTP method'),
36
+ target_path: z.string().optional().describe('New target path'),
37
+ timeout: z.string().optional().describe('New timeout'),
38
+ }, async (args) => {
39
+ const { id, ...body } = args;
40
+ const result = await sopoPatch(`/api/v1/aggregate-requests/${id}`, body);
41
+ if (!result.success) {
42
+ return { content: [{ type: 'text', text: `Error updating aggregate request: ${result.error}` }], isError: true };
43
+ }
44
+ return { content: [{ type: 'text', text: `Aggregate request updated:\n${JSON.stringify(result.data, null, 2)}` }] };
45
+ });
46
+ // ── Delete Aggregate Request ──────────────────────────────────
47
+ server.tool('delete_aggregate_request', 'Delete an aggregate request by its UUID.', {
48
+ id: z.string().uuid().describe('UUID of the aggregate request to delete'),
49
+ }, async (args) => {
50
+ const result = await sopoDelete(`/api/v1/aggregate-requests/${args.id}`);
51
+ if (!result.success) {
52
+ return { content: [{ type: 'text', text: `Error deleting aggregate request: ${result.error}` }], isError: true };
53
+ }
54
+ return { content: [{ type: 'text', text: `Aggregate request deleted successfully.` }] };
55
+ });
56
+ }
57
+ //# sourceMappingURL=aggregate-request.tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-request.tools.js","sourceRoot":"","sources":["../../src/tools/aggregate-request.tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG7E,MAAM,UAAU,6BAA6B,CAAC,MAAiB;IAE7D,iEAAiE;IACjE,MAAM,CAAC,IAAI,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,EAAE,IAAI,EAAE,qCAAqC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACnH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,+BAA+B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;IACtH,CAAC,CACF,CAAC;IAEF,iEAAiE;IACjE,MAAM,CAAC,IAAI,CACT,0BAA0B,EAC1B,0CAA0C,EAC1C;QACE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;KAC1E,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,8BAA8B,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,qCAAqC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACnH,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,yCAAyC,EAAE,CAAC,EAAE,CAAC;IAC1F,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Sopo MCP Server — Authentication Tools
3
+ *
4
+ * Provides login and token refresh capabilities so the AI can
5
+ * authenticate automatically without requiring manual token setup.
6
+ */
7
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
8
+ /**
9
+ * Registers authentication tools on the MCP server.
10
+ */
11
+ export declare function registerAuthTools(server: McpServer): void;
12
+ //# sourceMappingURL=auth.tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.tools.d.ts","sourceRoot":"","sources":["../../src/tools/auth.tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASpE;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuKzD"}