@interopio/mcp-http 0.1.0-beta.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.
- package/dist/common/constants.d.ts +4 -0
- package/dist/factory.d.ts +2 -0
- package/dist/index.cjs +71928 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +71970 -0
- package/dist/main/schemas.d.ts +48 -0
- package/dist/main/server.d.ts +15 -0
- package/dist/shared/logger.d.ts +8 -0
- package/dist/shared/types.d.ts +16 -0
- package/mcp-http.d.ts +84 -0
- package/package.json +49 -0
- package/readme.md +613 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ServerOptionsSchema: z.ZodObject<{
|
|
3
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
4
|
+
origin: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
5
|
+
exposedHeaders: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
6
|
+
allowedHeaders: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
configureServer: z.ZodOptional<z.ZodAny>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
port?: number | undefined;
|
|
10
|
+
origin?: string | string[] | undefined;
|
|
11
|
+
exposedHeaders?: string[] | undefined;
|
|
12
|
+
allowedHeaders?: string[] | undefined;
|
|
13
|
+
configureServer?: any;
|
|
14
|
+
}, {
|
|
15
|
+
port?: number | undefined;
|
|
16
|
+
origin?: string | string[] | undefined;
|
|
17
|
+
exposedHeaders?: string[] | undefined;
|
|
18
|
+
allowedHeaders?: string[] | undefined;
|
|
19
|
+
configureServer?: any;
|
|
20
|
+
}>;
|
|
21
|
+
export declare const TransportOptionsSchema: z.ZodObject<{
|
|
22
|
+
sessionIdGenerator: z.ZodOptional<z.ZodAny>;
|
|
23
|
+
onsessioninitialized: z.ZodOptional<z.ZodAny>;
|
|
24
|
+
onsessionclosed: z.ZodOptional<z.ZodAny>;
|
|
25
|
+
enableJsonResponse: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
eventStore: z.ZodOptional<z.ZodAny>;
|
|
27
|
+
allowedHosts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
28
|
+
allowedOrigins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
29
|
+
enableDnsRebindingProtection: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
sessionIdGenerator?: any;
|
|
32
|
+
onsessioninitialized?: any;
|
|
33
|
+
onsessionclosed?: any;
|
|
34
|
+
enableJsonResponse?: boolean | undefined;
|
|
35
|
+
eventStore?: any;
|
|
36
|
+
allowedHosts?: string[] | undefined;
|
|
37
|
+
allowedOrigins?: string[] | undefined;
|
|
38
|
+
enableDnsRebindingProtection?: boolean | undefined;
|
|
39
|
+
}, {
|
|
40
|
+
sessionIdGenerator?: any;
|
|
41
|
+
onsessioninitialized?: any;
|
|
42
|
+
onsessionclosed?: any;
|
|
43
|
+
enableJsonResponse?: boolean | undefined;
|
|
44
|
+
eventStore?: any;
|
|
45
|
+
allowedHosts?: string[] | undefined;
|
|
46
|
+
allowedOrigins?: string[] | undefined;
|
|
47
|
+
enableDnsRebindingProtection?: boolean | undefined;
|
|
48
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ConnectOptions } from "../shared/types";
|
|
2
|
+
export declare class MCPHttpServer {
|
|
3
|
+
private readonly options;
|
|
4
|
+
private readonly transports;
|
|
5
|
+
private readonly transportFactory;
|
|
6
|
+
private readonly mcp;
|
|
7
|
+
constructor(options: ConnectOptions);
|
|
8
|
+
private get logger();
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
private configureMiddleware;
|
|
11
|
+
private handleNewInitializationRequest;
|
|
12
|
+
private handleGet;
|
|
13
|
+
private handleDelete;
|
|
14
|
+
private handlePost;
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StreamableHTTPServerTransport, StreamableHTTPServerTransportOptions } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
3
|
+
import { IoIntelMCPHttp } from "../../mcp-http";
|
|
4
|
+
type MyOmit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
5
|
+
export type WithRequired<T, K extends keyof T> = MyOmit<T, K> & Required<Pick<T, K>>;
|
|
6
|
+
export interface ParsedConfig {
|
|
7
|
+
transportOptions: IoIntelMCPHttp.HTTPTransportOptions;
|
|
8
|
+
server: WithRequired<IoIntelMCPHttp.ServerOptions, "port" | "origin" | "exposedHeaders" | "allowedHeaders">;
|
|
9
|
+
}
|
|
10
|
+
export interface ConnectOptions {
|
|
11
|
+
mcp: McpServer;
|
|
12
|
+
httpTransportFactory: (config: StreamableHTTPServerTransportOptions) => StreamableHTTPServerTransport;
|
|
13
|
+
transportOptions?: IoIntelMCPHttp.HTTPTransportOptions;
|
|
14
|
+
server?: ParsedConfig["server"];
|
|
15
|
+
}
|
|
16
|
+
export {};
|
package/mcp-http.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { IOConnectDesktop } from "@interopio/desktop";
|
|
2
|
+
import { IoIntelMCPCore } from "@interopio/mcp-core";
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { Application } from "express";
|
|
5
|
+
|
|
6
|
+
export namespace IoIntelMCPHttp {
|
|
7
|
+
|
|
8
|
+
export interface ServerOptions {
|
|
9
|
+
port?: number;
|
|
10
|
+
origin?: string | string[];
|
|
11
|
+
exposedHeaders?: string[];
|
|
12
|
+
allowedHeaders?: string[];
|
|
13
|
+
configureServer?: (app: Application) => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface HTTPTransportOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Function that generates a session ID for the transport.
|
|
19
|
+
* The session ID SHOULD be globally unique and cryptographically secure (e.g., a securely generated UUID, a JWT, or a cryptographic hash)
|
|
20
|
+
*
|
|
21
|
+
* Return undefined to disable session management.
|
|
22
|
+
*/
|
|
23
|
+
sessionIdGenerator?: (() => string) | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* A callback for session initialization events
|
|
26
|
+
* This is called when the server initializes a new session.
|
|
27
|
+
* Useful in cases when you need to register multiple mcp sessions
|
|
28
|
+
* and need to keep track of them.
|
|
29
|
+
* @param sessionId The generated session ID
|
|
30
|
+
*/
|
|
31
|
+
onsessioninitialized?: (sessionId: string) => void | Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* A callback for session close events
|
|
34
|
+
* This is called when the server closes a session due to a DELETE request.
|
|
35
|
+
* Useful in cases when you need to clean up resources associated with the session.
|
|
36
|
+
* Note that this is different from the transport closing, if you are handling
|
|
37
|
+
* HTTP requests from multiple nodes you might want to close each
|
|
38
|
+
* StreamableHTTPServerTransport after a request is completed while still keeping the
|
|
39
|
+
* session open/running.
|
|
40
|
+
* @param sessionId The session ID that was closed
|
|
41
|
+
*/
|
|
42
|
+
onsessionclosed?: (sessionId: string) => void | Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* If true, the server will return JSON responses instead of starting an SSE stream.
|
|
45
|
+
* This can be useful for simple request/response scenarios without streaming.
|
|
46
|
+
* Default is false (SSE streams are preferred).
|
|
47
|
+
*/
|
|
48
|
+
enableJsonResponse?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Event store for resumability support
|
|
51
|
+
* If provided, resumability will be enabled, allowing clients to reconnect and resume messages
|
|
52
|
+
*/
|
|
53
|
+
eventStore?: EventStore;
|
|
54
|
+
/**
|
|
55
|
+
* List of allowed host header values for DNS rebinding protection.
|
|
56
|
+
* If not specified, host validation is disabled.
|
|
57
|
+
*/
|
|
58
|
+
allowedHosts?: string[];
|
|
59
|
+
/**
|
|
60
|
+
* List of allowed origin header values for DNS rebinding protection.
|
|
61
|
+
* If not specified, origin validation is disabled.
|
|
62
|
+
*/
|
|
63
|
+
allowedOrigins?: string[];
|
|
64
|
+
/**
|
|
65
|
+
* Enable DNS rebinding protection (requires allowedHosts and/or allowedOrigins to be configured).
|
|
66
|
+
* Default is false for backwards compatibility.
|
|
67
|
+
*/
|
|
68
|
+
enableDnsRebindingProtection?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface Config {
|
|
72
|
+
licenseKey: string;
|
|
73
|
+
transportOptions?: HTTPTransportOptions;
|
|
74
|
+
server?: ServerOptions;
|
|
75
|
+
mcpCoreServer?: Omit<IoIntelMCPCore.McpServerConfig, "name" | "title">;
|
|
76
|
+
mcpWorkingContext?: IoIntelMCPCore.WorkingContextConfig;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type IoIntelMCPHttpFactoryFunction = (io: IOConnectDesktop.API, config: IoIntelMCPHttp.Config) => Promise<void>;
|
|
81
|
+
|
|
82
|
+
declare const IoIntelMCPHttpFactory: IoIntelMCPHttpFactoryFunction;
|
|
83
|
+
|
|
84
|
+
export default IoIntelMCPHttpFactory;
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@interopio/mcp-http",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Node.js Express server with TypeScript and Rollup bundling",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./mcp-http.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./mcp-http.d.ts",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"import": "./dist/index.mjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "rollup --config rollup.config-prebuild.js && rollup --config rollup.config-cjs.js && rollup --config rollup.config-esm.js"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@interopio/desktop": "^6.0.0",
|
|
21
|
+
"@interopio/mcp-core": "^0.1.0-beta.0",
|
|
22
|
+
"@modelcontextprotocol/sdk": "^1.19.1",
|
|
23
|
+
"express": "^5.1.0"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"ai",
|
|
27
|
+
"llm",
|
|
28
|
+
"agentic",
|
|
29
|
+
"copilot",
|
|
30
|
+
"assistant",
|
|
31
|
+
"io.Intelligence",
|
|
32
|
+
"io.connect",
|
|
33
|
+
"interop.io",
|
|
34
|
+
"io.connect browser",
|
|
35
|
+
"io.connect desktop",
|
|
36
|
+
"io.connect browser platform"
|
|
37
|
+
],
|
|
38
|
+
"homepage": "https://interop.io/",
|
|
39
|
+
"author": {
|
|
40
|
+
"name": "Interop.IO",
|
|
41
|
+
"url": "https://interop.io/"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"@interopio:registry": "https://registry.npmjs.org",
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"gitHead": "c854d0327acdf587d4222a0c71f7a8869bbe4d22"
|
|
49
|
+
}
|