@ratio-mcp-qa/docs-server 1.0.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 (59) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +16 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/schemas/oauth.json +71 -0
  6. package/dist/schemas/orders.json +167 -0
  7. package/dist/schemas/products.json +167 -0
  8. package/dist/schemas/schemas/oauth.json +71 -0
  9. package/dist/schemas/schemas/orders.json +167 -0
  10. package/dist/schemas/schemas/products.json +167 -0
  11. package/dist/schemas/schemas/scopes.json +52 -0
  12. package/dist/schemas/schemas/webhooks.json +69 -0
  13. package/dist/schemas/scopes.json +52 -0
  14. package/dist/schemas/webhooks.json +69 -0
  15. package/dist/server.d.ts +6 -0
  16. package/dist/server.d.ts.map +1 -0
  17. package/dist/server.js +53 -0
  18. package/dist/server.js.map +1 -0
  19. package/dist/tools/get-api-reference.d.ts +60 -0
  20. package/dist/tools/get-api-reference.d.ts.map +1 -0
  21. package/dist/tools/get-api-reference.js +53 -0
  22. package/dist/tools/get-api-reference.js.map +1 -0
  23. package/dist/tools/get-scope-map.d.ts +17 -0
  24. package/dist/tools/get-scope-map.d.ts.map +1 -0
  25. package/dist/tools/get-scope-map.js +102 -0
  26. package/dist/tools/get-scope-map.js.map +1 -0
  27. package/dist/tools/get-scopes.d.ts +63 -0
  28. package/dist/tools/get-scopes.d.ts.map +1 -0
  29. package/dist/tools/get-scopes.js +72 -0
  30. package/dist/tools/get-scopes.js.map +1 -0
  31. package/dist/tools/get-webhooks.d.ts +30 -0
  32. package/dist/tools/get-webhooks.d.ts.map +1 -0
  33. package/dist/tools/get-webhooks.js +32 -0
  34. package/dist/tools/get-webhooks.js.map +1 -0
  35. package/dist/tools/index.d.ts +15 -0
  36. package/dist/tools/index.d.ts.map +1 -0
  37. package/dist/tools/index.js +110 -0
  38. package/dist/tools/index.js.map +1 -0
  39. package/dist/tools/lookup-docs.d.ts +58 -0
  40. package/dist/tools/lookup-docs.d.ts.map +1 -0
  41. package/dist/tools/lookup-docs.js +181 -0
  42. package/dist/tools/lookup-docs.js.map +1 -0
  43. package/dist/tools/validate-code.d.ts +12 -0
  44. package/dist/tools/validate-code.d.ts.map +1 -0
  45. package/dist/tools/validate-code.js +185 -0
  46. package/dist/tools/validate-code.js.map +1 -0
  47. package/dist/utils/logger.d.ts +16 -0
  48. package/dist/utils/logger.d.ts.map +1 -0
  49. package/dist/utils/logger.js +85 -0
  50. package/dist/utils/logger.js.map +1 -0
  51. package/dist/utils/schema-loader.d.ts +13 -0
  52. package/dist/utils/schema-loader.d.ts.map +1 -0
  53. package/dist/utils/schema-loader.js +61 -0
  54. package/dist/utils/schema-loader.js.map +1 -0
  55. package/dist/utils/zod-to-json.d.ts +7 -0
  56. package/dist/utils/zod-to-json.d.ts.map +1 -0
  57. package/dist/utils/zod-to-json.js +63 -0
  58. package/dist/utils/zod-to-json.js.map +1 -0
  59. package/package.json +26 -0
