Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/mcp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import { dirname, resolve } from "node:path";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { registerPrompts } from "./prompts/index.js";

const currentFilePath = fileURLToPath(import.meta.url);
const currentDirectoryPath = dirname(currentFilePath);
Expand Down Expand Up @@ -109,6 +110,8 @@ const main = async (): Promise<void> => {
try {
const server = buildServer();

registerPrompts(server);

shutdown = installLifecycleHandlers(server).shutdown;
Comment thread
Copilot marked this conversation as resolved.

const transport = new StdioServerTransport();
Expand Down
15 changes: 15 additions & 0 deletions packages/mcp/src/prompts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright IBM Corp. 2021, 2025
* SPDX-License-Identifier: MPL-2.0
*/

import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import type { McpPrompt } from "./types.ts";

Comment thread
Copilot marked this conversation as resolved.
Outdated
const PROMPTS: McpPrompt[] = [];

export function registerPrompts(server: McpServer) {
for (const prompt of PROMPTS) {
server.registerPrompt(prompt.name, prompt.config, prompt.callback);
}
}
17 changes: 17 additions & 0 deletions packages/mcp/src/prompts/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Copyright IBM Corp. 2021, 2025
* SPDX-License-Identifier: MPL-2.0
*/

import type { PromptCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
import type { ZodRawShapeCompat } from "@modelcontextprotocol/sdk/server/zod-compat.js";

export interface McpPrompt<Args extends ZodRawShapeCompat = ZodRawShapeCompat> {
name: string;
config: {
title?: string;
description?: string;
argsSchema: Args;
};
callback: PromptCallback<Args>;
}