@jaypie/mcp 0.4.0 → 0.5.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/README.md +3 -2
- package/dist/createMcpServer.js +34 -0
- package/dist/createMcpServer.js.map +1 -0
- package/dist/index.js +3 -92
- package/dist/index.js.map +1 -1
- package/dist/mcpExpressHandler.js +56 -0
- package/dist/mcpExpressHandler.js.map +1 -0
- package/dist/suite.d.ts +12 -0
- package/dist/suite.js +23 -2426
- package/dist/suite.js.map +1 -1
- package/dist/suites/aws/aws.js +328 -0
- package/dist/suites/aws/aws.js.map +1 -0
- package/dist/suites/aws/help.md +42 -0
- package/dist/suites/aws/index.d.ts +102 -0
- package/dist/suites/aws/index.js +258 -0
- package/dist/suites/aws/index.js.map +1 -0
- package/dist/suites/datadog/datadog.js +828 -0
- package/dist/suites/datadog/datadog.js.map +1 -0
- package/dist/suites/datadog/help.md +39 -0
- package/dist/suites/datadog/index.d.ts +24 -0
- package/dist/suites/datadog/index.js +156 -0
- package/dist/suites/datadog/index.js.map +1 -0
- package/dist/suites/docs/index.d.ts +14 -0
- package/dist/suites/docs/index.js +246 -0
- package/dist/suites/docs/index.js.map +1 -0
- package/dist/suites/docs/release-notes/help.md +37 -0
- package/dist/suites/llm/help.md +46 -0
- package/dist/suites/llm/index.d.ts +23 -0
- package/dist/suites/llm/index.js +65 -0
- package/dist/suites/llm/index.js.map +1 -0
- package/dist/suites/llm/llm.js +96 -0
- package/dist/suites/llm/llm.js.map +1 -0
- package/package.json +4 -3
- package/release-notes/constructs/1.2.18.md +12 -0
- package/release-notes/dynamodb/0.4.0.md +44 -0
- package/release-notes/fabric/0.2.0.md +77 -0
- package/release-notes/llm/1.2.5.md +25 -0
- package/release-notes/llm/1.2.6.md +55 -0
- package/release-notes/mcp/0.5.0.md +70 -0
- package/release-notes/testkit/1.2.17.md +30 -0
- package/skills/agents.md +18 -8
- package/skills/aws.md +232 -60
- package/skills/contents.md +15 -0
- package/skills/datadog.md +98 -64
- package/skills/development.md +19 -0
- package/skills/documentation.md +27 -0
- package/skills/dynamodb.md +37 -28
- package/skills/fabric.md +2 -2
- package/skills/infrastructure.md +21 -0
- package/skills/issues.md +55 -0
- package/skills/llm.md +381 -0
- package/skills/meta.md +17 -0
- package/skills/patterns.md +17 -0
- package/skills/secrets.md +74 -18
- package/skills/skills.md +22 -0
- package/skills/style.md +1 -24
- package/skills/tools-aws.md +166 -0
- package/skills/tools-datadog.md +199 -0
- package/skills/tools-dynamodb.md +168 -0
- package/skills/tools.md +58 -80
- package/skills/vocabulary.md +160 -0
- package/skills/topics.md +0 -116
- package/skills/writing.md +0 -153
- /package/dist/{aws.d.ts → suites/aws/aws.d.ts} +0 -0
- /package/dist/{datadog.d.ts → suites/datadog/datadog.d.ts} +0 -0
- /package/dist/{llm.d.ts → suites/llm/llm.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -35,9 +35,10 @@ AWS tools use the host's existing credential chain:
|
|
|
35
35
|
## MCP Tools
|
|
36
36
|
|
|
37
37
|
### Documentation Tools
|
|
38
|
-
- `
|
|
39
|
-
- `read_prompt` - Returns content of a specific prompt file
|
|
38
|
+
- `skill` - Access Jaypie development documentation by alias
|
|
40
39
|
- `version` - Returns package version string
|
|
40
|
+
- `list_release_notes` - List available release notes
|
|
41
|
+
- `read_release_note` - Read specific release note content
|
|
41
42
|
|
|
42
43
|
### AWS CLI Tools (16 tools)
|
|
43
44
|
- Step Functions: `aws_stepfunctions_list_executions`, `aws_stepfunctions_stop_execution`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createMcpServerFromSuite } from '@jaypie/fabric/mcp';
|
|
2
|
+
import { suite } from './suite.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Creates and configures an MCP server instance with Jaypie tools
|
|
6
|
+
*
|
|
7
|
+
* Uses ServiceSuite to register all services as MCP tools automatically.
|
|
8
|
+
* Services are defined in suite.ts using fabricService and registered
|
|
9
|
+
* by category. The createMcpServerFromSuite bridge converts them to
|
|
10
|
+
* MCP tools with proper Zod schema validation.
|
|
11
|
+
*
|
|
12
|
+
* @param options - Configuration options (or legacy version string)
|
|
13
|
+
* @returns Configured MCP server instance
|
|
14
|
+
*/
|
|
15
|
+
function createMcpServer(options = {}) {
|
|
16
|
+
// Support legacy signature: createMcpServer(version: string)
|
|
17
|
+
const config = typeof options === "string" ? { version: options } : options;
|
|
18
|
+
const { version = "0.0.0", verbose = false } = config;
|
|
19
|
+
if (verbose) {
|
|
20
|
+
console.error("[jaypie-mcp] Creating MCP server instance from suite");
|
|
21
|
+
}
|
|
22
|
+
const server = createMcpServerFromSuite(suite, {
|
|
23
|
+
name: suite.name,
|
|
24
|
+
version,
|
|
25
|
+
});
|
|
26
|
+
if (verbose) {
|
|
27
|
+
console.error(`[jaypie-mcp] Registered ${suite.services.length} tools from suite`);
|
|
28
|
+
console.error(`[jaypie-mcp] Categories: ${suite.categories.join(", ")}`);
|
|
29
|
+
}
|
|
30
|
+
return server;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { createMcpServer };
|
|
34
|
+
//# sourceMappingURL=createMcpServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMcpServer.js","sources":["../src/createMcpServer.ts"],"sourcesContent":["import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\nimport { createMcpServerFromSuite } from \"@jaypie/fabric/mcp\";\n\nimport { suite } from \"./suite.js\";\n\nexport interface CreateMcpServerOptions {\n version?: string;\n verbose?: boolean;\n}\n\n/**\n * Creates and configures an MCP server instance with Jaypie tools\n *\n * Uses ServiceSuite to register all services as MCP tools automatically.\n * Services are defined in suite.ts using fabricService and registered\n * by category. The createMcpServerFromSuite bridge converts them to\n * MCP tools with proper Zod schema validation.\n *\n * @param options - Configuration options (or legacy version string)\n * @returns Configured MCP server instance\n */\nexport function createMcpServer(\n options: CreateMcpServerOptions | string = {},\n): McpServer {\n // Support legacy signature: createMcpServer(version: string)\n const config: CreateMcpServerOptions =\n typeof options === \"string\" ? { version: options } : options;\n\n const { version = \"0.0.0\", verbose = false } = config;\n\n if (verbose) {\n console.error(\"[jaypie-mcp] Creating MCP server instance from suite\");\n }\n\n const server = createMcpServerFromSuite(suite, {\n name: suite.name,\n version,\n });\n\n if (verbose) {\n console.error(\n `[jaypie-mcp] Registered ${suite.services.length} tools from suite`,\n );\n console.error(\n `[jaypie-mcp] Categories: ${suite.categories.join(\", \")}`,\n );\n }\n\n return server;\n}\n"],"names":[],"mappings":";;;AAWA;;;;;;;;;;AAUG;AACG,SAAU,eAAe,CAC7B,OAAA,GAA2C,EAAE,EAAA;;AAG7C,IAAA,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,QAAQ,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO;IAE9D,MAAM,EAAE,OAAO,GAAG,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,MAAM;IAErD,IAAI,OAAO,EAAE;AACX,QAAA,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC;IACvE;AAEA,IAAA,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,EAAE;QAC7C,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO;AACR,KAAA,CAAC;IAEF,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,KAAK,CACX,CAAA,wBAAA,EAA2B,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAA,iBAAA,CAAmB,CACpE;AACD,QAAA,OAAO,CAAC,KAAK,CACX,CAAA,yBAAA,EAA4B,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAC1D;IACH;AAEA,IAAA,OAAO,MAAM;AACf;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -3,97 +3,8 @@ import { realpathSync, readFileSync } from 'node:fs';
|
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
5
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
9
|
-
import { randomUUID } from 'node:crypto';
|
|
10
|
-
import '@jaypie/fabric';
|
|
11
|
-
import 'node:fs/promises';
|
|
12
|
-
import 'gray-matter';
|
|
13
|
-
import 'semver';
|
|
14
|
-
import 'node:https';
|
|
15
|
-
import '@jaypie/llm';
|
|
16
|
-
import 'node:child_process';
|
|
17
|
-
import 'node:os';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Creates and configures an MCP server instance with Jaypie tools
|
|
21
|
-
*
|
|
22
|
-
* Uses ServiceSuite to register all services as MCP tools automatically.
|
|
23
|
-
* Services are defined in suite.ts using fabricService and registered
|
|
24
|
-
* by category. The createMcpServerFromSuite bridge converts them to
|
|
25
|
-
* MCP tools with proper Zod schema validation.
|
|
26
|
-
*
|
|
27
|
-
* @param options - Configuration options (or legacy version string)
|
|
28
|
-
* @returns Configured MCP server instance
|
|
29
|
-
*/
|
|
30
|
-
function createMcpServer(options = {}) {
|
|
31
|
-
// Support legacy signature: createMcpServer(version: string)
|
|
32
|
-
const config = typeof options === "string" ? { version: options } : options;
|
|
33
|
-
const { version = "0.0.0", verbose = false } = config;
|
|
34
|
-
if (verbose) {
|
|
35
|
-
console.error("[jaypie-mcp] Creating MCP server instance from suite");
|
|
36
|
-
}
|
|
37
|
-
const server = createMcpServerFromSuite(suite, {
|
|
38
|
-
name: suite.name,
|
|
39
|
-
version,
|
|
40
|
-
});
|
|
41
|
-
if (verbose) {
|
|
42
|
-
console.error(`[jaypie-mcp] Registered ${suite.services.length} tools from suite`);
|
|
43
|
-
console.error(`[jaypie-mcp] Categories: ${suite.categories.join(", ")}`);
|
|
44
|
-
}
|
|
45
|
-
return server;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Version will be injected during build
|
|
49
|
-
const DEFAULT_VERSION = "0.0.0";
|
|
50
|
-
/**
|
|
51
|
-
* Creates an Express handler for the Jaypie MCP server using HTTP transport
|
|
52
|
-
*
|
|
53
|
-
* @param options - Configuration options for the handler
|
|
54
|
-
* @returns Promise that resolves to an Express middleware function
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```typescript
|
|
58
|
-
* import express from 'express';
|
|
59
|
-
* import { mcpExpressHandler } from '@jaypie/mcp';
|
|
60
|
-
*
|
|
61
|
-
* const app = express();
|
|
62
|
-
* app.use(express.json());
|
|
63
|
-
*
|
|
64
|
-
* // Note: mcpExpressHandler is now async
|
|
65
|
-
* app.use('/mcp', await mcpExpressHandler({
|
|
66
|
-
* version: '1.0.0',
|
|
67
|
-
* enableSessions: true
|
|
68
|
-
* }));
|
|
69
|
-
*
|
|
70
|
-
* app.listen(3000, () => {
|
|
71
|
-
* console.log('MCP server running on http://localhost:3000/mcp');
|
|
72
|
-
* });
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
async function mcpExpressHandler(options = {}) {
|
|
76
|
-
const { version = DEFAULT_VERSION, enableSessions = true, sessionIdGenerator = () => randomUUID(), enableJsonResponse = false, } = options;
|
|
77
|
-
const server = createMcpServer(version);
|
|
78
|
-
const transport = new StreamableHTTPServerTransport({
|
|
79
|
-
sessionIdGenerator: enableSessions ? sessionIdGenerator : undefined,
|
|
80
|
-
enableJsonResponse,
|
|
81
|
-
});
|
|
82
|
-
await server.connect(transport);
|
|
83
|
-
return async (req, res) => {
|
|
84
|
-
try {
|
|
85
|
-
await transport.handleRequest(req, res, req.body);
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
if (!res.headersSent) {
|
|
89
|
-
res.status(500).json({
|
|
90
|
-
error: "Internal server error",
|
|
91
|
-
message: error instanceof Error ? error.message : "Unknown error",
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
}
|
|
6
|
+
import { createMcpServer } from './createMcpServer.js';
|
|
7
|
+
export { mcpExpressHandler } from './mcpExpressHandler.js';
|
|
97
8
|
|
|
98
9
|
// Version will be injected during build
|
|
99
10
|
const version = "0.0.0";
|
|
@@ -215,5 +126,5 @@ if (process.argv[1]) {
|
|
|
215
126
|
}
|
|
216
127
|
}
|
|
217
128
|
|
|
218
|
-
export { createMcpServer
|
|
129
|
+
export { createMcpServer };
|
|
219
130
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/createMcpServer.ts","../src/mcpExpressHandler.ts","../src/index.ts"],"sourcesContent":["import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\n\nimport { createMcpServerFromSuite } from \"@jaypie/fabric/mcp\";\n\nimport { suite } from \"./suite.js\";\n\nexport interface CreateMcpServerOptions {\n version?: string;\n verbose?: boolean;\n}\n\n/**\n * Creates and configures an MCP server instance with Jaypie tools\n *\n * Uses ServiceSuite to register all services as MCP tools automatically.\n * Services are defined in suite.ts using fabricService and registered\n * by category. The createMcpServerFromSuite bridge converts them to\n * MCP tools with proper Zod schema validation.\n *\n * @param options - Configuration options (or legacy version string)\n * @returns Configured MCP server instance\n */\nexport function createMcpServer(\n options: CreateMcpServerOptions | string = {},\n): McpServer {\n // Support legacy signature: createMcpServer(version: string)\n const config: CreateMcpServerOptions =\n typeof options === \"string\" ? { version: options } : options;\n\n const { version = \"0.0.0\", verbose = false } = config;\n\n if (verbose) {\n console.error(\"[jaypie-mcp] Creating MCP server instance from suite\");\n }\n\n const server = createMcpServerFromSuite(suite, {\n name: suite.name,\n version,\n });\n\n if (verbose) {\n console.error(\n `[jaypie-mcp] Registered ${suite.services.length} tools from suite`,\n );\n console.error(\n `[jaypie-mcp] Categories: ${suite.categories.join(\", \")}`,\n );\n }\n\n return server;\n}\n","import { Request, Response } from \"express\";\nimport { StreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/streamableHttp.js\";\nimport { randomUUID } from \"node:crypto\";\nimport { createMcpServer } from \"./createMcpServer.js\";\n\n// Version will be injected during build\nconst DEFAULT_VERSION = \"0.0.0\";\n\n/**\n * Options for configuring the MCP Express handler\n */\nexport interface McpExpressHandlerOptions {\n /**\n * Version string for the MCP server\n */\n version?: string;\n /**\n * Whether to enable session management (stateful mode)\n * Default: true\n */\n enableSessions?: boolean;\n /**\n * Custom session ID generator function\n */\n sessionIdGenerator?: () => string;\n /**\n * Enable JSON responses instead of SSE streaming\n * Default: false\n */\n enableJsonResponse?: boolean;\n}\n\n/**\n * Creates an Express handler for the Jaypie MCP server using HTTP transport\n *\n * @param options - Configuration options for the handler\n * @returns Promise that resolves to an Express middleware function\n *\n * @example\n * ```typescript\n * import express from 'express';\n * import { mcpExpressHandler } from '@jaypie/mcp';\n *\n * const app = express();\n * app.use(express.json());\n *\n * // Note: mcpExpressHandler is now async\n * app.use('/mcp', await mcpExpressHandler({\n * version: '1.0.0',\n * enableSessions: true\n * }));\n *\n * app.listen(3000, () => {\n * console.log('MCP server running on http://localhost:3000/mcp');\n * });\n * ```\n */\nexport async function mcpExpressHandler(\n options: McpExpressHandlerOptions = {},\n): Promise<(req: Request, res: Response) => Promise<void>> {\n const {\n version = DEFAULT_VERSION,\n enableSessions = true,\n sessionIdGenerator = () => randomUUID(),\n enableJsonResponse = false,\n } = options;\n\n const server = createMcpServer(version);\n\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: enableSessions ? sessionIdGenerator : undefined,\n enableJsonResponse,\n });\n\n await server.connect(transport);\n\n return async (req: Request, res: Response): Promise<void> => {\n try {\n await transport.handleRequest(req, res, req.body);\n } catch (error) {\n if (!res.headersSent) {\n res.status(500).json({\n error: \"Internal server error\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n });\n }\n }\n };\n}\n","#!/usr/bin/env node\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { createMcpServer } from \"./createMcpServer.js\";\n\n// Version will be injected during build\nconst version = \"0.0.0\";\n\n/**\n * Load environment variables from .env file in current working directory\n * Simple implementation that doesn't require external dependencies\n */\nfunction loadEnvFile() {\n try {\n const envPath = join(process.cwd(), \".env\");\n const content = readFileSync(envPath, \"utf-8\");\n\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n // Skip comments and empty lines\n if (!trimmed || trimmed.startsWith(\"#\")) continue;\n\n const eqIndex = trimmed.indexOf(\"=\");\n if (eqIndex === -1) continue;\n\n const key = trimmed.slice(0, eqIndex).trim();\n let value = trimmed.slice(eqIndex + 1).trim();\n\n // Remove surrounding quotes if present\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n\n // Only set if not already defined (environment takes precedence)\n if (!process.env[key]) {\n process.env[key] = value;\n }\n }\n } catch {\n // .env file not found or not readable - that's fine\n }\n}\n\n// Load .env file before anything else\nloadEnvFile();\n\n// Parse command-line arguments\nconst args = process.argv.slice(2);\nconst verbose = args.includes(\"--verbose\") || args.includes(\"-v\");\n\n// Logger for verbose mode (uses stderr to not interfere with JSON-RPC on stdout)\nconst log = {\n info: (message: string, ...args: unknown[]) => {\n if (verbose) {\n console.error(`[jaypie-mcp] ${message}`, ...args);\n }\n },\n error: (message: string, ...args: unknown[]) => {\n console.error(`[jaypie-mcp ERROR] ${message}`, ...args);\n },\n};\n\nlet server: McpServer | null = null;\nlet isShuttingDown = false;\n\nasync function gracefulShutdown(exitCode = 0) {\n if (isShuttingDown) {\n return;\n }\n isShuttingDown = true;\n\n log.info(\"Shutting down gracefully...\");\n\n try {\n if (server) {\n await server.close();\n log.info(\"Server closed successfully\");\n }\n } catch (error) {\n log.error(\"Error during shutdown:\", error);\n } finally {\n process.exit(exitCode);\n }\n}\n\nasync function main() {\n log.info(\"Starting Jaypie MCP server...\");\n log.info(`Version: ${version}`);\n log.info(`Node version: ${process.version}`);\n log.info(`Verbose mode: ${verbose ? \"enabled\" : \"disabled\"}`);\n\n server = createMcpServer({ version, verbose });\n\n log.info(\"MCP server created successfully\");\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n log.info(\"Connected to stdio transport\");\n log.info(\"Server is ready to accept requests\");\n\n // Handle process termination signals\n process.on(\"SIGINT\", () => {\n log.info(\"Received SIGINT signal\");\n gracefulShutdown(0);\n });\n process.on(\"SIGTERM\", () => {\n log.info(\"Received SIGTERM signal\");\n gracefulShutdown(0);\n });\n\n // Handle stdio stream errors (but let transport handle normal stdin end/close)\n process.stdin.on(\"error\", (error) => {\n if (error.message?.includes(\"EPIPE\") || error.message?.includes(\"EOF\")) {\n log.info(\"stdin closed\");\n gracefulShutdown(0);\n }\n });\n\n process.stdout.on(\"error\", (error) => {\n if (error.message?.includes(\"EPIPE\")) {\n log.info(\"stdout pipe broken\");\n gracefulShutdown(0);\n }\n });\n\n // Server is running on stdio\n}\n\n// Only run main() if this module is executed directly (not imported)\n// This handles npx and symlinks in node_modules/.bin correctly\nif (process.argv[1]) {\n const realPath = realpathSync(process.argv[1]);\n const realPathAsUrl = pathToFileURL(realPath).href;\n if (import.meta.url === realPathAsUrl) {\n main().catch((error) => {\n log.error(\"Fatal error:\", error);\n process.exit(1);\n });\n }\n}\n\nexport { createMcpServer } from \"./createMcpServer.js\";\nexport type { CreateMcpServerOptions } from \"./createMcpServer.js\";\nexport {\n mcpExpressHandler,\n type McpExpressHandlerOptions,\n} from \"./mcpExpressHandler.js\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAWA;;;;;;;;;;AAUG;AACG,SAAU,eAAe,CAC7B,OAAA,GAA2C,EAAE,EAAA;;AAG7C,IAAA,MAAM,MAAM,GACV,OAAO,OAAO,KAAK,QAAQ,GAAG,EAA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AAE,CAAC,KAAK,KAAI;AAClC,QAAA,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE;AACtE,YAAA,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC;YACxB,gBAAgB,CAAC,CAAC,CAAC;QACrB;AACF,IAAA,CAAC,CAAC;IAEF,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,KAAI;QACnC,IAAI,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;AACpC,YAAA,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC;YAC9B,gBAAgB,CAAC,CAAC,CAAC;QACrB;AACF,IAAA,CAAC,CAAC;;AAGJ;AAEA;AACA;AACA,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IACnB,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI;IAClD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,EAAE;AACrC,QAAA,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,KAAI;AACrB,YAAA,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC;AAChC,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { readFileSync, realpathSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { createMcpServer } from \"./createMcpServer.js\";\n\n// Version will be injected during build\nconst version = \"0.0.0\";\n\n/**\n * Load environment variables from .env file in current working directory\n * Simple implementation that doesn't require external dependencies\n */\nfunction loadEnvFile() {\n try {\n const envPath = join(process.cwd(), \".env\");\n const content = readFileSync(envPath, \"utf-8\");\n\n for (const line of content.split(\"\\n\")) {\n const trimmed = line.trim();\n // Skip comments and empty lines\n if (!trimmed || trimmed.startsWith(\"#\")) continue;\n\n const eqIndex = trimmed.indexOf(\"=\");\n if (eqIndex === -1) continue;\n\n const key = trimmed.slice(0, eqIndex).trim();\n let value = trimmed.slice(eqIndex + 1).trim();\n\n // Remove surrounding quotes if present\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n\n // Only set if not already defined (environment takes precedence)\n if (!process.env[key]) {\n process.env[key] = value;\n }\n }\n } catch {\n // .env file not found or not readable - that's fine\n }\n}\n\n// Load .env file before anything else\nloadEnvFile();\n\n// Parse command-line arguments\nconst args = process.argv.slice(2);\nconst verbose = args.includes(\"--verbose\") || args.includes(\"-v\");\n\n// Logger for verbose mode (uses stderr to not interfere with JSON-RPC on stdout)\nconst log = {\n info: (message: string, ...args: unknown[]) => {\n if (verbose) {\n console.error(`[jaypie-mcp] ${message}`, ...args);\n }\n },\n error: (message: string, ...args: unknown[]) => {\n console.error(`[jaypie-mcp ERROR] ${message}`, ...args);\n },\n};\n\nlet server: McpServer | null = null;\nlet isShuttingDown = false;\n\nasync function gracefulShutdown(exitCode = 0) {\n if (isShuttingDown) {\n return;\n }\n isShuttingDown = true;\n\n log.info(\"Shutting down gracefully...\");\n\n try {\n if (server) {\n await server.close();\n log.info(\"Server closed successfully\");\n }\n } catch (error) {\n log.error(\"Error during shutdown:\", error);\n } finally {\n process.exit(exitCode);\n }\n}\n\nasync function main() {\n log.info(\"Starting Jaypie MCP server...\");\n log.info(`Version: ${version}`);\n log.info(`Node version: ${process.version}`);\n log.info(`Verbose mode: ${verbose ? \"enabled\" : \"disabled\"}`);\n\n server = createMcpServer({ version, verbose });\n\n log.info(\"MCP server created successfully\");\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n log.info(\"Connected to stdio transport\");\n log.info(\"Server is ready to accept requests\");\n\n // Handle process termination signals\n process.on(\"SIGINT\", () => {\n log.info(\"Received SIGINT signal\");\n gracefulShutdown(0);\n });\n process.on(\"SIGTERM\", () => {\n log.info(\"Received SIGTERM signal\");\n gracefulShutdown(0);\n });\n\n // Handle stdio stream errors (but let transport handle normal stdin end/close)\n process.stdin.on(\"error\", (error) => {\n if (error.message?.includes(\"EPIPE\") || error.message?.includes(\"EOF\")) {\n log.info(\"stdin closed\");\n gracefulShutdown(0);\n }\n });\n\n process.stdout.on(\"error\", (error) => {\n if (error.message?.includes(\"EPIPE\")) {\n log.info(\"stdout pipe broken\");\n gracefulShutdown(0);\n }\n });\n\n // Server is running on stdio\n}\n\n// Only run main() if this module is executed directly (not imported)\n// This handles npx and symlinks in node_modules/.bin correctly\nif (process.argv[1]) {\n const realPath = realpathSync(process.argv[1]);\n const realPathAsUrl = pathToFileURL(realPath).href;\n if (import.meta.url === realPathAsUrl) {\n main().catch((error) => {\n log.error(\"Fatal error:\", error);\n process.exit(1);\n });\n }\n}\n\nexport { createMcpServer } from \"./createMcpServer.js\";\nexport type { CreateMcpServerOptions } from \"./createMcpServer.js\";\nexport {\n mcpExpressHandler,\n type McpExpressHandlerOptions,\n} from \"./mcpExpressHandler.js\";\n"],"names":[],"mappings":";;;;;;;;AAQA;AACA,MAAM,OAAO,GAAG,OAAO;AAEvB;;;AAGG;AACH,SAAS,WAAW,GAAA;AAClB,IAAA,IAAI;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC;QAC3C,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC;QAE9C,KAAK,MAA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AAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI;IAClD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,EAAE;AACrC,QAAA,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,KAAI;AACrB,YAAA,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC;AAChC,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ;AACF;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { createMcpServer } from './createMcpServer.js';
|
|
4
|
+
|
|
5
|
+
// Version will be injected during build
|
|
6
|
+
const DEFAULT_VERSION = "0.0.0";
|
|
7
|
+
/**
|
|
8
|
+
* Creates an Express handler for the Jaypie MCP server using HTTP transport
|
|
9
|
+
*
|
|
10
|
+
* @param options - Configuration options for the handler
|
|
11
|
+
* @returns Promise that resolves to an Express middleware function
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import express from 'express';
|
|
16
|
+
* import { mcpExpressHandler } from '@jaypie/mcp';
|
|
17
|
+
*
|
|
18
|
+
* const app = express();
|
|
19
|
+
* app.use(express.json());
|
|
20
|
+
*
|
|
21
|
+
* // Note: mcpExpressHandler is now async
|
|
22
|
+
* app.use('/mcp', await mcpExpressHandler({
|
|
23
|
+
* version: '1.0.0',
|
|
24
|
+
* enableSessions: true
|
|
25
|
+
* }));
|
|
26
|
+
*
|
|
27
|
+
* app.listen(3000, () => {
|
|
28
|
+
* console.log('MCP server running on http://localhost:3000/mcp');
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
async function mcpExpressHandler(options = {}) {
|
|
33
|
+
const { version = DEFAULT_VERSION, enableSessions = true, sessionIdGenerator = () => randomUUID(), enableJsonResponse = false, } = options;
|
|
34
|
+
const server = createMcpServer(version);
|
|
35
|
+
const transport = new StreamableHTTPServerTransport({
|
|
36
|
+
sessionIdGenerator: enableSessions ? sessionIdGenerator : undefined,
|
|
37
|
+
enableJsonResponse,
|
|
38
|
+
});
|
|
39
|
+
await server.connect(transport);
|
|
40
|
+
return async (req, res) => {
|
|
41
|
+
try {
|
|
42
|
+
await transport.handleRequest(req, res, req.body);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (!res.headersSent) {
|
|
46
|
+
res.status(500).json({
|
|
47
|
+
error: "Internal server error",
|
|
48
|
+
message: error instanceof Error ? error.message : "Unknown error",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { mcpExpressHandler };
|
|
56
|
+
//# sourceMappingURL=mcpExpressHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcpExpressHandler.js","sources":["../src/mcpExpressHandler.ts"],"sourcesContent":["import { Request, Response } from \"express\";\nimport { StreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/streamableHttp.js\";\nimport { randomUUID } from \"node:crypto\";\nimport { createMcpServer } from \"./createMcpServer.js\";\n\n// Version will be injected during build\nconst DEFAULT_VERSION = \"0.0.0\";\n\n/**\n * Options for configuring the MCP Express handler\n */\nexport interface McpExpressHandlerOptions {\n /**\n * Version string for the MCP server\n */\n version?: string;\n /**\n * Whether to enable session management (stateful mode)\n * Default: true\n */\n enableSessions?: boolean;\n /**\n * Custom session ID generator function\n */\n sessionIdGenerator?: () => string;\n /**\n * Enable JSON responses instead of SSE streaming\n * Default: false\n */\n enableJsonResponse?: boolean;\n}\n\n/**\n * Creates an Express handler for the Jaypie MCP server using HTTP transport\n *\n * @param options - Configuration options for the handler\n * @returns Promise that resolves to an Express middleware function\n *\n * @example\n * ```typescript\n * import express from 'express';\n * import { mcpExpressHandler } from '@jaypie/mcp';\n *\n * const app = express();\n * app.use(express.json());\n *\n * // Note: mcpExpressHandler is now async\n * app.use('/mcp', await mcpExpressHandler({\n * version: '1.0.0',\n * enableSessions: true\n * }));\n *\n * app.listen(3000, () => {\n * console.log('MCP server running on http://localhost:3000/mcp');\n * });\n * ```\n */\nexport async function mcpExpressHandler(\n options: McpExpressHandlerOptions = {},\n): Promise<(req: Request, res: Response) => Promise<void>> {\n const {\n version = DEFAULT_VERSION,\n enableSessions = true,\n sessionIdGenerator = () => randomUUID(),\n enableJsonResponse = false,\n } = options;\n\n const server = createMcpServer(version);\n\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: enableSessions ? sessionIdGenerator : undefined,\n enableJsonResponse,\n });\n\n await server.connect(transport);\n\n return async (req: Request, res: Response): Promise<void> => {\n try {\n await transport.handleRequest(req, res, req.body);\n } catch (error) {\n if (!res.headersSent) {\n res.status(500).json({\n error: \"Internal server error\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n });\n }\n }\n };\n}\n"],"names":[],"mappings":";;;;AAKA;AACA,MAAM,eAAe,GAAG,OAAO;AA0B/B;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;AACI,eAAe,iBAAiB,CACrC,UAAoC,EAAE,EAAA;IAEtC,MAAM,EACJ,OAAO,GAAG,eAAe,EACzB,cAAc,GAAG,IAAI,EACrB,kBAAkB,GAAG,MAAM,UAAU,EAAE,EACvC,kBAAkB,GAAG,KAAK,GAC3B,GAAG,OAAO;AAEX,IAAA,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC;AAEvC,IAAA,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC;QAClD,kBAAkB,EAAE,cAAc,GAAG,kBAAkB,GAAG,SAAS;QACnE,kBAAkB;AACnB,KAAA,CAAC;AAEF,IAAA,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;AAE/B,IAAA,OAAO,OAAO,GAAY,EAAE,GAAa,KAAmB;AAC1D,QAAA,IAAI;AACF,YAAA,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC;QACnD;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE;AACpB,gBAAA,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACnB,oBAAA,KAAK,EAAE,uBAAuB;AAC9B,oBAAA,OAAO,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,eAAe;AAClE,iBAAA,CAAC;YACJ;QACF;AACF,IAAA,CAAC;AACH;;;;"}
|
package/dist/suite.d.ts
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ServiceSuite for @jaypie/mcp
|
|
3
|
+
* Provides metadata and direct execution for Jaypie MCP services
|
|
4
|
+
*
|
|
5
|
+
* Consolidated from 26 tools into 6 unified router-style tools:
|
|
6
|
+
* - aws: 16 AWS CLI commands
|
|
7
|
+
* - datadog: 6 Datadog observability commands
|
|
8
|
+
* - llm: 2 LLM debugging commands
|
|
9
|
+
* - skill: Jaypie development documentation
|
|
10
|
+
* - version: Package version info
|
|
11
|
+
* - release_notes: Package release notes
|
|
12
|
+
*/
|
|
1
13
|
export declare const suite: import("@jaypie/fabric").ServiceSuite;
|