MCP ExplorerExplorer

Template Mcp Hello World Ts

@blaxel-templateson 10 months ago
0 MIT
FreeCommunity
AI Systems
A production-ready TypeScript template for building MCP in Blaxel.

Overview

What is Template Mcp Hello World Ts

This project is a TypeScript template for creating a Model Context Protocol (MCP) server using the Blaxel platform. It serves as a simple ‘Hello World’ implementation, showcasing how to develop MCP tools and functions that can integrate with AI agents and language models via the MCP interface.

Use cases

The MCP server can be utilized to rapidly deploy AI functionalities, enabling interaction through standard protocols. It demonstrates a mechanism for AI agents to process input, validate parameters, and return responses, making it suitable for various AI-driven applications and services.

How to use

To use the MCP server, clone the repository, install dependencies with npm, and start the development server. You can deploy the server to the Blaxel platform using the Blaxel CLI. The server supports hot reloading for development and can be inspected using the MCP inspector.

Key features

Key features include a simple MCP server built in TypeScript, parameter validation with Zod, integration with the Blaxel platform, support for stdio and Blaxel transport protocols, hot reload development, and production-ready TypeScript compilation.

Where to use

This template is ideal for developers looking to create AI-driven tools and functions on the Blaxel platform. It can be used in various settings where integration with AI agents is needed, including chatbots, automated assistants, and any service requiring dynamic interaction based on user input.

Content

Blaxel MCP Hello World TypeScript

Blaxel

License: MIT
Node.js 18+
TypeScript
MCP
PNPM

A TypeScript template implementation of a Model Context Protocol (MCP) server using the Blaxel platform. This simple “Hello World” server demonstrates how to create MCP tools and functions that can be integrated with AI agents and language models through the standardized MCP interface.

📑 Table of Contents

✨ Features

  • Simple MCP server implementation with TypeScript
  • “Hello World” tool function with parameter validation
  • Zod schema validation for robust type safety
  • Built-in Blaxel platform integration for seamless deployment
  • Support for both stdio and Blaxel transport protocols
  • Hot reload development environment
  • Production-ready TypeScript compilation
  • Easy integration with AI agents and language models

🚀 Quick Start

For those who want to get up and running quickly:

# Clone the repository
git clone https://github.com/blaxel-ai/template-mcp-hello-world-ts.git

# Navigate to the project directory
cd template-mcp-hello-world-ts

# Install dependencies
npm install

# Start the development server
npm dev

# In another terminal, deploy to Blaxel
bl deploy

# Test MCP server
npm run inspect

📋 Prerequisites

  • Node.js: 18.0 or later
  • Blaxel Platform Setup: Complete Blaxel setup by following the quickstart guide
    • Blaxel CLI: Ensure you have the Blaxel CLI installed. If not, install it globally:
      curl -fsSL https://raw.githubusercontent.com/blaxel-ai/toolkit/main/install.sh | BINDIR=/usr/local/bin sudo -E sh
      
    • Blaxel login: Login to Blaxel platform
      bl login YOUR-WORKSPACE
      

💻 Installation

Clone the repository and install dependencies:

git clone https://github.com/blaxel-ai/template-mcp-hello-world-ts.git
cd template-mcp-hello-world-ts
npm install

🔧 Usage

Running Locally

Start the development server with hot reloading:

npm dev

For production build and run:

# Build the TypeScript code
npm run build

# Run the compiled JavaScript
npm run prod

You can also inspect the MCP server using the official MCP inspector:

npm run inspect

Note: The development server automatically restarts when you make changes to the source code.

Testing

You can test your MCP function locally:

# Test with the MCP inspector
npm run inspect

The MCP tool expects a firstname parameter and returns a greeting message.

Deployment

When you are ready to deploy your MCP server:

bl deploy

This command uses your code and the configuration in blaxel.toml to deploy your MCP server as a function on the Blaxel platform.

📁 Project Structure

  • src/server.ts - Main MCP server implementation with the hello_world tool
  • package.json - NPM package configuration with scripts and dependencies
  • tsconfig.json - TypeScript compiler configuration
  • blaxel.toml - Blaxel deployment configuration (function type)

❓ Troubleshooting

Common Issues

  1. Blaxel Platform Issues:

    • Ensure you’re logged in to your workspace: bl login MY-WORKSPACE
    • Verify models are available: bl get models
    • Check that functions exist: bl get functions
  2. MCP Server Connection Issues:

    • Verify the server starts without errors using npm run dev
    • Check that the MCP inspector can connect using npm run inspect
    • Ensure TypeScript compiles successfully with npm run build
    • Verify WebSocket connections if using Blaxel transport
  3. Dependency and Environment Issues:

    • Make sure you have Node.js 18+
    • Try npm install to reinstall dependencies
    • Check for TypeScript compilation errors
    • Verify that all required dependencies are installed

For more help, please submit an issue on GitHub.

👥 Contributing

Contributions are welcome! Here’s how you can contribute:

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/amazing-feature
    
  3. Commit your changes:
    git commit -m 'Add amazing feature'
    
  4. Push to the branch:
    git push origin feature/amazing-feature
    
  5. Submit a Pull Request

Please make sure to update tests as appropriate and follow the TypeScript code style of the project.

🆘 Support

If you need help with this template:

📄 License

This project is licensed under the MIT License. See the LICENSE file for more details.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers