Skip to content

Hope to provide a UMD format output #887

@kagol

Description

@kagol

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions