mastra-mcp-test

mikesprague/mastra-mcp-test

3.1

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

This is an example MCP server using the Mastra framework, designed to be run and accessed locally.

Tools
1
Resources
0
Prompts
0

mastra-mcp-test

This is an example MCP server using the Mastra framework.

It is not currently published anywhere but you can run and access it locally.

About

[!NOTE] Documentation in progress.

Running Locally

Prerequisites

  • Node.js >= 22.x with npm >= 10.x
  • Postgres Database
  • OPTIONAL: Docker Desktop
    • You can choose to use Docker Desktop instead of installing Node.js and npm
      • If you already have Node.js/npm installed but want to use Docker, there are npm scripts included to run the docker-compose files (see below)
    • Example docker-compose command to run the server: docker-compose -f ./docker-compose.dev.yml up

Getting Started

  1. Clone repo
    • git clone https://github.com/mikesprague/mastra-mcp-test.git
  2. Enter directory
    • cd mastra-mcp-test
  3. Install dependencies
    • npm install
  4. Copy .env.example to .env and then replace necessary values
    • cp .env.example .env

Available Commands

Node/npm Commands
  1. npm run mastra:dev - Runs the Mastra dev server and makes the Mastra Playground available at http://localhost:4111
  2. npm run mastra:build - Builds a production version of the Mastra project
  3. npm run mastra:start - Starts a server running the production build of the Mastra project
  4. npm run mastra:lint - Runs the Mastra linter
  5. npm start - Runs npm run mastra:build followed by npm run mastra:start
Docker Commands
  1. npm run docker:build - Builds the production Docker image for the Mastra project
  2. npm run docker:dev:build - Builds the development Docker image for the Mastra project
  3. npm run do-co:up - Uses docker-compose to start the production Docker container for the Mastra project
    • NOTE: this may take a while
      • it will build the Docker image if it does not already exist
      • running the server will download some required packages/dependencies
    • The server will be available at http://localhost:4111
      • Example MCP server URL: http://localhost:4111/api/mcp/weather/mcp
    • Use ctrl + c to stop the server
  4. npm run do-co:down - Stops the Mastra server, stops the Docker container, removes the container, removes the network, and removes the image
    • NOTE: be careful with this command as it will remove the Docker image - if you only want to stop the server, use ctrl + c instead
  5. npm run do-co:dev:up - Uses docker-compose to start the development Docker container for the Mastra project
    • NOTE: this may take a while
      • it will build the Docker image if it does not already exist
      • running the server will download some required packages/dependencies
    • The Mastra Playground will be available at http://localhost:4111
      • The MCP server within the Mastra Playground will be available at http://localhost:4111/mcps/weather
    • Use ctrl + c to stop the server
  6. npm run do-co:dev:down - Stops the Mastra server, stops the Docker container, removes the container, removes the network, and removes the image
    • NOTE: be careful with this command as it will remove the Docker image - if you only want to stop the server, use ctrl + c instead

Accessing the MCP Server

Once the server is running, the MCP URL will be: http://localhost:4111/api/mcp/weather/mcp. You should be able to access the server and the getWeather tool using most MCP clients.