mastra-test-mcp-server

waiyanminkhaing-vottia/mastra-test-mcp-server

3.1

If you are the rightful owner of mastra-test-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Mastra Test MCP Server is a TypeScript-based server utilizing the Model Context Protocol with HTTP SSE for real-time communication.

Mastra Test MCP Server

A Model Context Protocol (MCP) server built with the MCP SDK using HTTP SSE (Server-Sent Events) transport.

Overview

This is a TypeScript-based MCP server that provides a foundation for building tools and resources accessible through the Model Context Protocol. The server uses HTTP with Server-Sent Events for real-time communication.

Prerequisites

  • Node.js 18+
  • pnpm

Installation

pnpm install

Configuration

Copy the example environment file and configure as needed:

cp .env.example .env

Environment variables:

  • PORT - HTTP server port (default: 3000)
  • LOG_LEVEL - Log level (trace, debug, info, warn, error, fatal)
  • NODE_ENV - Environment (development, production)

Development

Build the project

pnpm run build

Run in development mode

pnpm run dev

The server will start on http://localhost:3000 (or the port specified in .env)

Watch mode (auto-rebuild on changes)

pnpm run watch

Code Quality

Type checking

pnpm run type-check

Linting

pnpm run lint
pnpm run lint:fix  # Auto-fix issues

Formatting

pnpm run format
pnpm run format:check

Run all checks

pnpm run check-all

Usage

The server runs using HTTP SSE (Server-Sent Events) transport and can be integrated with MCP-compatible clients.

Server Endpoints

  • GET /health - Health check endpoint
  • POST /sse - SSE endpoint for MCP communication
  • POST /message - Message endpoint for client requests

Testing the Server

  1. Start the server:
pnpm run dev
  1. Test the health endpoint:
curl http://localhost:3000/health

MCP Client Integration

To connect an MCP client to this server, use the SSE endpoint:

http://localhost:3000/sse

Example configuration for MCP clients that support HTTP transport:

{
  "mcpServers": {
    "mastra-test": {
      "url": "http://localhost:3000/sse",
      "transport": "sse"
    }
  }
}

Project Structure

.
├── src/
│   ├── index.ts          # Main server implementation with HTTP SSE transport
│   └── logger.ts         # Pino logger configuration
├── dist/                 # Compiled output
├── .vscode/              # VSCode configuration
├── .husky/               # Git hooks
├── .env.example          # Environment variables template
├── package.json
├── tsconfig.json
├── eslint.config.mjs
└── .prettierrc.cjs

License

MIT