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

Function makeEchoMcpServer

packages/plugins/mcp/src/testing/server.ts:465–501  ·  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

463};
464
465export const makeEchoMcpServer = (
466 options: {
467 readonly name?: string;
468 readonly version?: string;
469 readonly toolName?: string;
470 readonly toolDescription?: string;
471 readonly inputName?: "name" | "value" | "marker";
472 readonly text?: (value: string) => string;
473 } = {},
474) => {
475 const inputName = options.inputName ?? "value";
476 const server = new McpServer(
477 {
478 name: options.name ?? "executor-echo-mcp",
479 version: options.version ?? "1.0.0",
480 },
481 { capabilities: {} },
482 );
483
484 server.registerTool(
485 options.toolName ?? "echo",
486 {
487 description: options.toolDescription ?? "Echoes a string value",
488 inputSchema: { [inputName]: z.string() },
489 },
490 async (input) => ({
491 content: [
492 {
493 type: "text" as const,
494 text: options.text ? options.text(input[inputName]) : input[inputName],
495 },
496 ],
497 }),
498 );
499
500 return server;
501};
502
503export const makeElicitationMcpServer = () => {
504 const server = new McpServer(

Calls 1

textMethod · 0.65

Tested by 2

createGreetingMcpServerFunction · 0.72