@@ -0,0 +1,167 @@
1
+ {
2
+ "resource": "orders",
3
+ "base_url": "https://qa-os-ecosystem.dev.gokwik.io",
4
+ "auth": {
5
+ "type": "bearer",
6
+ "header": "Authorization",
7
+ "format": "Bearer <access_token>"
8
+ },
9
+ "endpoints": [
10
+ {
11
+ "method": "GET",
12
+ "path": "/api/v1/orders",
13
+ "controller_order": 1,
14
+ "handler_name": "getOrders",
15
+ "required_scope": "read_orders",
16
+ "summary": "List orders with pagination and filtering",
17
+ "description": "Retrieve a paginated list of orders from the merchant's store. Supports filtering by status, financial status, fulfillment status, and search.",
18
+ "query_params": [
19
+ { "name": "limit", "type": "number", "required": false, "default": 50, "description": "Number of orders per page (max 100)" },
20
+ { "name": "page", "type": "number", "required": false, "default": 1, "description": "Page number for pagination" },
21
+ { "name": "status", "type": "string", "required": false, "enum": ["any", "open", "cancelled", "archived"], "description": "Filter by order status" },
22
+ { "name": "financial_status", "type": "string", "required": false, "enum": ["pending", "authorized", "partially_paid", "paid", "partially_refunded", "refunded", "voided"], "description": "Filter by payment/financial status" },
23
+ { "name": "fulfillment_status", "type": "string", "required": false, "enum": ["unfulfilled", "fulfilled", "partial", "partially_fulfilled", "restocked", "pending", "refunded", "returned"], "description": "Filter by fulfillment/shipping status" },
24
+ { "name": "sort_field", "type": "string", "required": false, "enum": ["created_at", "updated_at", "processed_at", "order_number", "total_price", "items", "financial_status", "fulfillment_status"], "description": "Field to sort by" },
25
+ { "name": "sort_direction", "type": "string", "required": false, "enum": ["asc", "desc"], "description": "Sort direction" },
26
+ { "name": "search", "type": "string", "required": false, "description": "Search by order number, email, or phone" }
27
+ ],
28
+ "request_body": null,
29
+ "response_schema": "OrderListResponse"
30
+ },
31
+ {
32
+ "method": "GET",
33
+ "path": "/api/v1/orders/:id",
34
+ "controller_order": 2,
35
+ "handler_name": "getOrderById",
36
+ "required_scope": "read_orders",
37
+ "summary": "Get a single order by ID",
38
+ "description": "Retrieve the full details of a single order including line items, customer info, addresses, and payment status.",
39
+ "path_params": [
40
+ { "name": "id", "type": "string", "required": true, "description": "The order ID" }
41
+ ],
42
+ "request_body": null,
43
+ "response_schema": "Order"
44
+ },
45
+ {
46
+ "method": "POST",
47
+ "path": "/api/v1/orders",
48
+ "controller_order": 3,
49
+ "handler_name": "createOrder",
50
+ "required_scope": "order-create",
51
+ "summary": "Create a new order",
52
+ "description": "Create an order in the merchant's store.",
53
+ "request_body": {
54
+ "content_type": "application/json",
55
+ "fields": [
56
+ { "name": "payment_gateway_names", "type": "string[]", "required": true, "description": "Payment gateways used" },
57
+ { "name": "financial_status", "type": "string", "required": true, "enum": ["pending", "authorized", "partially_paid", "paid", "partially_refunded", "refunded", "voided"], "description": "Payment status" },
58
+ { "name": "currency", "type": "string", "required": true, "description": "Currency code (e.g. INR)" },
59
+ { "name": "test", "type": "boolean", "required": true, "description": "Whether this is a test order" },
60
+ { "name": "note", "type": "string", "required": false, "description": "Internal note for the order" },
61
+ { "name": "tags", "type": "string", "required": false, "description": "Comma-separated tags" },
62
+ { "name": "email", "type": "string", "required": false, "description": "Customer email" },
63
+ { "name": "phone", "type": "string", "required": false, "description": "Customer phone" },
64
+ { "name": "customer", "type": "object", "required": true, "description": "Customer details (id, email, first_name, last_name, state, phone, currency)" },
65
+ { "name": "line_items", "type": "array", "required": true, "description": "Array of line items (variant_id, product_id, title, quantity, sku, price, taxable, requires_shipping, image)" },
66
+ { "name": "billing_address", "type": "object", "required": true, "description": "Billing address (address1, city, country, first_name, last_name, phone, province, zip)" },
67
+ { "name": "shipping_address", "type": "object", "required": true, "description": "Shipping address (same structure as billing_address)" }
68
+ ]
69
+ },
70
+ "response_schema": "Order"
71
+ },
72
+ {
73
+ "method": "PATCH",
74
+ "path": "/api/v1/orders/:id",
75
+ "controller_order": 4,
76
+ "handler_name": "updateOrder",
77
+ "required_scope": "order-create",
78
+ "summary": "Update an existing order",
79
+ "description": "Update order fields. Only provided fields are modified.",
80
+ "path_params": [
81
+ { "name": "id", "type": "string", "required": true, "description": "The order ID to update" }
82
+ ],
83
+ "request_body": {
84
+ "content_type": "application/json",
85
+ "fields": [
86
+ { "name": "email", "type": "string", "required": false, "description": "Updated customer email" },
87
+ { "name": "phone", "type": "string", "required": false, "description": "Updated customer phone" },
88
+ { "name": "note", "type": "string", "required": false, "description": "Updated order note" },
89
+ { "name": "tags", "type": "string", "required": false, "description": "Updated tags (comma-separated)" },
90
+ { "name": "status", "type": "string", "required": false, "enum": ["open", "closed", "cancelled"], "description": "Order status" },
91
+ { "name": "financial_status", "type": "string", "required": false, "enum": ["pending", "authorized", "partially_paid", "paid", "partially_refunded", "refunded", "voided"] },
92
+ { "name": "fulfillment_status", "type": "string", "required": false, "enum": ["fulfilled", "partial", "partially_fulfilled", "unfulfilled", "restocked", "pending", "refunded", "returned"] },
93
+ { "name": "shipping_address", "type": "object", "required": false, "description": "Updated shipping address" },
94
+ { "name": "line_items", "type": "array", "required": false, "description": "Updated line items" }
95
+ ]
96
+ },
97
+ "response_schema": "Order"
98
+ },
99
+ {
100
+ "method": "PATCH",
101
+ "path": "/api/v1/orders/:id/cancel",
102
+ "controller_order": 5,
103
+ "handler_name": "cancelOrder",
104
+ "required_scope": "order-create",
105
+ "summary": "Cancel an existing order",
106
+ "description": "Cancel an existing order with optional reason and restock settings.",
107
+ "path_params": [
108
+ { "name": "id", "type": "string", "required": true, "description": "The order ID to cancel" }
109
+ ],
110
+ "request_body": {
111
+ "content_type": "application/json",
112
+ "fields": [
113
+ { "name": "cancel_reason", "type": "string", "required": false, "description": "Reason for cancellation" },
114
+ { "name": "staff_note", "type": "string", "required": false, "description": "Internal note about the cancellation" },
115
+ { "name": "restock_inventory", "type": "boolean", "required": false, "description": "Whether to restock inventory" },
116
+ { "name": "send_notification", "type": "boolean", "required": false, "description": "Whether to send notification to customer" }
117
+ ]
118
+ },
119
+ "response_schema": "Order"
120
+ },
121
+ {
122
+ "method": "PATCH",
123
+ "path": "/api/v1/orders/:id/external-id",
124
+ "controller_order": 6,
125
+ "handler_name": "updateOrderExternalId",
126
+ "required_scope": "order-create",
127
+ "summary": "Update external ID for an order",
128
+ "description": "Updates the external_order_id field for a single order. Useful for syncing with external systems.",
129
+ "path_params": [
130
+ { "name": "id", "type": "string", "required": true, "description": "The order ID" }
131
+ ],
132
+ "request_body": {
133
+ "content_type": "application/json",
134
+ "fields": [
135
+ { "name": "external_id", "type": "string", "required": true, "description": "External reference ID from your system" }
136
+ ]
137
+ },
138
+ "response_schema": "Order"
139
+ }
140
+ ],
141
+ "schemas": {
142
+ "Order": {
143
+ "id": "string — unique order identifier",
144
+ "order_number": "number — sequential order number",
145
+ "email": "string | null — customer email",
146
+ "phone": "string | null — customer phone",
147
+ "financial_status": "'pending' | 'authorized' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'voided'",
148
+ "fulfillment_status": "'unfulfilled' | 'partial' | 'fulfilled' | 'partially_fulfilled' | 'restocked' | 'pending' | 'refunded' | 'returned'",
149
+ "status": "'open' | 'closed' | 'cancelled' | 'archived'",
150
+ "currency": "string — currency code (e.g. 'INR')",
151
+ "total_price": "number — final total price",
152
+ "subtotal_price": "number — subtotal before tax and discounts",
153
+ "total_tax": "number — total tax amount",
154
+ "total_discounts": "number — total discount amount",
155
+ "line_items": "LineItem[] — items in the order",
156
+ "customer": "Customer object",
157
+ "shipping_address": "Address | null",
158
+ "billing_address": "Address | null",
159
+ "note": "string | null — internal note",
160
+ "tags": "string — comma-separated tags",
161
+ "created_at": "string — ISO 8601 timestamp",
162
+ "updated_at": "string — ISO 8601 timestamp",
163
+ "cancelled_at": "string | null — ISO 8601 timestamp if cancelled"
164
+ }
165
+ },
166
+ "statuses": ["pending", "confirmed", "processing", "shipped", "delivered", "cancelled", "refunded"]
167
+ }
@@ -0,0 +1,167 @@
1
+ {
2
+ "resource": "products",
3
+ "base_url": "https://qa-os-ecosystem.dev.gokwik.io",
4
+ "auth": {
5
+ "type": "bearer",
6
+ "header": "Authorization",
7
+ "format": "Bearer <access_token>"
8
+ },
9
+ "endpoints": [
10
+ {
11
+ "method": "GET",
12
+ "path": "/api/v1/v1/products",
13
+ "controller_order": 1,
14
+ "handler_name": "getProducts",
15
+ "required_scope": "read_products",
16
+ "summary": "List products with pagination and filtering",
17
+ "description": "Retrieve a paginated list of products. Supports filtering by status, vendor, tags, category, collection, and search.",
18
+ "query_params": [
19
+ { "name": "limit", "type": "number", "required": false, "default": 10, "description": "Number of products per page" },
20
+ { "name": "page", "type": "number", "required": false, "default": 1, "description": "Page number for pagination" },
21
+ { "name": "offset", "type": "number", "required": false, "default": 0, "description": "Offset for pagination" },
22
+ { "name": "all", "type": "boolean", "required": false, "description": "Return all products (ignore pagination)" },
23
+ { "name": "search", "type": "string", "required": false, "description": "Search products by title" },
24
+ { "name": "status", "type": "string", "required": false, "enum": ["draft", "active", "archived"], "description": "Filter by product status" },
25
+ { "name": "vendor", "type": "string", "required": false, "description": "Filter by vendor/brand name" },
26
+ { "name": "categoryId", "type": "string", "required": false, "description": "Filter by category ID" },
27
+ { "name": "collectionId", "type": "string", "required": false, "description": "Filter by collection ID" },
28
+ { "name": "tagId", "type": "string", "required": false, "description": "Filter by tag ID" },
29
+ { "name": "tags", "type": "string", "required": false, "description": "Filter by tags" },
30
+ { "name": "published", "type": "boolean", "required": false, "description": "Filter by published status" },
31
+ { "name": "show_variants", "type": "boolean", "required": false, "default": false, "description": "Include variant details in response" }
32
+ ],
33
+ "request_body": null,
34
+ "response_schema": "ProductListResponse"
35
+ },
36
+ {
37
+ "method": "GET",
38
+ "path": "/api/v1/v1/products/:id",
39
+ "controller_order": 2,
40
+ "handler_name": "getProductById",
41
+ "required_scope": "read_products",
42
+ "summary": "Get a single product by ID",
43
+ "description": "Retrieve the full details of a single product.",
44
+ "path_params": [
45
+ { "name": "id", "type": "string", "required": true, "description": "The product ID" }
46
+ ],
47
+ "query_params": [
48
+ { "name": "show_variants", "type": "boolean", "required": false, "description": "Include variant details in response" }
49
+ ],
50
+ "request_body": null,
51
+ "response_schema": "Product"
52
+ },
53
+ {
54
+ "method": "POST",
55
+ "path": "/api/v1/v1/products",
56
+ "controller_order": 3,
57
+ "handler_name": "createProduct",
58
+ "required_scope": "write_products",
59
+ "summary": "Create a product",
60
+ "description": "Create a product in the merchant's store. The body must be wrapped in a { product: { ... } } object.",
61
+ "request_body": {
62
+ "content_type": "application/json",
63
+ "note": "The request body MUST be wrapped: { \"product\": { ... } }",
64
+ "fields": [
65
+ { "name": "title", "type": "string", "required": true, "description": "Product title" },
66
+ { "name": "body_html", "type": "string", "required": false, "description": "HTML description" },
67
+ { "name": "handle", "type": "string", "required": false, "description": "URL-friendly slug" },
68
+ { "name": "product_type", "type": "string", "required": false, "description": "Product type/category" },
69
+ { "name": "vendor", "type": "string", "required": false, "description": "Manufacturer/brand" },
70
+ { "name": "status", "type": "string", "required": false, "enum": ["draft", "active", "archived"], "description": "Product status" },
71
+ { "name": "tags", "type": "string", "required": false, "description": "Comma-separated tags" },
72
+ { "name": "price", "type": "number", "required": false, "description": "Price in paise (integer)" },
73
+ { "name": "compare_at_price", "type": "number", "required": false, "description": "Compare-at price in paise" },
74
+ { "name": "sku", "type": "string", "required": false, "description": "Stock keeping unit" },
75
+ { "name": "barcode", "type": "string", "required": false, "description": "Barcode" },
76
+ { "name": "weight", "type": "number", "required": false, "description": "Weight value" },
77
+ { "name": "weight_unit", "type": "string", "required": false, "description": "Weight unit (kg, g, lb, oz)" },
78
+ { "name": "charge_tax", "type": "boolean", "required": false, "description": "Charge tax on this product" },
79
+ { "name": "track_inventory", "type": "boolean", "required": false, "description": "Track inventory" },
80
+ { "name": "is_physical_product", "type": "boolean", "required": false, "description": "Is physical product" },
81
+ { "name": "seo_title", "type": "string", "required": false, "description": "SEO title" },
82
+ { "name": "seo_description", "type": "string", "required": false, "description": "SEO description" },
83
+ { "name": "categoryId", "type": "string", "required": false, "description": "Category ID" },
84
+ { "name": "collectionIds", "type": "string[]", "required": false, "description": "Collection IDs" },
85
+ { "name": "tagIds", "type": "string[]", "required": false, "description": "Tag IDs" },
86
+ { "name": "metadata", "type": "object", "required": false, "description": "Additional metadata" }
87
+ ]
88
+ },
89
+ "response_schema": "Product"
90
+ },
91
+ {
92
+ "method": "PUT",
93
+ "path": "/api/v1/v1/products/:id",
94
+ "controller_order": 4,
95
+ "handler_name": "updateProduct",
96
+ "required_scope": "write_products",
97
+ "summary": "Update a product",
98
+ "description": "Update product fields. Only provided fields are modified.",
99
+ "path_params": [
100
+ { "name": "id", "type": "string", "required": true, "description": "The product ID to update" }
101
+ ],
102
+ "request_body": {
103
+ "content_type": "application/json",
104
+ "fields": [
105
+ { "name": "title", "type": "string", "required": false },
106
+ { "name": "body_html", "type": "string", "required": false },
107
+ { "name": "handle", "type": "string", "required": false },
108
+ { "name": "product_type", "type": "string", "required": false },
109
+ { "name": "vendor", "type": "string", "required": false },
110
+ { "name": "status", "type": "string", "required": false, "enum": ["draft", "active", "archived"] },
111
+ { "name": "tags", "type": "string", "required": false },
112
+ { "name": "price", "type": "number", "required": false },
113
+ { "name": "compare_at_price", "type": "number", "required": false },
114
+ { "name": "sku", "type": "string", "required": false },
115
+ { "name": "barcode", "type": "string", "required": false },
116
+ { "name": "weight", "type": "number", "required": false },
117
+ { "name": "weight_unit", "type": "string", "required": false },
118
+ { "name": "seo_title", "type": "string", "required": false },
119
+ { "name": "seo_description", "type": "string", "required": false },
120
+ { "name": "categoryId", "type": "string", "required": false },
121
+ { "name": "collectionIds", "type": "string[]", "required": false },
122
+ { "name": "tagIds", "type": "string[]", "required": false },
123
+ { "name": "metadata", "type": "object", "required": false }
124
+ ]
125
+ },
126
+ "response_schema": "Product"
127
+ },
128
+ {
129
+ "method": "DELETE",
130
+ "path": "/api/v1/v1/products/:id",
131
+ "controller_order": 5,
132
+ "handler_name": "deleteProduct",
133
+ "required_scope": "write_products",
134
+ "summary": "Delete a product",
135
+ "description": "Permanently delete a product from the merchant's store.",
136
+ "path_params": [
137
+ { "name": "id", "type": "string", "required": true, "description": "The product ID to delete" }
138
+ ],
139
+ "request_body": null,
140
+ "response_schema": null
141
+ }
142
+ ],
143
+ "schemas": {
144
+ "Product": {
145
+ "id": "string — unique product identifier (UUID)",
146
+ "title": "string — product title",
147
+ "body_html": "string | null — HTML description",
148
+ "handle": "string — URL-friendly slug",
149
+ "product_type": "string | null — product type/category",
150
+ "vendor": "string | null — vendor/brand name",
151
+ "status": "'draft' | 'active' | 'archived'",
152
+ "tags": "string — comma-separated tags",
153
+ "price": "number — price in paise",
154
+ "compare_at_price": "number | null — compare-at price in paise",
155
+ "sku": "string | null — stock keeping unit",
156
+ "barcode": "string | null — barcode",
157
+ "weight": "number | null — weight value",
158
+ "weight_unit": "string | null — weight unit",
159
+ "published_at": "string | null — ISO 8601 timestamp",
160
+ "created_at": "string — ISO 8601 timestamp",
161
+ "updated_at": "string — ISO 8601 timestamp",
162
+ "variants": "Variant[] — product variants (when show_variants=true)",
163
+ "images": "Image[] — product images"
164
+ }
165
+ },
166
+ "statuses": ["draft", "active", "archived"]
167
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "version": 1,
3
+ "resources": {
4
+ "orders": {
5
+ "display_name": "Orders",
6
+ "description": "Access and manage merchant orders",
7
+ "scopes": {
8
+ "read_orders": {
9
+ "label": "Read Orders",
10
+ "description": "View orders and order details",
11
+ "access": "read-only",
12
+ "endpoints": ["GET /api/v1/orders", "GET /api/v1/orders/:id"]
13
+ },
14
+ "order-create": {
15
+ "label": "Order Create/Update",
16
+ "description": "Create, update, and cancel orders",
17
+ "access": "read-write",
18
+ "inherits": "read_orders",
19
+ "endpoints": [
20
+ "POST /api/v1/orders",
21
+ "PATCH /api/v1/orders/:id",
22
+ "PATCH /api/v1/orders/:id/cancel",
23
+ "PATCH /api/v1/orders/:id/external-id"
24
+ ]
25
+ }
26
+ }
27
+ },
28
+ "products": {
29
+ "display_name": "Products",
30
+ "description": "Access and manage merchant products",
31
+ "scopes": {
32
+ "read_products": {
33
+ "label": "Read Products",
34
+ "description": "View products and product details",
35
+ "access": "read-only",
36
+ "endpoints": ["GET /api/v1/v1/products", "GET /api/v1/v1/products/:id"]
37
+ },
38
+ "write_products": {
39
+ "label": "Write Products",
40
+ "description": "Create, update, and delete products",
41
+ "access": "read-write",
42
+ "inherits": "read_products",
43
+ "endpoints": [
44
+ "POST /api/v1/v1/products",
45
+ "PUT /api/v1/v1/products/:id",
46
+ "DELETE /api/v1/v1/products/:id"
47
+ ]
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "version": 1,
3
+ "verification": {
4
+ "method": "HMAC-SHA256",
5
+ "header": "X-Ratio-Hmac-SHA256",
6
+ "description": "Verify webhook authenticity by computing HMAC-SHA256 of the raw request body using your app's client_secret as the key."
7
+ },
8
+ "retry_policy": {
9
+ "max_retries": 3,
10
+ "retry_intervals": ["5s", "30s", "5m"],
11
+ "failure_action": "Webhook is disabled after all retries fail"
12
+ },
13
+ "events": [
14
+ {
15
+ "topic": "orders/create",
16
+ "description": "Fired when a new order is created",
17
+ "resource": "orders",
18
+ "required_scope": "read_orders"
19
+ },
20
+ {
21
+ "topic": "orders/updated",
22
+ "description": "Fired when an order is updated",
23
+ "resource": "orders",
24
+ "required_scope": "read_orders"
25
+ },
26
+ {
27
+ "topic": "orders/cancelled",
28
+ "description": "Fired when an order is cancelled",
29
+ "resource": "orders",
30
+ "required_scope": "read_orders"
31
+ },
32
+ {
33
+ "topic": "orders/fulfilled",
34
+ "description": "Fired when an order is fulfilled",
35
+ "resource": "orders",
36
+ "required_scope": "read_orders"
37
+ },
38
+ {
39
+ "topic": "orders/paid",
40
+ "description": "Fired when an order is paid",
41
+ "resource": "orders",
42
+ "required_scope": "read_orders"
43
+ },
44
+ {
45
+ "topic": "products/create",
46
+ "description": "Fired when a new product is created",
47
+ "resource": "products",
48
+ "required_scope": "read_products"
49
+ },
50
+ {
51
+ "topic": "products/update",
52
+ "description": "Fired when a product is updated",
53
+ "resource": "products",
54
+ "required_scope": "read_products"
55
+ },
56
+ {
57
+ "topic": "products/delete",
58
+ "description": "Fired when a product is deleted",
59
+ "resource": "products",
60
+ "required_scope": "read_products"
61
+ },
62
+ {
63
+ "topic": "app/uninstalled",
64
+ "description": "Fired when the app is uninstalled by a merchant",
65
+ "resource": "app",
66
+ "required_scope": null
67
+ }
68
+ ]
69
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "version": 1,
3
+ "resources": {
4
+ "orders": {
5
+ "display_name": "Orders",
6
+ "description": "Access and manage merchant orders",
7
+ "scopes": {
8
+ "read_orders": {
9
+ "label": "Read Orders",
10
+ "description": "View orders and order details",
11
+ "access": "read-only",
12
+ "endpoints": ["GET /api/v1/orders", "GET /api/v1/orders/:id"]
13
+ },
14
+ "order-create": {
15
+ "label": "Order Create/Update",
16
+ "description": "Create, update, and cancel orders",
17
+ "access": "read-write",
18
+ "inherits": "read_orders",
19
+ "endpoints": [
20
+ "POST /api/v1/orders",
21
+ "PATCH /api/v1/orders/:id",
22
+ "PATCH /api/v1/orders/:id/cancel",
23
+ "PATCH /api/v1/orders/:id/external-id"
24
+ ]
25
+ }
26
+ }
27
+ },
28
+ "products": {
29
+ "display_name": "Products",
30
+ "description": "Access and manage merchant products",
31
+ "scopes": {
32
+ "read_products": {
33
+ "label": "Read Products",
34
+ "description": "View products and product details",
35
+ "access": "read-only",
36
+ "endpoints": ["GET /api/v1/v1/products", "GET /api/v1/v1/products/:id"]
37
+ },
38
+ "write_products": {
39
+ "label": "Write Products",
40
+ "description": "Create, update, and delete products",
41
+ "access": "read-write",
42
+ "inherits": "read_products",
43
+ "endpoints": [
44
+ "POST /api/v1/v1/products",
45
+ "PUT /api/v1/v1/products/:id",
46
+ "DELETE /api/v1/v1/products/:id"
47
+ ]
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "version": 1,
3
+ "verification": {
4
+ "method": "HMAC-SHA256",
5
+ "header": "X-Ratio-Hmac-SHA256",
6
+ "description": "Verify webhook authenticity by computing HMAC-SHA256 of the raw request body using your app's client_secret as the key."
7
+ },
8
+ "retry_policy": {
9
+ "max_retries": 3,
10
+ "retry_intervals": ["5s", "30s", "5m"],
11
+ "failure_action": "Webhook is disabled after all retries fail"
12
+ },
13
+ "events": [
14
+ {
15
+ "topic": "orders/create",
16
+ "description": "Fired when a new order is created",
17
+ "resource": "orders",
18
+ "required_scope": "read_orders"
19
+ },
20
+ {
21
+ "topic": "orders/updated",
22
+ "description": "Fired when an order is updated",
23
+ "resource": "orders",
24
+ "required_scope": "read_orders"
25
+ },
26
+ {
27
+ "topic": "orders/cancelled",
28
+ "description": "Fired when an order is cancelled",
29
+ "resource": "orders",
30
+ "required_scope": "read_orders"
31
+ },
32
+ {
33
+ "topic": "orders/fulfilled",
34
+ "description": "Fired when an order is fulfilled",
35
+ "resource": "orders",
36
+ "required_scope": "read_orders"
37
+ },
38
+ {
39
+ "topic": "orders/paid",
40
+ "description": "Fired when an order is paid",
41
+ "resource": "orders",
42
+ "required_scope": "read_orders"
43
+ },
44
+ {
45
+ "topic": "products/create",
46
+ "description": "Fired when a new product is created",
47
+ "resource": "products",
48
+ "required_scope": "read_products"
49
+ },
50
+ {
51
+ "topic": "products/update",
52
+ "description": "Fired when a product is updated",
53
+ "resource": "products",
54
+ "required_scope": "read_products"
55
+ },
56
+ {
57
+ "topic": "products/delete",
58
+ "description": "Fired when a product is deleted",
59
+ "resource": "products",
60
+ "required_scope": "read_products"
61
+ },
62
+ {
63
+ "topic": "app/uninstalled",
64
+ "description": "Fired when the app is uninstalled by a merchant",
65
+ "resource": "app",
66
+ "required_scope": null
67
+ }
68
+ ]
69
+ }
@@ -0,0 +1,6 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ /**
3
+ * Create and configure the Ratio Docs MCP Server
4
+ */
5
+ export declare function createDocsServer(): McpServer;
6
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,CAuD5C"}
package/dist/server.js ADDED
@@ -0,0 +1,53 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { DOCS_SERVER_NAME, DOCS_SERVER_VERSION } from '@ratio-mcp-qa/shared';
3
+ import { docsTools } from './tools/index.js';
4
+ import { logger } from './utils/logger.js';
5
+ /**
6
+ * Create and configure the Ratio Docs MCP Server
7
+ */
8
+ export function createDocsServer() {
9
+ const server = new McpServer({
10
+ name: DOCS_SERVER_NAME,
11
+ version: DOCS_SERVER_VERSION,
12
+ });
13
+ // Register all tools
14
+ for (const tool of docsTools) {
15
+ // Pass Zod shape directly — MCP SDK handles Zod-to-JSON conversion internally
16
+ const shape = tool.inputSchema.shape;
17
+ server.tool(tool.name, tool.description, shape, async (args) => {
18
+ logger.toolCall(tool.name, args);
19
+ const startTime = Date.now();
20
+ try {
21
+ const result = tool.handler(args);
22
+ const duration = Date.now() - startTime;
23
+ logger.toolResult(tool.name, duration, result);
24
+ return {
25
+ content: [
26
+ {
27
+ type: 'text',
28
+ text: JSON.stringify(result, null, 2),
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ catch (error) {
34
+ const duration = Date.now() - startTime;
35
+ logger.toolError(tool.name, duration, error);
36
+ const message = error instanceof Error ? error.message : String(error);
37
+ return {
38
+ content: [
39
+ {
40
+ type: 'text',
41
+ text: JSON.stringify({ error: true, message }, null, 2),
42
+ },
43
+ ],
44
+ isError: true,
45
+ };
46
+ }
47
+ });
48
+ logger.debug(`Registered tool: ${tool.name}`);
49
+ }
50
+ logger.info(`${DOCS_SERVER_NAME} initialized with ${docsTools.length} tools`);
51
+ return server;
52
+ }
53
+ //# sourceMappingURL=server.js.map