mcp-http-webhook 1.0.29 → 1.0.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-http-webhook",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "Production-ready MCP server framework with HTTP + webhook-based subscriptions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,11 +29,7 @@
29
29
  "express": "^4.18.0"
30
30
  },
31
31
  "dependencies": {
32
- "@ngrok/ngrok": "^1.5.2",
33
- "@octokit/rest": "^20.0.0",
34
32
  "cors": "^2.8.5",
35
- "googleapis": "^144.0.0",
36
- "ngrok": "^4.3.3",
37
33
  "zod": "^4.0.0"
38
34
  },
39
35
  "devDependencies": {
package/ARCHITECTURE.md DELETED
@@ -1,269 +0,0 @@
1
- # MCP HTTP Webhook Architecture
2
-
3
- ## System Architecture
4
-
5
- ```
6
- ┌─────────────────────────────────────────────────────────────────┐
7
- │ MCP Client │
8
- │ ┌──────────────────────────────────────────────────────────┐ │
9
- │ │ - Calls tools via HTTP POST │ │
10
- │ │ - Reads resources via HTTP POST │ │
11
- │ │ - Subscribes with callback URL │ │
12
- │ │ - Receives notifications via webhook │ │
13
- │ └──────────────────────────────────────────────────────────┘ │
14
- └─────────────────────────────────────────────────────────────────┘
15
- │ ▲
16
- │ HTTP POST /mcp/tools/call │
17
- │ HTTP POST /mcp/resources/read │
18
- │ HTTP POST /mcp/resources/subscribe │
19
- │ │ HTTP POST
20
- ▼ │ (notification)
21
- ┌─────────────────────────────────────────────────────────────────┐
22
- │ MCP HTTP Webhook Server │
23
- │ ┌──────────────────────────────────────────────────────────┐ │
24
- │ │ Express Application │ │
25
- │ │ ┌────────────┐ ┌─────────────┐ ┌──────────────────┐ │ │
26
- │ │ │ Protocol │ │ Subscription│ │ Webhook │ │ │
27
- │ │ │ Handler │ │ Manager │ │ Manager │ │ │
28
- │ │ └────────────┘ └─────────────┘ └──────────────────┘ │ │
29
- │ └──────────────────────────────────────────────────────────┘ │
30
- │ │ │
31
- │ ▼ │
32
- │ ┌──────────────────────────────────────────────────────────┐ │
33
- │ │ Key-Value Store Interface │ │
34
- │ │ (Redis / DynamoDB / PostgreSQL) │ │
35
- │ │ - Subscription data │ │
36
- │ │ - User indexes │ │
37
- │ │ - Metadata │ │
38
- │ └──────────────────────────────────────────────────────────┘ │
39
- └─────────────────────────────────────────────────────────────────┘
40
- │ ▲
41
- │ Register webhook │
42
- │ (onSubscribe) │ HTTP POST
43
- │ │ (third-party event)
44
- ▼ │
45
- ┌─────────────────────────────────────────────────────────────────┐
46
- │ Third-Party Services │
47
- │ ┌────────────┐ ┌──────────┐ ┌──────┐ ┌──────────────┐ │
48
- │ │ GitHub │ │ Slack │ │ Drive│ │ PostgreSQL │ │
49
- │ │ Webhooks │ │ Events │ │ Push │ │ NOTIFY │ │
50
- │ └────────────┘ └──────────┘ └──────┘ └──────────────┘ │
51
- └─────────────────────────────────────────────────────────────────┘
52
- ```
53
-
54
- ## Subscription Flow
55
-
56
- ### 1. Subscribe Request
57
-
58
- ```
59
- Client MCP Server Third-Party
60
- │ │ │
61
- │ POST /resources/subscribe │ │
62
- │ { │ │
63
- │ uri: "...", │ │
64
- │ callbackUrl: "..." │ │
65
- │ } │ │
66
- │──────────────────────────>│ │
67
- │ │ │
68
- │ │ Generate subscriptionId │
69
- │ │ Create webhook URL │
70
- │ │ │
71
- │ │ Register webhook │
72
- │ │─────────────────────────>│
73
- │ │ │
74
- │ │ Store in KV store │
75
- │ │ │
76
- │ Response: │ │
77
- │ { subscriptionId: "..." } │ │
78
- │<──────────────────────────│ │
79
- ```
80
-
81
- ### 2. Webhook Notification Flow
82
-
83
- ```
84
- Third-Party MCP Server Client
85
- │ │ │
86
- │ POST /webhooks/incoming/ │ │
87
- │ {subscriptionId} │ │
88
- │──────────────────────────>│ │
89
- │ │ │
90
- │ │ Load subscription │
91
- │ │ from KV store │
92
- │ │ │
93
- │ │ Process webhook │
94
- │ │ (onWebhook handler) │
95
- │ │ │
96
- │ 200 OK │ │
97
- │<──────────────────────────│ │
98
- │ │ │
99
- │ │ POST to callbackUrl │
100
- │ │ { │
101
- │ │ subscriptionId, │
102
- │ │ resourceUri, │
103
- │ │ changeType, │
104
- │ │ data │
105
- │ │ } │
106
- │ │─────────────────────────>│
107
- │ │ │
108
- │ │ 200 OK │
109
- │ │<─────────────────────────│
110
- ```
111
-
112
- ## Component Interaction
113
-
114
- ### Protocol Handler
115
- - Handles MCP protocol messages
116
- - Validates input using JSON Schema
117
- - Executes tool handlers
118
- - Reads resources
119
- - Returns formatted responses
120
-
121
- ### Subscription Manager
122
- - Creates and deletes subscriptions
123
- - Manages subscription lifecycle
124
- - Stores data in KV store
125
- - Maintains user indexes
126
- - Verifies ownership
127
-
128
- ### Webhook Manager
129
- - Processes incoming webhooks
130
- - Verifies signatures
131
- - Calls client callbacks
132
- - Implements retry logic
133
- - Handles timeouts
134
-
135
- ### Key-Value Store
136
- - Stores subscription data
137
- - Maintains indexes
138
- - Supports TTL
139
- - Provides scan functionality
140
- - Enables horizontal scaling
141
-
142
- ## Data Flow
143
-
144
- ### Tool Call
145
-
146
- ```
147
- 1. Client sends HTTP POST to /mcp/tools/call
148
- 2. Server authenticates request
149
- 3. ProtocolHandler validates input against JSON Schema
150
- 4. Tool handler executes
151
- 5. Response returned to client
152
- ```
153
-
154
- ### Resource Read
155
-
156
- ```
157
- 1. Client sends HTTP POST to /mcp/resources/read
158
- 2. Server authenticates request
159
- 3. ProtocolHandler finds resource by URI
160
- 4. Resource read handler executes
161
- 5. Contents returned to client
162
- ```
163
-
164
- ### Subscription Creation
165
-
166
- ```
167
- 1. Client sends HTTP POST to /mcp/resources/subscribe
168
- 2. Server authenticates request
169
- 3. SubscriptionManager generates ID and webhook URL
170
- 4. Resource onSubscribe handler called
171
- 5. Handler registers with third-party service
172
- 6. Subscription stored in KV store
173
- 7. Subscription ID returned to client
174
- ```
175
-
176
- ### Notification Delivery
177
-
178
- ```
179
- 1. Third-party sends webhook to /webhooks/incoming/{id}
180
- 2. Server loads subscription from KV store
181
- 3. Resource onWebhook handler processes payload
182
- 4. WebhookManager signs and sends to client callback
183
- 5. Retry on failure with exponential backoff
184
- 6. Dead letter queue if all retries fail
185
- ```
186
-
187
- ## Scaling Strategy
188
-
189
- ### Horizontal Scaling
190
-
191
- ```
192
- ┌─────────────┐
193
- │Load Balancer│
194
- └──────┬──────┘
195
-
196
- ├──────────┬──────────┬──────────┐
197
- │ │ │ │
198
- ▼ ▼ ▼ ▼
199
- ┌─────┐ ┌─────┐ ┌─────┐ ┌─────┐
200
- │MCP 1│ │MCP 2│ │MCP 3│ │MCP N│
201
- └──┬──┘ └──┬──┘ └──┬──┘ └──┬──┘
202
- │ │ │ │
203
- └──────────┴──────────┴──────────┘
204
-
205
-
206
- ┌──────────┐
207
- │ Redis │
208
- │ Cluster │
209
- └──────────┘
210
- ```
211
-
212
- Benefits:
213
- - No session affinity required
214
- - Simple round-robin load balancing
215
- - Shared state in Redis
216
- - Independent instance scaling
217
- - Zero-downtime deployments
218
-
219
- ## Security Layers
220
-
221
- ```
222
- ┌─────────────────────────────────────┐
223
- │ HTTPS/TLS (Required) │
224
- └─────────────────────────────────────┘
225
- ┌─────────────────────────────────────┐
226
- │ Authentication Middleware │
227
- │ (JWT, API Key, OAuth2) │
228
- └─────────────────────────────────────┘
229
- ┌─────────────────────────────────────┐
230
- │ Webhook Signature Verification │
231
- │ (HMAC SHA-256, Timing-Safe) │
232
- └─────────────────────────────────────┘
233
- ┌─────────────────────────────────────┐
234
- │ Input Validation │
235
- │ (JSON Schema, AJV) │
236
- └─────────────────────────────────────┘
237
- ┌─────────────────────────────────────┐
238
- │ Rate Limiting │
239
- │ (Optional Middleware) │
240
- └─────────────────────────────────────┘
241
- ```
242
-
243
- ## Performance Optimizations
244
-
245
- 1. **Connection Pooling**
246
- - HTTP keep-alive
247
- - Redis connection pool
248
- - Database connection pool
249
-
250
- 2. **Caching**
251
- - Resource read results
252
- - Tool metadata
253
- - Configuration data
254
-
255
- 3. **Async Processing**
256
- - Non-blocking I/O
257
- - Promise-based handlers
258
- - Background webhook delivery
259
-
260
- 4. **Retry Strategy**
261
- - Exponential backoff
262
- - Circuit breaker pattern
263
- - Dead letter queue
264
-
265
- 5. **Monitoring**
266
- - Prometheus metrics
267
- - Structured logging
268
- - Health check endpoints
269
- - Distributed tracing