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

Function makeEchoMcpServer

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

349};
350
351export const makeEchoMcpServer = (
352 options: {
353 readonly name?: string;
354 readonly version?: string;
355 readonly toolName?: string;
356 readonly toolDescription?: string;
357 readonly inputName?: "name" | "value" | "marker";
358 readonly text?: (value: string) => string;
359 } = {},
360) => {
361 const inputName = options.inputName ?? "value";
362 const server = new McpServer(
363 {
364 name: options.name ?? "executor-echo-mcp",
365 version: options.version ?? "1.0.0",
366 },
367 { capabilities: {} },
368 );
369
370 server.registerTool(
371 options.toolName ?? "echo",
372 {
373 description: options.toolDescription ?? "Echoes a string value",
374 inputSchema: { [inputName]: z.string() },
375 },
376 async (input) => ({
377 content: [
378 {
379 type: "text" as const,
380 text: options.text ? options.text(input[inputName]) : input[inputName],
381 },
382 ],
383 }),
384 );
385
386 return server;
387};
388
389export const makeElicitationMcpServer = () => {
390 const server = new McpServer(

Calls 1

textMethod · 0.65

Tested by 2

createGreetingMcpServerFunction · 0.72