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

Function makeEchoMcpServer

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

374};
375
376export const makeEchoMcpServer = (
377 options: {
378 readonly name?: string;
379 readonly version?: string;
380 readonly toolName?: string;
381 readonly toolDescription?: string;
382 readonly inputName?: "name" | "value" | "marker";
383 readonly text?: (value: string) => string;
384 } = {},
385) => {
386 const inputName = options.inputName ?? "value";
387 const server = new McpServer(
388 {
389 name: options.name ?? "executor-echo-mcp",
390 version: options.version ?? "1.0.0",
391 },
392 { capabilities: {} },
393 );
394
395 server.registerTool(
396 options.toolName ?? "echo",
397 {
398 description: options.toolDescription ?? "Echoes a string value",
399 inputSchema: { [inputName]: z.string() },
400 },
401 async (input) => ({
402 content: [
403 {
404 type: "text" as const,
405 text: options.text ? options.text(input[inputName]) : input[inputName],
406 },
407 ],
408 }),
409 );
410
411 return server;
412};
413
414export const makeElicitationMcpServer = () => {
415 const server = new McpServer(

Calls 1

textMethod · 0.65

Tested by 2

createGreetingMcpServerFunction · 0.72