@rekog/mcp-nest 1.7.0-alpha.2 → 1.7.0-alpha.3
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/authz/providers/github.provider.d.ts.map +1 -1
- package/dist/authz/providers/github.provider.js +2 -2
- package/dist/authz/providers/github.provider.js.map +1 -1
- package/dist/mcp/transport/sse.controller.factory.js +2 -2
- package/dist/mcp/transport/sse.controller.factory.js.map +1 -1
- package/package.json +2 -1
- package/src/authz/providers/github.provider.ts +4 -4
- package/src/mcp/transport/sse.controller.factory.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.provider.d.ts","sourceRoot":"","sources":["../../../src/authz/providers/github.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"github.provider.d.ts","sourceRoot":"","sources":["../../../src/authz/providers/github.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAMjE,eAAO,MAAM,mBAAmB,EAAE,mBAiBjC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.GitHubOAuthProvider = void 0;
|
|
4
|
+
const passport_github_1 = require("passport-github");
|
|
4
5
|
exports.GitHubOAuthProvider = {
|
|
5
6
|
name: 'github',
|
|
6
|
-
|
|
7
|
-
strategy: require('passport-github').Strategy,
|
|
7
|
+
strategy: passport_github_1.Strategy,
|
|
8
8
|
strategyOptions: ({ serverUrl, clientId, clientSecret }) => ({
|
|
9
9
|
clientID: clientId,
|
|
10
10
|
clientSecret: clientSecret,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.provider.js","sourceRoot":"","sources":["../../../src/authz/providers/github.provider.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"github.provider.js","sourceRoot":"","sources":["../../../src/authz/providers/github.provider.ts"],"names":[],"mappings":";;;AACA,qDAA2C;AAK9B,QAAA,mBAAmB,GAAwB;IACtD,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,0BAAQ;IAClB,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;QAC3D,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,YAAY;QAC1B,WAAW,EAAE,GAAG,SAAS,gBAAgB;KAC1C,CAAC;IACF,KAAK,EAAE,CAAC,YAAY,CAAC;IACrB,aAAa,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC3B,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,KAAK;QAC3C,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK;QACjC,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI;QAChD,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,OAAO,CAAC,UAAU;QAC3D,GAAG,EAAE,OAAO;KACb,CAAC;CACH,CAAC","sourcesContent":["import { OAuthProviderConfig } from './oauth-provider.interface';\nimport { Strategy } from 'passport-github';\n\n// Note: You'll need to install passport-github\n// npm install passport-github @types/passport-github\n\nexport const GitHubOAuthProvider: OAuthProviderConfig = {\n name: 'github',\n strategy: Strategy,\n strategyOptions: ({ serverUrl, clientId, clientSecret }) => ({\n clientID: clientId,\n clientSecret: clientSecret,\n callbackURL: `${serverUrl}/auth/callback`,\n }),\n scope: ['user:email'],\n profileMapper: (profile) => ({\n id: profile.id,\n username: profile.username || profile.login,\n email: profile.emails?.[0]?.value,\n displayName: profile.displayName || profile.name,\n avatarUrl: profile.photos?.[0]?.value || profile.avatar_url,\n raw: profile,\n }),\n};\n"]}
|
|
@@ -78,7 +78,7 @@ function createSseController(sseEndpoint, messagesEndpoint, apiPrefix, guards =
|
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
__decorate([
|
|
81
|
-
(0, common_1.Get)(sseEndpoint),
|
|
81
|
+
(0, common_1.Get)((0, normalize_endpoint_1.normalizeEndpoint)(`${apiPrefix}/${sseEndpoint}`)),
|
|
82
82
|
(0, common_1.UseGuards)(...guards),
|
|
83
83
|
__param(0, (0, common_1.Res)()),
|
|
84
84
|
__metadata("design:type", Function),
|
|
@@ -86,7 +86,7 @@ function createSseController(sseEndpoint, messagesEndpoint, apiPrefix, guards =
|
|
|
86
86
|
__metadata("design:returntype", Promise)
|
|
87
87
|
], SseController.prototype, "sse", null);
|
|
88
88
|
__decorate([
|
|
89
|
-
(0, common_1.Post)(messagesEndpoint),
|
|
89
|
+
(0, common_1.Post)((0, normalize_endpoint_1.normalizeEndpoint)(`${apiPrefix}/${messagesEndpoint}`)),
|
|
90
90
|
(0, common_1.UseGuards)(...guards),
|
|
91
91
|
__param(0, (0, common_1.Req)()),
|
|
92
92
|
__param(1, (0, common_1.Res)()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.controller.factory.js","sourceRoot":"","sources":["../../../src/mcp/transport/sse.controller.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AA+BA,kDA+HC;AA9JD,2CAewB;AACxB,uCAA8E;AAG9E,oEAAoE;AACpE,oEAA6E;AAC7E,wEAAqE;AAErE,2EAAsE;AACtE,2EAAsE;AACtE,mEAA8D;AAC9D,oEAAgE;AAKhE,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,gBAAwB,EACxB,SAAiB,EACjB,SAA8B,EAAE,EAChC,aAA+B,EAAE;;IAEjC,IAIM,aAAa,qBAJnB,MAIM,aAAa;QAUjB,YACyB,OAAmC,EACjC,WAAmC,EAC5C,iBAAoC,EACpC,SAAoB,EACpB,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C,CAAC;YACrD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAC3C,yCAAkB,EAClB,SAAS,CACV,CAAC;YAGF,QAAQ,CAAC,uBAAuB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YAGjD,MAAM,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACpD,CAAC;KACF,CAAA;IA9EO;QAFL,IAAA,YAAG,EAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"sse.controller.factory.js","sourceRoot":"","sources":["../../../src/mcp/transport/sse.controller.factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AA+BA,kDA+HC;AA9JD,2CAewB;AACxB,uCAA8E;AAG9E,oEAAoE;AACpE,oEAA6E;AAC7E,wEAAqE;AAErE,2EAAsE;AACtE,2EAAsE;AACtE,mEAA8D;AAC9D,oEAAgE;AAKhE,SAAgB,mBAAmB,CACjC,WAAmB,EACnB,gBAAwB,EACxB,SAAiB,EACjB,SAA8B,EAAE,EAChC,aAA+B,EAAE;;IAEjC,IAIM,aAAa,qBAJnB,MAIM,aAAa;QAUjB,YACyB,OAAmC,EACjC,WAAmC,EAC5C,iBAAoC,EACpC,SAAoB,EACpB,YAAgC,EACxB,WAA2C;YAL5B,YAAO,GAAP,OAAO,CAAY;YACjB,gBAAW,GAAX,WAAW,CAAQ;YAC5C,sBAAiB,GAAjB,iBAAiB,CAAmB;YACpC,cAAS,GAAT,SAAS,CAAW;YACpB,iBAAY,GAAZ,YAAY,CAAoB;YACR,gBAAW,GAAX,WAAW,CAAgB;YAf5D,WAAM,GAAG,IAAI,eAAM,CAAC,eAAa,CAAC,IAAI,CAAC,CAAC;YAK1C,eAAU,GAAG,IAAI,GAAG,EAA8B,CAAC;YAEnD,eAAU,GAAG,IAAI,GAAG,EAAqB,CAAC;QAS9C,CAAC;QAKJ,YAAY;YAEV,IAAI,CAAC,WAAW,CAAC,SAAS,C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AAE,CAAA;;;;4CAyCf;IAOK;QAFL,IAAA,aAAI,EAAC,IAAA,sCAAiB,EAAC,GAAG,SAAS,IAAI,gBAAgB,EAAE,CAAC,CAAC;QAC3D,IAAA,kBAAS,EAAC,GAAG,MAAM,CAAC;QAElB,WAAA,IAAA,YAAG,GAAE,CAAA;QACL,WAAA,IAAA,YAAG,GAAE,CAAA;QACL,WAAA,IAAA,aAAI,GAAE,CAAA;;;;iDA0BR;IAhHG,aAAa;QAJlB,IAAA,mBAAU,EAAC;YACV,OAAO,EAAE,wBAAe;SACzB,CAAC;QACD,IAAA,wBAAe,EAAC,GAAG,UAAU,CAAC;QAY1B,WAAA,IAAA,eAAM,EAAC,aAAa,CAAC,CAAA;QACrB,WAAA,IAAA,eAAM,EAAC,eAAe,CAAC,CAAA;QAIvB,WAAA,IAAA,eAAM,EAAC,iCAAc,CAAC,CAAA;yDAHY,wBAAiB;YACzB,gBAAS;YACN,yCAAkB;YACK,iCAAc;OAhBjE,aAAa,CAiHlB;IAED,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import {\n Body,\n CanActivate,\n Controller,\n Get,\n Inject,\n Logger,\n OnModuleInit,\n Post,\n Req,\n Res,\n Type,\n UseGuards,\n VERSION_NEUTRAL,\n applyDecorators,\n} from '@nestjs/common';\nimport { ApplicationConfig, ContextIdFactory, ModuleRef } from '@nestjs/core';\nimport type { Request, Response } from 'express';\n\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';\nimport { buildMcpCapabilities } from '../utils/capabilities-builder';\nimport { McpOptions } from '../interfaces';\nimport { McpExecutorService } from '../services/mcp-executor.service';\nimport { McpRegistryService } from '../services/mcp-registry.service';\nimport { SsePingService } from '../services/sse-ping.service';\nimport { normalizeEndpoint } from '../utils/normalize-endpoint';\n\n/**\n * Creates a controller for handling SSE connections and tool executions\n */\nexport function createSseController(\n sseEndpoint: string,\n messagesEndpoint: string,\n apiPrefix: string,\n guards: Type<CanActivate>[] = [],\n decorators: ClassDecorator[] = [],\n) {\n @Controller({\n version: VERSION_NEUTRAL,\n })\n @applyDecorators(...decorators)\n class SseController implements OnModuleInit {\n readonly logger = new Logger(SseController.name);\n // Note: Currently, storing transports and servers in memory makes this not viable for scaling out.\n // Redis can be used for this purpose, but considering that HTTP Streamable succeeds SSE then we can drop keeping this in memory.\n\n // Map to store active transports by session ID\n public transports = new Map<string, SSEServerTransport>();\n // Map to store MCP server instances by session ID\n public mcpServers = new Map<string, McpServer>();\n\n constructor(\n @Inject('MCP_OPTIONS') public readonly options: McpOptions,\n @Inject('MCP_MODULE_ID') public readonly mcpModuleId: string,\n public readonly applicationConfig: ApplicationConfig,\n public readonly moduleRef: ModuleRef,\n public readonly toolRegistry: McpRegistryService,\n @Inject(SsePingService) public readonly pingService: SsePingService,\n ) {}\n\n /**\n * Initialize the controller and configure ping service\n */\n onModuleInit() {\n // Configure ping service with options\n this.pingService.configure({\n pingEnabled: this.options.sse?.pingEnabled, // Enable by default\n pingIntervalMs: this.options.sse?.pingIntervalMs,\n });\n }\n\n /**\n * SSE connection endpoint\n */\n @Get(normalizeEndpoint(`${apiPrefix}/${sseEndpoint}`))\n @UseGuards(...guards)\n async sse(@Res() res: Response) {\n const transport = new SSEServerTransport(\n normalizeEndpoint(\n `${apiPrefix}/${this.applicationConfig.getGlobalPrefix()}/${messagesEndpoint}`,\n ),\n res,\n );\n const sessionId = transport.sessionId;\n\n // Create a new MCP server instance with dynamic capabilities\n const capabilities = buildMcpCapabilities(\n this.mcpModuleId,\n this.toolRegistry,\n this.options,\n );\n this.logger.debug('Built MCP capabilities:', capabilities);\n\n // Create a new MCP server for this session with dynamic capabilities\n const mcpServer = new McpServer(\n { name: this.options.name, version: this.options.version },\n {\n capabilities,\n instructions: this.options.instructions || '',\n },\n );\n\n // Store the transport and server for this session\n this.transports.set(sessionId, transport);\n this.mcpServers.set(sessionId, mcpServer);\n\n // Register the connection with the ping service\n this.pingService.registerConnection(sessionId, transport, res);\n\n transport.onclose = () => {\n // Clean up when the connection closes\n this.transports.delete(sessionId);\n this.mcpServers.delete(sessionId);\n this.pingService.removeConnection(sessionId);\n };\n\n await mcpServer.connect(transport);\n }\n\n /**\n * Tool execution endpoint - protected by the provided guards\n */\n @Post(normalizeEndpoint(`${apiPrefix}/${messagesEndpoint}`))\n @UseGuards(...guards)\n async messages(\n @Req() req: Request,\n @Res() res: Response,\n @Body() body: unknown,\n ) {\n const sessionId = req.query.sessionId as string;\n const transport = this.transports.get(sessionId);\n\n if (!transport) {\n return res.status(404).send('Session not found');\n }\n\n const mcpServer = this.mcpServers.get(sessionId);\n if (!mcpServer) {\n return res.status(404).send('MCP server not found for session');\n }\n\n // Resolve the request-scoped tool executor service\n const contextId = ContextIdFactory.getByRequest(req);\n const executor = await this.moduleRef.resolve(\n McpExecutorService,\n contextId,\n );\n\n // Register request handlers with the user context from this specific request\n executor.registerRequestHandlers(mcpServer, req);\n\n // Process the message\n await transport.handlePostMessage(req, res, body);\n }\n }\n\n return SseController;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rekog/mcp-nest",
|
|
3
|
-
"version": "1.7.0-alpha.
|
|
3
|
+
"version": "1.7.0-alpha.3",
|
|
4
4
|
"description": "NestJS module for creating Model Context Protocol (MCP) servers",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@types/express": "^5.0.2",
|
|
54
54
|
"@types/jest": "^29.5.14",
|
|
55
55
|
"@types/node": "^22.10.10",
|
|
56
|
+
"@types/passport-github": "^1.1.12",
|
|
56
57
|
"@types/passport-google-oauth20": "^2.0.16",
|
|
57
58
|
"@types/supertest": "^6.0.3",
|
|
58
59
|
"eslint": "^9.18.0",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { OAuthProviderConfig } from './oauth-provider.interface';
|
|
2
|
+
import { Strategy } from 'passport-github';
|
|
2
3
|
|
|
3
|
-
// Note: You'll need to install passport-
|
|
4
|
-
// npm install passport-
|
|
4
|
+
// Note: You'll need to install passport-github
|
|
5
|
+
// npm install passport-github @types/passport-github
|
|
5
6
|
|
|
6
7
|
export const GitHubOAuthProvider: OAuthProviderConfig = {
|
|
7
8
|
name: 'github',
|
|
8
|
-
|
|
9
|
-
strategy: require('passport-github').Strategy,
|
|
9
|
+
strategy: Strategy,
|
|
10
10
|
strategyOptions: ({ serverUrl, clientId, clientSecret }) => ({
|
|
11
11
|
clientID: clientId,
|
|
12
12
|
clientSecret: clientSecret,
|
|
@@ -73,7 +73,7 @@ export function createSseController(
|
|
|
73
73
|
/**
|
|
74
74
|
* SSE connection endpoint
|
|
75
75
|
*/
|
|
76
|
-
@Get(sseEndpoint)
|
|
76
|
+
@Get(normalizeEndpoint(`${apiPrefix}/${sseEndpoint}`))
|
|
77
77
|
@UseGuards(...guards)
|
|
78
78
|
async sse(@Res() res: Response) {
|
|
79
79
|
const transport = new SSEServerTransport(
|
|
@@ -121,7 +121,7 @@ export function createSseController(
|
|
|
121
121
|
/**
|
|
122
122
|
* Tool execution endpoint - protected by the provided guards
|
|
123
123
|
*/
|
|
124
|
-
@Post(messagesEndpoint)
|
|
124
|
+
@Post(normalizeEndpoint(`${apiPrefix}/${messagesEndpoint}`))
|
|
125
125
|
@UseGuards(...guards)
|
|
126
126
|
async messages(
|
|
127
127
|
@Req() req: Request,
|