-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-stateless.mjs
More file actions
37 lines (29 loc) · 917 Bytes
/
example-stateless.mjs
File metadata and controls
37 lines (29 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { RemoteServer } from './src/index.mjs'
import { SchemaImporter } from 'schemaimporter'
import { FlowMCP } from 'flowmcp'
const arrayOfSchemas = await SchemaImporter
.loadFromFolder( {
excludeSchemasWithImports: true,
excludeSchemasWithRequiredServerParams: true,
addAdditionalMetaData: true,
outputType: 'onlySchema'
} )
// Define routes with their configuration
const arrayOfRoutes = [
{
routePath: '/stateless',
protocol: 'streamable'
}
]
// Pre-assign schemas to routes
const objectOfSchemaArrays = {
'/stateless': arrayOfSchemas
}
const remoteServer = new RemoteServer( { silent: true } )
// Prepare route activation payloads
const { routesActivationPayloads } = RemoteServer.prepareRoutesActivationPayloads( {
arrayOfRoutes,
objectOfSchemaArrays,
envObject: {}
} )
remoteServer.start( { routesActivationPayloads } )