@barndoor-ai/sdk 0.2.0 → 0.2.2
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/README.md +7 -7
- package/{src/auth/index.ts → dist/auth/index.d.ts} +2 -17
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/pkce.d.ts +92 -0
- package/dist/auth/pkce.d.ts.map +1 -0
- package/dist/auth/store.d.ts +145 -0
- package/dist/auth/store.d.ts.map +1 -0
- package/dist/client.d.ts +164 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/config.d.ts +144 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/exceptions/index.d.ts +119 -0
- package/dist/exceptions/index.d.ts.map +1 -0
- package/dist/http/client.d.ts +82 -0
- package/dist/http/client.d.ts.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.js +2 -0
- package/dist/logging.d.ts +48 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/models/index.d.ts +116 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/quickstart.d.ts +91 -0
- package/dist/quickstart.d.ts.map +1 -0
- package/dist/version.d.ts +17 -0
- package/dist/version.d.ts.map +1 -0
- package/package.json +8 -2
- package/.eslintignore +0 -8
- package/.eslintrc.cjs +0 -102
- package/.github/CODEOWNERS +0 -4
- package/.github/workflows/ci.yml +0 -57
- package/.prettierignore +0 -6
- package/.prettierrc +0 -13
- package/RELEASE.md +0 -203
- package/examples/README.md +0 -92
- package/examples/basic-mcp-client.js +0 -134
- package/examples/openai-integration.js +0 -137
- package/jest.config.js +0 -16
- package/openapi.yaml +0 -681
- package/rollup.config.js +0 -63
- package/scripts/dump-core-files.js +0 -161
- package/scripts/dump-typescript-only.js +0 -150
- package/src/auth/pkce.ts +0 -346
- package/src/auth/store.ts +0 -809
- package/src/client.ts +0 -512
- package/src/config.ts +0 -402
- package/src/exceptions/index.ts +0 -205
- package/src/http/client.ts +0 -272
- package/src/index.ts +0 -92
- package/src/logging.ts +0 -111
- package/src/models/index.ts +0 -156
- package/src/quickstart.ts +0 -358
- package/src/version.ts +0 -41
- package/test/client.test.js +0 -381
- package/test/config.test.js +0 -202
- package/test/exceptions.test.js +0 -142
- package/test/integration.test.js +0 -147
- package/test/models.test.js +0 -177
- package/test/token-management.test.js +0 -81
- package/test/token-validation.test.js +0 -104
- package/tsconfig.json +0 -61
package/openapi.yaml
DELETED
|
@@ -1,681 +0,0 @@
|
|
|
1
|
-
openapi: 3.0.3
|
|
2
|
-
info:
|
|
3
|
-
title: Barndoor Platform API
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
description: |
|
|
6
|
-
REST API for the Barndoor Platform - manage MCP servers, OAuth connections, and proxy MCP requests.
|
|
7
|
-
|
|
8
|
-
## Authentication
|
|
9
|
-
|
|
10
|
-
All endpoints require a JWT Bearer token obtained through Auth0 OAuth 2.0 flow with PKCE.
|
|
11
|
-
The SDK handles the OAuth flow automatically using interactive login.
|
|
12
|
-
|
|
13
|
-
## MCP Integration
|
|
14
|
-
|
|
15
|
-
The `/mcp/{mcp_server_name}` endpoints provide streaming proxy access to third-party MCP servers
|
|
16
|
-
(Salesforce, Notion, Slack, etc.) with automatic authentication and session management.
|
|
17
|
-
|
|
18
|
-
contact:
|
|
19
|
-
name: Barndoor Support
|
|
20
|
-
url: https://barndoor.ai
|
|
21
|
-
|
|
22
|
-
servers:
|
|
23
|
-
- url: https://{organization_id}.mcp.barndoor.ai
|
|
24
|
-
description: Production API
|
|
25
|
-
variables:
|
|
26
|
-
organization_id:
|
|
27
|
-
description: Your organization identifier
|
|
28
|
-
default: your-org
|
|
29
|
-
|
|
30
|
-
security:
|
|
31
|
-
- BearerAuth: []
|
|
32
|
-
|
|
33
|
-
components:
|
|
34
|
-
securitySchemes:
|
|
35
|
-
BearerAuth:
|
|
36
|
-
type: http
|
|
37
|
-
scheme: bearer
|
|
38
|
-
bearerFormat: JWT
|
|
39
|
-
description: |
|
|
40
|
-
JWT token obtained through Auth0 OAuth 2.0 flow with PKCE.
|
|
41
|
-
|
|
42
|
-
The token should be included in the Authorization header:
|
|
43
|
-
`Authorization: Bearer <your-jwt-token>`
|
|
44
|
-
|
|
45
|
-
Use the Barndoor SDK's `loginInteractive()` function to obtain tokens automatically.
|
|
46
|
-
|
|
47
|
-
schemas:
|
|
48
|
-
ServerSummary:
|
|
49
|
-
type: object
|
|
50
|
-
required:
|
|
51
|
-
- id
|
|
52
|
-
- name
|
|
53
|
-
- slug
|
|
54
|
-
- connection_status
|
|
55
|
-
properties:
|
|
56
|
-
id:
|
|
57
|
-
type: string
|
|
58
|
-
format: uuid
|
|
59
|
-
description: Unique identifier for the server
|
|
60
|
-
example: "123e4567-e89b-12d3-a456-426614174000"
|
|
61
|
-
name:
|
|
62
|
-
type: string
|
|
63
|
-
description: Human-readable name of the server
|
|
64
|
-
example: "Salesforce Production"
|
|
65
|
-
slug:
|
|
66
|
-
type: string
|
|
67
|
-
description: URL-friendly identifier used in API paths
|
|
68
|
-
pattern: "^[a-z0-9-]+$"
|
|
69
|
-
example: "salesforce"
|
|
70
|
-
provider:
|
|
71
|
-
type: string
|
|
72
|
-
nullable: true
|
|
73
|
-
description: Third-party provider name
|
|
74
|
-
example: "salesforce"
|
|
75
|
-
connection_status:
|
|
76
|
-
type: string
|
|
77
|
-
enum: [available, pending, connected, error]
|
|
78
|
-
description: |
|
|
79
|
-
Current connection status:
|
|
80
|
-
- `available`: Server is available but not connected
|
|
81
|
-
- `pending`: Connection is in progress or credentials missing
|
|
82
|
-
- `connected`: Server is connected and ready to use
|
|
83
|
-
- `error`: Connection failed or encountered an error
|
|
84
|
-
example: "connected"
|
|
85
|
-
|
|
86
|
-
ServerDetail:
|
|
87
|
-
allOf:
|
|
88
|
-
- $ref: "#/components/schemas/ServerSummary"
|
|
89
|
-
- type: object
|
|
90
|
-
properties:
|
|
91
|
-
url:
|
|
92
|
-
type: string
|
|
93
|
-
format: uri
|
|
94
|
-
nullable: true
|
|
95
|
-
description: MCP base URL from the server directory
|
|
96
|
-
example: "https://api.salesforce.com/mcp"
|
|
97
|
-
|
|
98
|
-
ConnectionInitiationResponse:
|
|
99
|
-
type: object
|
|
100
|
-
properties:
|
|
101
|
-
auth_url:
|
|
102
|
-
type: string
|
|
103
|
-
format: uri
|
|
104
|
-
description: OAuth authorization URL to redirect user to
|
|
105
|
-
example: "https://login.salesforce.com/services/oauth2/authorize?..."
|
|
106
|
-
additionalProperties: true
|
|
107
|
-
|
|
108
|
-
ConnectionStatusResponse:
|
|
109
|
-
type: object
|
|
110
|
-
required:
|
|
111
|
-
- status
|
|
112
|
-
properties:
|
|
113
|
-
status:
|
|
114
|
-
type: string
|
|
115
|
-
enum: [available, pending, connected, error]
|
|
116
|
-
description: Current connection status
|
|
117
|
-
example: "connected"
|
|
118
|
-
|
|
119
|
-
Error:
|
|
120
|
-
type: object
|
|
121
|
-
required:
|
|
122
|
-
- error
|
|
123
|
-
- message
|
|
124
|
-
properties:
|
|
125
|
-
error:
|
|
126
|
-
type: string
|
|
127
|
-
description: Error type identifier
|
|
128
|
-
example: "ServerNotFound"
|
|
129
|
-
message:
|
|
130
|
-
type: string
|
|
131
|
-
description: Human-readable error message
|
|
132
|
-
example: "Server with ID '123' not found"
|
|
133
|
-
details:
|
|
134
|
-
type: object
|
|
135
|
-
description: Additional error details
|
|
136
|
-
additionalProperties: true
|
|
137
|
-
|
|
138
|
-
paths:
|
|
139
|
-
/servers:
|
|
140
|
-
get:
|
|
141
|
-
summary: List MCP servers
|
|
142
|
-
description: |
|
|
143
|
-
List all MCP servers available to the caller's organization.
|
|
144
|
-
Returns basic information about each server including connection status.
|
|
145
|
-
operationId: listServers
|
|
146
|
-
tags:
|
|
147
|
-
- Servers
|
|
148
|
-
responses:
|
|
149
|
-
"200":
|
|
150
|
-
description: List of available MCP servers
|
|
151
|
-
content:
|
|
152
|
-
application/json:
|
|
153
|
-
schema:
|
|
154
|
-
type: array
|
|
155
|
-
items:
|
|
156
|
-
$ref: "#/components/schemas/ServerSummary"
|
|
157
|
-
example:
|
|
158
|
-
- id: "123e4567-e89b-12d3-a456-426614174000"
|
|
159
|
-
name: "Salesforce Production"
|
|
160
|
-
slug: "salesforce"
|
|
161
|
-
provider: "salesforce"
|
|
162
|
-
connection_status: "connected"
|
|
163
|
-
- id: "987fcdeb-51a2-43d1-9f12-123456789abc"
|
|
164
|
-
name: "Notion Workspace"
|
|
165
|
-
slug: "notion"
|
|
166
|
-
provider: "notion"
|
|
167
|
-
connection_status: "available"
|
|
168
|
-
"401":
|
|
169
|
-
description: Unauthorized - invalid or missing JWT token
|
|
170
|
-
content:
|
|
171
|
-
application/json:
|
|
172
|
-
schema:
|
|
173
|
-
$ref: "#/components/schemas/Error"
|
|
174
|
-
"500":
|
|
175
|
-
description: Internal server error
|
|
176
|
-
content:
|
|
177
|
-
application/json:
|
|
178
|
-
schema:
|
|
179
|
-
$ref: "#/components/schemas/Error"
|
|
180
|
-
|
|
181
|
-
/servers/{server_id}:
|
|
182
|
-
get:
|
|
183
|
-
summary: Get server details
|
|
184
|
-
description: |
|
|
185
|
-
Get detailed information about a specific MCP server.
|
|
186
|
-
Returns extended information including MCP URL if available.
|
|
187
|
-
operationId: getServer
|
|
188
|
-
parameters:
|
|
189
|
-
- name: server_id
|
|
190
|
-
in: path
|
|
191
|
-
required: true
|
|
192
|
-
description: Server UUID or slug
|
|
193
|
-
schema:
|
|
194
|
-
type: string
|
|
195
|
-
example: "salesforce"
|
|
196
|
-
responses:
|
|
197
|
-
"200":
|
|
198
|
-
description: Server details
|
|
199
|
-
content:
|
|
200
|
-
application/json:
|
|
201
|
-
schema:
|
|
202
|
-
$ref: "#/components/schemas/ServerDetail"
|
|
203
|
-
"401":
|
|
204
|
-
description: Unauthorized - invalid or missing JWT token
|
|
205
|
-
content:
|
|
206
|
-
application/json:
|
|
207
|
-
schema:
|
|
208
|
-
$ref: "#/components/schemas/Error"
|
|
209
|
-
"404":
|
|
210
|
-
description: Server not found
|
|
211
|
-
content:
|
|
212
|
-
application/json:
|
|
213
|
-
schema:
|
|
214
|
-
$ref: "#/components/schemas/Error"
|
|
215
|
-
"500":
|
|
216
|
-
description: Internal server error
|
|
217
|
-
content:
|
|
218
|
-
application/json:
|
|
219
|
-
schema:
|
|
220
|
-
$ref: "#/components/schemas/Error"
|
|
221
|
-
|
|
222
|
-
/servers/{server_id}/connect:
|
|
223
|
-
post:
|
|
224
|
-
summary: Initiate OAuth connection
|
|
225
|
-
description: |
|
|
226
|
-
Initiate OAuth connection flow for a server. Returns an authorization URL
|
|
227
|
-
that the user should visit to complete the OAuth flow.
|
|
228
|
-
|
|
229
|
-
The server must have OAuth configuration set up by an admin.
|
|
230
|
-
operationId: initiateConnection
|
|
231
|
-
parameters:
|
|
232
|
-
- name: server_id
|
|
233
|
-
in: path
|
|
234
|
-
required: true
|
|
235
|
-
description: Server UUID or slug
|
|
236
|
-
schema:
|
|
237
|
-
type: string
|
|
238
|
-
example: "salesforce"
|
|
239
|
-
- name: return_url
|
|
240
|
-
in: query
|
|
241
|
-
required: false
|
|
242
|
-
description: Optional return URL after OAuth completion
|
|
243
|
-
schema:
|
|
244
|
-
type: string
|
|
245
|
-
format: uri
|
|
246
|
-
example: "https://myapp.com/oauth/callback"
|
|
247
|
-
requestBody:
|
|
248
|
-
required: true
|
|
249
|
-
content:
|
|
250
|
-
application/json:
|
|
251
|
-
schema:
|
|
252
|
-
type: object
|
|
253
|
-
properties: {}
|
|
254
|
-
example: {}
|
|
255
|
-
responses:
|
|
256
|
-
"200":
|
|
257
|
-
description: Connection initiation successful
|
|
258
|
-
content:
|
|
259
|
-
application/json:
|
|
260
|
-
schema:
|
|
261
|
-
$ref: "#/components/schemas/ConnectionInitiationResponse"
|
|
262
|
-
"401":
|
|
263
|
-
description: Unauthorized - invalid or missing JWT token
|
|
264
|
-
content:
|
|
265
|
-
application/json:
|
|
266
|
-
schema:
|
|
267
|
-
$ref: "#/components/schemas/Error"
|
|
268
|
-
"404":
|
|
269
|
-
description: Server not found
|
|
270
|
-
content:
|
|
271
|
-
application/json:
|
|
272
|
-
schema:
|
|
273
|
-
$ref: "#/components/schemas/Error"
|
|
274
|
-
"500":
|
|
275
|
-
description: Server missing OAuth configuration or other error
|
|
276
|
-
content:
|
|
277
|
-
application/json:
|
|
278
|
-
schema:
|
|
279
|
-
$ref: "#/components/schemas/Error"
|
|
280
|
-
example:
|
|
281
|
-
error: "OAuthConfigurationError"
|
|
282
|
-
message: "Server is missing OAuth configuration. Ask an admin to configure credentials before initiating a connection."
|
|
283
|
-
|
|
284
|
-
/servers/{server_id}/connection:
|
|
285
|
-
get:
|
|
286
|
-
summary: Get connection status
|
|
287
|
-
description: |
|
|
288
|
-
Get the user's connection status for a specific server.
|
|
289
|
-
Used to poll connection status during OAuth flows.
|
|
290
|
-
operationId: getConnectionStatus
|
|
291
|
-
parameters:
|
|
292
|
-
- name: server_id
|
|
293
|
-
in: path
|
|
294
|
-
required: true
|
|
295
|
-
description: Server UUID or slug
|
|
296
|
-
schema:
|
|
297
|
-
type: string
|
|
298
|
-
example: "salesforce"
|
|
299
|
-
responses:
|
|
300
|
-
"200":
|
|
301
|
-
description: Connection status
|
|
302
|
-
content:
|
|
303
|
-
application/json:
|
|
304
|
-
schema:
|
|
305
|
-
$ref: "#/components/schemas/ConnectionStatusResponse"
|
|
306
|
-
"401":
|
|
307
|
-
description: Unauthorized - invalid or missing JWT token
|
|
308
|
-
content:
|
|
309
|
-
application/json:
|
|
310
|
-
schema:
|
|
311
|
-
$ref: "#/components/schemas/Error"
|
|
312
|
-
"404":
|
|
313
|
-
description: Server not found
|
|
314
|
-
content:
|
|
315
|
-
application/json:
|
|
316
|
-
schema:
|
|
317
|
-
$ref: "#/components/schemas/Error"
|
|
318
|
-
"500":
|
|
319
|
-
description: Internal server error
|
|
320
|
-
content:
|
|
321
|
-
application/json:
|
|
322
|
-
schema:
|
|
323
|
-
$ref: "#/components/schemas/Error"
|
|
324
|
-
|
|
325
|
-
delete:
|
|
326
|
-
summary: Delete connection
|
|
327
|
-
description: |
|
|
328
|
-
Delete the current user's connection to this server.
|
|
329
|
-
|
|
330
|
-
This will remove the connection record and clean up any stored OAuth credentials.
|
|
331
|
-
The user will need to reconnect to use this server again.
|
|
332
|
-
operationId: deleteConnection
|
|
333
|
-
parameters:
|
|
334
|
-
- name: server_id
|
|
335
|
-
in: path
|
|
336
|
-
required: true
|
|
337
|
-
description: Server UUID or slug
|
|
338
|
-
schema:
|
|
339
|
-
type: string
|
|
340
|
-
example: "salesforce"
|
|
341
|
-
responses:
|
|
342
|
-
"204":
|
|
343
|
-
description: Connection deleted successfully
|
|
344
|
-
"401":
|
|
345
|
-
description: Unauthorized - invalid or missing JWT token
|
|
346
|
-
content:
|
|
347
|
-
application/json:
|
|
348
|
-
schema:
|
|
349
|
-
$ref: "#/components/schemas/Error"
|
|
350
|
-
"404":
|
|
351
|
-
description: Connection not found
|
|
352
|
-
content:
|
|
353
|
-
application/json:
|
|
354
|
-
schema:
|
|
355
|
-
$ref: "#/components/schemas/Error"
|
|
356
|
-
"500":
|
|
357
|
-
description: Internal server error
|
|
358
|
-
content:
|
|
359
|
-
application/json:
|
|
360
|
-
schema:
|
|
361
|
-
$ref: "#/components/schemas/Error"
|
|
362
|
-
|
|
363
|
-
/mcp/{mcp_server_name}:
|
|
364
|
-
get:
|
|
365
|
-
summary: MCP server proxy endpoint
|
|
366
|
-
description: |
|
|
367
|
-
Proxies MCP JSON-RPC requests to third-party servers with automatic authentication.
|
|
368
|
-
|
|
369
|
-
This endpoint supports both regular HTTP requests and Server-Sent Events (SSE) streaming
|
|
370
|
-
for real-time MCP protocol communication.
|
|
371
|
-
|
|
372
|
-
## Usage
|
|
373
|
-
|
|
374
|
-
- **JSON-RPC**: Send MCP protocol requests as JSON
|
|
375
|
-
- **SSE Streaming**: Use `Accept: text/event-stream` for real-time communication
|
|
376
|
-
- **Session Management**: Include `x-mcp-session-id` header for session tracking
|
|
377
|
-
|
|
378
|
-
## Authentication Flow
|
|
379
|
-
|
|
380
|
-
1. User must first connect to the server via `/servers/{server_id}/connect`
|
|
381
|
-
2. Complete OAuth flow for the third-party service
|
|
382
|
-
3. Use this endpoint to proxy MCP requests with automatic credential injection
|
|
383
|
-
|
|
384
|
-
operationId: proxyMcpRequest
|
|
385
|
-
parameters:
|
|
386
|
-
- name: mcp_server_name
|
|
387
|
-
in: path
|
|
388
|
-
required: true
|
|
389
|
-
description: MCP server name identifier
|
|
390
|
-
schema:
|
|
391
|
-
type: string
|
|
392
|
-
pattern: "^[a-z0-9-]+$"
|
|
393
|
-
example: "salesforce"
|
|
394
|
-
- name: x-mcp-session-id
|
|
395
|
-
in: header
|
|
396
|
-
required: false
|
|
397
|
-
description: MCP session identifier for request tracking
|
|
398
|
-
schema:
|
|
399
|
-
type: string
|
|
400
|
-
example: "sess_1234567890abcdef"
|
|
401
|
-
requestBody:
|
|
402
|
-
required: false
|
|
403
|
-
description: MCP JSON-RPC request payload
|
|
404
|
-
content:
|
|
405
|
-
application/json:
|
|
406
|
-
schema:
|
|
407
|
-
type: object
|
|
408
|
-
description: MCP JSON-RPC 2.0 request
|
|
409
|
-
properties:
|
|
410
|
-
jsonrpc:
|
|
411
|
-
type: string
|
|
412
|
-
enum: ["2.0"]
|
|
413
|
-
description: JSON-RPC version
|
|
414
|
-
method:
|
|
415
|
-
type: string
|
|
416
|
-
description: MCP method name
|
|
417
|
-
example: "tools/list"
|
|
418
|
-
params:
|
|
419
|
-
type: object
|
|
420
|
-
description: Method parameters
|
|
421
|
-
additionalProperties: true
|
|
422
|
-
id:
|
|
423
|
-
oneOf:
|
|
424
|
-
- type: string
|
|
425
|
-
- type: number
|
|
426
|
-
description: Request identifier
|
|
427
|
-
required:
|
|
428
|
-
- jsonrpc
|
|
429
|
-
- method
|
|
430
|
-
example:
|
|
431
|
-
jsonrpc: "2.0"
|
|
432
|
-
method: "tools/list"
|
|
433
|
-
params: {}
|
|
434
|
-
id: 1
|
|
435
|
-
responses:
|
|
436
|
-
"200":
|
|
437
|
-
description: MCP response or SSE stream
|
|
438
|
-
content:
|
|
439
|
-
application/json:
|
|
440
|
-
schema:
|
|
441
|
-
type: object
|
|
442
|
-
description: MCP JSON-RPC 2.0 response
|
|
443
|
-
properties:
|
|
444
|
-
jsonrpc:
|
|
445
|
-
type: string
|
|
446
|
-
enum: ["2.0"]
|
|
447
|
-
result:
|
|
448
|
-
type: object
|
|
449
|
-
description: Method result
|
|
450
|
-
additionalProperties: true
|
|
451
|
-
error:
|
|
452
|
-
type: object
|
|
453
|
-
description: Error object if method failed
|
|
454
|
-
properties:
|
|
455
|
-
code:
|
|
456
|
-
type: integer
|
|
457
|
-
message:
|
|
458
|
-
type: string
|
|
459
|
-
data:
|
|
460
|
-
type: object
|
|
461
|
-
additionalProperties: true
|
|
462
|
-
id:
|
|
463
|
-
oneOf:
|
|
464
|
-
- type: string
|
|
465
|
-
- type: number
|
|
466
|
-
description: Request identifier
|
|
467
|
-
required:
|
|
468
|
-
- jsonrpc
|
|
469
|
-
- id
|
|
470
|
-
example:
|
|
471
|
-
jsonrpc: "2.0"
|
|
472
|
-
result:
|
|
473
|
-
tools:
|
|
474
|
-
- name: "get_accounts"
|
|
475
|
-
description: "Get Salesforce accounts"
|
|
476
|
-
parameters:
|
|
477
|
-
type: "object"
|
|
478
|
-
properties:
|
|
479
|
-
limit:
|
|
480
|
-
type: "integer"
|
|
481
|
-
description: "Maximum number of accounts"
|
|
482
|
-
id: 1
|
|
483
|
-
text/event-stream:
|
|
484
|
-
schema:
|
|
485
|
-
type: string
|
|
486
|
-
description: |
|
|
487
|
-
Server-Sent Events stream for real-time MCP communication.
|
|
488
|
-
|
|
489
|
-
Each event contains a JSON-RPC message with event metadata.
|
|
490
|
-
|
|
491
|
-
Example events:
|
|
492
|
-
```
|
|
493
|
-
data: {"jsonrpc": "2.0", "method": "notifications/initialized", "params": {}}
|
|
494
|
-
|
|
495
|
-
data: {"jsonrpc": "2.0", "result": {"tools": [...]}, "id": 1}
|
|
496
|
-
```
|
|
497
|
-
example: |
|
|
498
|
-
data: {"jsonrpc": "2.0", "method": "notifications/initialized", "params": {}}
|
|
499
|
-
|
|
500
|
-
data: {"jsonrpc": "2.0", "result": {"tools": []}, "id": 1}
|
|
501
|
-
"401":
|
|
502
|
-
description: Unauthorized - invalid or missing JWT token
|
|
503
|
-
content:
|
|
504
|
-
application/json:
|
|
505
|
-
schema:
|
|
506
|
-
$ref: "#/components/schemas/Error"
|
|
507
|
-
"403":
|
|
508
|
-
description: Forbidden - server not connected or access denied
|
|
509
|
-
content:
|
|
510
|
-
application/json:
|
|
511
|
-
schema:
|
|
512
|
-
$ref: "#/components/schemas/Error"
|
|
513
|
-
example:
|
|
514
|
-
error: "ServerNotConnected"
|
|
515
|
-
message: "Server 'salesforce' is not connected. Please initiate connection first."
|
|
516
|
-
"404":
|
|
517
|
-
description: Server not found
|
|
518
|
-
content:
|
|
519
|
-
application/json:
|
|
520
|
-
schema:
|
|
521
|
-
$ref: "#/components/schemas/Error"
|
|
522
|
-
"502":
|
|
523
|
-
description: Bad Gateway - upstream server error
|
|
524
|
-
content:
|
|
525
|
-
application/json:
|
|
526
|
-
schema:
|
|
527
|
-
$ref: "#/components/schemas/Error"
|
|
528
|
-
example:
|
|
529
|
-
error: "UpstreamError"
|
|
530
|
-
message: "Failed to connect to Salesforce API"
|
|
531
|
-
"500":
|
|
532
|
-
description: Internal server error
|
|
533
|
-
content:
|
|
534
|
-
application/json:
|
|
535
|
-
schema:
|
|
536
|
-
$ref: "#/components/schemas/Error"
|
|
537
|
-
|
|
538
|
-
/sse/{mcp_server_name}:
|
|
539
|
-
get:
|
|
540
|
-
summary: SSE server proxy endpoint
|
|
541
|
-
description: |
|
|
542
|
-
Server-Sent Events proxy endpoint for real-time streaming communication with third-party servers.
|
|
543
|
-
|
|
544
|
-
This endpoint provides dedicated SSE streaming capabilities separate from the MCP protocol,
|
|
545
|
-
allowing for custom event streaming and real-time data flows.
|
|
546
|
-
|
|
547
|
-
## Usage
|
|
548
|
-
|
|
549
|
-
- **SSE Streaming**: Optimized for `text/event-stream` communication
|
|
550
|
-
- **Real-time Events**: Custom event types and data streaming
|
|
551
|
-
- **Session Management**: Include `x-mcp-session-id` header for session tracking
|
|
552
|
-
|
|
553
|
-
## Authentication Flow
|
|
554
|
-
|
|
555
|
-
1. User must first connect to the server via `/servers/{server_id}/connect`
|
|
556
|
-
2. Complete OAuth flow for the third-party service
|
|
557
|
-
3. Use this endpoint for real-time event streaming with automatic credential injection
|
|
558
|
-
|
|
559
|
-
operationId: proxySSERequest
|
|
560
|
-
parameters:
|
|
561
|
-
- name: mcp_server_name
|
|
562
|
-
in: path
|
|
563
|
-
required: true
|
|
564
|
-
description: MCP server name identifier
|
|
565
|
-
schema:
|
|
566
|
-
type: string
|
|
567
|
-
pattern: "^[a-z0-9-]+$"
|
|
568
|
-
example: "salesforce"
|
|
569
|
-
- name: x-mcp-session-id
|
|
570
|
-
in: header
|
|
571
|
-
required: false
|
|
572
|
-
description: MCP session identifier for request tracking
|
|
573
|
-
schema:
|
|
574
|
-
type: string
|
|
575
|
-
example: "sess_1234567890abcdef"
|
|
576
|
-
requestBody:
|
|
577
|
-
required: false
|
|
578
|
-
description: Optional request payload for SSE initialization
|
|
579
|
-
content:
|
|
580
|
-
application/json:
|
|
581
|
-
schema:
|
|
582
|
-
type: object
|
|
583
|
-
description: SSE initialization parameters
|
|
584
|
-
properties:
|
|
585
|
-
event_types:
|
|
586
|
-
type: array
|
|
587
|
-
items:
|
|
588
|
-
type: string
|
|
589
|
-
description: Types of events to subscribe to
|
|
590
|
-
example: ["data_update", "status_change"]
|
|
591
|
-
filters:
|
|
592
|
-
type: object
|
|
593
|
-
description: Event filtering parameters
|
|
594
|
-
additionalProperties: true
|
|
595
|
-
example:
|
|
596
|
-
object_type: "Account"
|
|
597
|
-
limit: 100
|
|
598
|
-
example:
|
|
599
|
-
event_types: ["data_update", "status_change"]
|
|
600
|
-
filters:
|
|
601
|
-
object_type: "Account"
|
|
602
|
-
limit: 100
|
|
603
|
-
responses:
|
|
604
|
-
"200":
|
|
605
|
-
description: SSE event stream
|
|
606
|
-
content:
|
|
607
|
-
text/event-stream:
|
|
608
|
-
schema:
|
|
609
|
-
type: string
|
|
610
|
-
description: |
|
|
611
|
-
Server-Sent Events stream for real-time communication.
|
|
612
|
-
|
|
613
|
-
Events follow the SSE format with optional event types and data payloads.
|
|
614
|
-
|
|
615
|
-
Example events:
|
|
616
|
-
```
|
|
617
|
-
event: connected
|
|
618
|
-
data: {"status": "ready", "timestamp": "2024-01-01T00:00:00Z"}
|
|
619
|
-
|
|
620
|
-
event: data_update
|
|
621
|
-
data: {"type": "Account", "id": "123", "changes": {...}}
|
|
622
|
-
|
|
623
|
-
event: error
|
|
624
|
-
data: {"error": "rate_limit", "message": "Rate limit exceeded"}
|
|
625
|
-
```
|
|
626
|
-
example: |
|
|
627
|
-
event: connected
|
|
628
|
-
data: {"status": "ready", "timestamp": "2024-01-01T00:00:00Z"}
|
|
629
|
-
|
|
630
|
-
event: data_update
|
|
631
|
-
data: {"type": "Account", "id": "123", "name": "Acme Corp"}
|
|
632
|
-
|
|
633
|
-
event: status_change
|
|
634
|
-
data: {"status": "disconnected", "reason": "timeout"}
|
|
635
|
-
application/json:
|
|
636
|
-
schema:
|
|
637
|
-
type: object
|
|
638
|
-
description: Fallback JSON response if SSE not supported
|
|
639
|
-
properties:
|
|
640
|
-
status:
|
|
641
|
-
type: string
|
|
642
|
-
example: "streaming_not_supported"
|
|
643
|
-
message:
|
|
644
|
-
type: string
|
|
645
|
-
example: "Client does not support SSE, use /mcp endpoint instead"
|
|
646
|
-
"401":
|
|
647
|
-
description: Unauthorized - invalid or missing JWT token
|
|
648
|
-
content:
|
|
649
|
-
application/json:
|
|
650
|
-
schema:
|
|
651
|
-
$ref: "#/components/schemas/Error"
|
|
652
|
-
"403":
|
|
653
|
-
description: Forbidden - server not connected or access denied
|
|
654
|
-
content:
|
|
655
|
-
application/json:
|
|
656
|
-
schema:
|
|
657
|
-
$ref: "#/components/schemas/Error"
|
|
658
|
-
example:
|
|
659
|
-
error: "ServerNotConnected"
|
|
660
|
-
message: "Server 'salesforce' is not connected. Please initiate connection first."
|
|
661
|
-
"404":
|
|
662
|
-
description: Server not found
|
|
663
|
-
content:
|
|
664
|
-
application/json:
|
|
665
|
-
schema:
|
|
666
|
-
$ref: "#/components/schemas/Error"
|
|
667
|
-
"502":
|
|
668
|
-
description: Bad Gateway - upstream server error
|
|
669
|
-
content:
|
|
670
|
-
application/json:
|
|
671
|
-
schema:
|
|
672
|
-
$ref: "#/components/schemas/Error"
|
|
673
|
-
example:
|
|
674
|
-
error: "UpstreamError"
|
|
675
|
-
message: "Failed to connect to Salesforce streaming API"
|
|
676
|
-
"500":
|
|
677
|
-
description: Internal server error
|
|
678
|
-
content:
|
|
679
|
-
application/json:
|
|
680
|
-
schema:
|
|
681
|
-
$ref: "#/components/schemas/Error"
|