MCPSERV.CLUB
gedankrayze

TypeScript MCP Demo Server

MCP Server

Fast, type-safe MCP server on Bun runtime

Stale(55)
0stars
2views
Updated May 31, 2025

About

A lightweight Model Context Protocol server built with TypeScript and Bun, showcasing tool registration, stdio transport, and type safety for quick prototyping.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

TypeScript MCP Demo Server

The TypeScript MCP Demo Server showcases how to bring a Model Context Protocol (MCP) service into the modern JavaScript ecosystem using TypeScript and Bun. It demonstrates a minimal yet fully functional MCP server that can be dropped into an AI assistant workflow to expose custom tools, while leveraging TypeScript’s type safety and Bun’s lightning‑fast runtime. The server solves the common pain point of building a reliable, typed MCP backend without boilerplate: developers can focus on defining tool logic and input schemas while the SDK handles transport, protocol parsing, and response formatting.

At its core, the server implements two simple tools— and . These examples illustrate how to declare input schemas, perform validation, and return structured responses that the AI assistant can interpret. The tool accepts a single string and returns a friendly greeting, while demonstrates arithmetic logic with numeric inputs. By exposing these tools through MCP, an assistant can invoke them directly from a conversation, enabling seamless integration of external logic into the chat flow. The server’s architecture follows best practices: it registers tools during initialization, validates request payloads against JSON schemas, and returns content blocks that the client can render or process.

Key capabilities include:

  • StdIO Transport – The server communicates over standard input/output, making it compatible with any MCP‑capable client such as Claude Desktop or the web inspector.
  • TypeScript Type Safety – All request and response structures are typed, reducing runtime errors and improving developer experience.
  • Bun Runtime – Leveraging Bun’s native JavaScript engine results in faster startup and lower memory usage compared to Node.js, which is advantageous for lightweight services or edge deployments.
  • Extensibility – Adding new tools involves updating a small list and implementing a handler case; the rest of the protocol plumbing remains unchanged.
  • MCP Inspector Support – A built‑in web interface lets developers explore the server’s capabilities, send test requests, and debug interactions without writing additional tooling.

Real‑world use cases span from simple prototyping to production services. For example, a developer could expose a database query tool that returns JSON results, or integrate with an external API to fetch weather data. Once registered, these tools become first‑class citizens in the assistant’s tool catalog, allowing users to trigger them with natural language commands. The server can be embedded in CI/CD pipelines, serverless functions, or local development environments to provide instant, typed tool execution that scales with the assistant’s needs.

In summary, the TypeScript MCP Demo Server is a lightweight, type‑safe foundation for building AI‑enabled services. It removes the friction of setting up MCP infrastructure, demonstrates best practices in tool definition and validation, and provides a clear path for extending the server with domain‑specific logic—all while running on the fast Bun runtime.