modelcontextprotocol/typescript-sdk

Hope to provide a UMD format output

Opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

I want to use it directly in the HTML file, so I need a UMD format output.

Image

demo:

index.html

<html>
  <head>
    <!-- Import MCP SDK -->
    <script src="https://unpkg.com/@modelcontextprotocol/sdk@latest/dist/index.umd.js"></script>
    <!-- Import Zod -->
    <script src="https://unpkg.com/zod@latest/dist/index.umd.js"></script>
  </head>
  <body>
    <script>
      (async () => {
        const { McpServer } = MCP;
        const { z } = ZOD;

        const server = new McpServer({ name: 'my-mcp-server', version: '1.0.0' });
        server.registerTool(
          "add",
          {
            title: "Addition Tool",
            description: "Add two number",
            inputSchema: { a: z.number(), b: z.number() },
          },
          async ({ a, b }) => {
            return { content: [{ type: "text", text: String(a + b) }] };
          }
        );

        await server.connect(serverTransport);
      })();
    </script>
  </body>
</html>

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.