@karashiiro/mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <https://unlicense.org>
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # mcp
2
+
3
+ (WIP) MCP utilities in TypeScript
@@ -0,0 +1,15 @@
1
+ import type { EventStore } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
2
+ import type { JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
3
+ /**
4
+ * In-memory event store for SSE resumability.
5
+ * Stores events in memory and allows replaying them from a specific point.
6
+ * Note: Events are lost on restart.
7
+ */
8
+ export declare class InMemoryEventStore implements EventStore {
9
+ private events;
10
+ storeEvent(streamId: string, message: JSONRPCMessage): Promise<string>;
11
+ replayEventsAfter(lastEventId: string, { send }: {
12
+ send: (eventId: string, message: JSONRPCMessage) => Promise<void>;
13
+ }): Promise<string>;
14
+ }
15
+ //# sourceMappingURL=event-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-store.d.ts","sourceRoot":"","sources":["../src/event-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+DAA+D,CAAC;AAChG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;GAIG;AACH,qBAAa,kBAAmB,YAAW,UAAU;IACnD,OAAO,CAAC,MAAM,CAGV;IAEE,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAI3E;IAEK,iBAAiB,CACrB,WAAW,EAAE,MAAM,EACnB,EACE,IAAI,EACL,EAAE;QAAE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,GACvE,OAAO,CAAC,MAAM,CAAC,CA2BjB;CACF"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * In-memory event store for SSE resumability.
3
+ * Stores events in memory and allows replaying them from a specific point.
4
+ * Note: Events are lost on restart.
5
+ */
6
+ export class InMemoryEventStore {
7
+ events = new Map();
8
+ async storeEvent(streamId, message) {
9
+ const eventId = `${streamId}_${Date.now()}_${Math.random().toString(36).slice(2)}`;
10
+ this.events.set(eventId, { streamId, message });
11
+ return eventId;
12
+ }
13
+ async replayEventsAfter(lastEventId, { send, }) {
14
+ const lastEvent = this.events.get(lastEventId);
15
+ if (!lastEvent) {
16
+ return lastEventId;
17
+ }
18
+ const streamId = lastEvent.streamId;
19
+ // Get all events for this stream, sorted by their ID (which contains timestamp)
20
+ const streamEvents = Array.from(this.events.entries())
21
+ .filter(([, event]) => event.streamId === streamId)
22
+ .sort(([a], [b]) => a.localeCompare(b));
23
+ // Find the index of the last event and replay everything after it
24
+ const lastIndex = streamEvents.findIndex(([id]) => id === lastEventId);
25
+ if (lastIndex === -1) {
26
+ return lastEventId;
27
+ }
28
+ let lastReplayedId = lastEventId;
29
+ for (let i = lastIndex + 1; i < streamEvents.length; i++) {
30
+ const [eventId, event] = streamEvents[i];
31
+ await send(eventId, event.message);
32
+ lastReplayedId = eventId;
33
+ }
34
+ return lastReplayedId;
35
+ }
36
+ }
37
+ //# sourceMappingURL=event-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-store.js","sourceRoot":"","sources":["../src/event-store.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IACrB,MAAM,GAAG,IAAI,GAAG,EAGrB,CAAC;IAEJ,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,OAAuB,EAAmB;QAC3E,MAAM,OAAO,GAAG,GAAG,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC;IAAA,CAChB;IAED,KAAK,CAAC,iBAAiB,CACrB,WAAmB,EACnB,EACE,IAAI,GACkE,EACvD;QACjB,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;QAEpC,gFAAgF;QAChF,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;aACnD,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC;aAClD,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QAE1C,kEAAkE;QAClE,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC;QACvE,IAAI,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;YACrB,OAAO,WAAW,CAAC;QACrB,CAAC;QAED,IAAI,cAAc,GAAG,WAAW,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzD,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,YAAY,CAAC,CAAC,CAAE,CAAC;YAC1C,MAAM,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACnC,cAAc,GAAG,OAAO,CAAC;QAC3B,CAAC;QAED,OAAO,cAAc,CAAC;IAAA,CACvB;CACF"}
@@ -0,0 +1,29 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export interface HttpServerSessionOptions {
3
+ sessionIdGenerator?: () => string;
4
+ }
5
+ export interface HttpServerOptions {
6
+ port: number;
7
+ host: string;
8
+ endpoint: string;
9
+ sessions?: HttpServerSessionOptions | undefined;
10
+ }
11
+ /**
12
+ * Handle returned by serveHttp for controlling the server lifecycle.
13
+ */
14
+ export interface HttpServerHandle {
15
+ /** Close the HTTP server and stop accepting new connections. */
16
+ close: () => Promise<void>;
17
+ }
18
+ /**
19
+ * Serve an MCP server over HTTP.
20
+ *
21
+ * @param serverFactory - Factory function that creates McpServer instances.
22
+ * In stateless mode, called once. In stateful mode, called per session.
23
+ * @param options - Server configuration options.
24
+ * If `sessions` is provided, runs in stateful mode with per-session servers.
25
+ * If `sessions` is undefined, runs in stateless mode with a single server.
26
+ * @returns A handle to control the server lifecycle.
27
+ */
28
+ export declare function serveHttp(serverFactory: () => McpServer, options?: Partial<HttpServerOptions>): Promise<HttpServerHandle>;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQzE,MAAM,WAAW,wBAAwB;IACvC,kBAAkB,CAAC,EAAE,MAAM,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAiCD;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,aAAa,EAAE,MAAM,SAAS,EAC9B,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM,GACvC,OAAO,CAAC,gBAAgB,CAAC,CAW3B"}
package/dist/index.js ADDED
@@ -0,0 +1,152 @@
1
+ import { serve } from "@hono/node-server";
2
+ import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
3
+ import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
4
+ import { Hono } from "hono";
5
+ import { cors } from "hono/cors";
6
+ import { v4 as uuidv4 } from "uuid";
7
+ import { InMemoryEventStore } from "./event-store.js";
8
+ const defaultOptions = Object.freeze({
9
+ port: 8080,
10
+ host: "127.0.0.1",
11
+ endpoint: "/mcp",
12
+ sessions: undefined,
13
+ });
14
+ /**
15
+ * Helper to create a closeable handle from a node server.
16
+ */
17
+ function createHandle(server) {
18
+ return {
19
+ close: () => new Promise((resolve, reject) => {
20
+ server.close((err) => {
21
+ if (err)
22
+ reject(err);
23
+ else
24
+ resolve();
25
+ });
26
+ }),
27
+ };
28
+ }
29
+ /**
30
+ * Serve an MCP server over HTTP.
31
+ *
32
+ * @param serverFactory - Factory function that creates McpServer instances.
33
+ * In stateless mode, called once. In stateful mode, called per session.
34
+ * @param options - Server configuration options.
35
+ * If `sessions` is provided, runs in stateful mode with per-session servers.
36
+ * If `sessions` is undefined, runs in stateless mode with a single server.
37
+ * @returns A handle to control the server lifecycle.
38
+ */
39
+ export async function serveHttp(serverFactory, options = {}) {
40
+ const mergedOptions = {
41
+ ...defaultOptions,
42
+ ...options,
43
+ };
44
+ if (mergedOptions.sessions) {
45
+ return serveHttpStateful(serverFactory, mergedOptions);
46
+ }
47
+ else {
48
+ return serveHttpStateless(serverFactory, mergedOptions);
49
+ }
50
+ }
51
+ /**
52
+ * Stateless mode: single server instance, single transport, no session tracking.
53
+ */
54
+ async function serveHttpStateless(serverFactory, options) {
55
+ // Call factory ONCE to get the single server instance
56
+ const server = serverFactory();
57
+ // Create the transport (no session ID generator = stateless)
58
+ const transport = new WebStandardStreamableHTTPServerTransport({
59
+ sessionIdGenerator: undefined,
60
+ });
61
+ // Create the Hono app
62
+ const app = new Hono();
63
+ addCors(app);
64
+ // MCP endpoint
65
+ app.all(options.endpoint, (c) => transport.handleRequest(c.req.raw));
66
+ await server.connect(transport);
67
+ const httpServer = serve({
68
+ fetch: app.fetch,
69
+ port: options.port,
70
+ hostname: options.host,
71
+ });
72
+ return createHandle(httpServer);
73
+ }
74
+ /**
75
+ * Stateful mode: per-session servers, transports, and event stores.
76
+ */
77
+ function serveHttpStateful(serverFactory, options) {
78
+ const sessions = new Map();
79
+ const sessionIdGenerator = options.sessions?.sessionIdGenerator ?? uuidv4;
80
+ const app = new Hono();
81
+ addCors(app);
82
+ app.all(options.endpoint, async (c) => {
83
+ const sessionId = c.req.header("mcp-session-id");
84
+ // Clone the request so we can read the body without consuming it
85
+ const rawRequest = c.req.raw;
86
+ const bodyText = await rawRequest.text();
87
+ let body = null;
88
+ try {
89
+ body = bodyText ? JSON.parse(bodyText) : null;
90
+ }
91
+ catch {
92
+ // Invalid JSON - body stays null
93
+ }
94
+ // Helper to recreate request with body (since we consumed it)
95
+ const recreateRequest = () => new Request(rawRequest.url, {
96
+ method: rawRequest.method,
97
+ headers: rawRequest.headers,
98
+ body: bodyText || undefined,
99
+ });
100
+ // New session (initialize request without session ID)
101
+ if (!sessionId && body && isInitializeRequest(body)) {
102
+ const eventStore = new InMemoryEventStore();
103
+ const transport = new WebStandardStreamableHTTPServerTransport({
104
+ sessionIdGenerator,
105
+ eventStore,
106
+ onsessioninitialized: (sid) => {
107
+ // Factory called per session!
108
+ const server = serverFactory();
109
+ sessions.set(sid, { transport, server, eventStore });
110
+ server.connect(transport);
111
+ },
112
+ });
113
+ transport.onclose = () => {
114
+ if (transport.sessionId) {
115
+ sessions.delete(transport.sessionId);
116
+ }
117
+ };
118
+ return transport.handleRequest(recreateRequest());
119
+ }
120
+ // Existing session
121
+ if (sessionId) {
122
+ const session = sessions.get(sessionId);
123
+ if (!session) {
124
+ return c.text("Session not found", 404);
125
+ }
126
+ return session.transport.handleRequest(recreateRequest());
127
+ }
128
+ // Invalid request (no session ID, not an initialize request)
129
+ return c.text("Bad request - missing session ID", 400);
130
+ });
131
+ const httpServer = serve({
132
+ fetch: app.fetch,
133
+ port: options.port,
134
+ hostname: options.host,
135
+ });
136
+ return createHandle(httpServer);
137
+ }
138
+ function addCors(app) {
139
+ // Enable CORS for all origins
140
+ app.use("*", cors({
141
+ origin: "*",
142
+ allowMethods: ["GET", "POST", "DELETE", "OPTIONS"],
143
+ allowHeaders: [
144
+ "Content-Type",
145
+ "mcp-session-id",
146
+ "Last-Event-ID",
147
+ "mcp-protocol-version",
148
+ ],
149
+ exposeHeaders: ["mcp-session-id", "mcp-protocol-version"],
150
+ }));
151
+ }
152
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAmB,MAAM,mBAAmB,CAAC;AAE3D,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAC;AACzH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAqBtD,MAAM,cAAc,GAAsB,MAAM,CAAC,MAAM,CAAC;IACtD,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,SAAS;CACpB,CAAC,CAAC;AAWH;;GAEG;AACH,SAAS,YAAY,CAAC,MAAkB,EAAoB;IAC1D,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CACV,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAW,EAAE,EAAE,CAAC;gBAC5B,IAAI,GAAG;oBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;oBAChB,OAAO,EAAE,CAAC;YAAA,CAChB,CAAC,CAAC;QAAA,CACJ,CAAC;KACL,CAAC;AAAA,CACH;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,aAA8B,EAC9B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E,QAAQ,EAAE,SAAS,CAAC;QAClD,YAAY,EAAE;YACZ,cAAc;YACd,gBAAgB;YAChB,eAAe;YACf,sBAAsB;SACvB;QACD,aAAa,EAAE,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;KAC1D,CAAC,CACH,CAAC;AAAA,CACH"}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@karashiiro/mcp",
3
+ "version": "0.1.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "UNLICENSED",
13
+ "devDependencies": {
14
+ "@eslint/js": "^9.39.2",
15
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
16
+ "eslint": "^9.39.2",
17
+ "get-port": "^7.1.0",
18
+ "globals": "^17.0.0",
19
+ "jiti": "^2.6.1",
20
+ "prettier": "^3.7.4",
21
+ "typescript-eslint": "^8.53.0",
22
+ "vitest": "^4.0.17"
23
+ },
24
+ "dependencies": {
25
+ "@hono/node-server": "^1.19.8",
26
+ "@modelcontextprotocol/sdk": "^1.25.2",
27
+ "hono": "^4.11.4",
28
+ "uuid": "^13.0.0",
29
+ "zod": "^4.3.5"
30
+ },
31
+ "scripts": {
32
+ "build": "tsgo -p tsconfig.dist.json",
33
+ "test": "vitest",
34
+ "lint": "eslint . --ext .ts",
35
+ "format": "prettier --write ."
36
+ }
37
+ }