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

Function makeEchoMcpServer

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

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

Calls 1

textMethod · 0.65

Tested by 2

createGreetingMcpServerFunction · 0.72