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

Function makeEchoMcpServer

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

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

Calls 1

textMethod · 0.65

Tested by 2

createGreetingMcpServerFunction · 0.72