MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / makeEchoMcpServer

Function makeEchoMcpServer

packages/plugins/mcp/src/testing/server.ts:423–459  ·  view source on GitHub ↗
(
  options: {
    readonly name?: string;
    readonly version?: string;
    readonly toolName?: string;
    readonly toolDescription?: string;
    readonly inputName?: "name" | "value" | "marker";
    readonly text?: (value: string) => string;
  } = {},
)

Source from the content-addressed store, hash-verified

421};
422
423export const makeEchoMcpServer = (
424 options: {
425 readonly name?: string;
426 readonly version?: string;
427 readonly toolName?: string;
428 readonly toolDescription?: string;
429 readonly inputName?: "name" | "value" | "marker";
430 readonly text?: (value: string) => string;
431 } = {},
432) => {
433 const inputName = options.inputName ?? "value";
434 const server = new McpServer(
435 {
436 name: options.name ?? "executor-echo-mcp",
437 version: options.version ?? "1.0.0",
438 },
439 { capabilities: {} },
440 );
441
442 server.registerTool(
443 options.toolName ?? "echo",
444 {
445 description: options.toolDescription ?? "Echoes a string value",
446 inputSchema: { [inputName]: z.string() },
447 },
448 async (input) => ({
449 content: [
450 {
451 type: "text" as const,
452 text: options.text ? options.text(input[inputName]) : input[inputName],
453 },
454 ],
455 }),
456 );
457
458 return server;
459};
460
461export const makeElicitationMcpServer = () => {
462 const server = new McpServer(

Calls 1

textMethod · 0.65

Tested by 2

createGreetingMcpServerFunction · 0.72