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
- Neon Serverless PG via Azure (free tier) used for this project
- 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-composecommand to run the server:docker-compose -f ./docker-compose.dev.yml up
- You can choose to use Docker Desktop instead of installing Node.js and npm
Getting Started
- Clone repo
git clone https://github.com/mikesprague/mastra-mcp-test.git
- Enter directory
cd mastra-mcp-test
- Install dependencies
npm install
- Copy
.env.exampleto.envand then replace necessary valuescp .env.example .env
Available Commands
Node/npm Commands
npm run mastra:dev- Runs the Mastra dev server and makes the Mastra Playground available athttp://localhost:4111npm run mastra:build- Builds a production version of the Mastra projectnpm run mastra:start- Starts a server running the production build of the Mastra projectnpm run mastra:lint- Runs the Mastra linternpm start- Runsnpm run mastra:buildfollowed bynpm run mastra:start
Docker Commands
npm run docker:build- Builds the production Docker image for the Mastra projectnpm run docker:dev:build- Builds the development Docker image for the Mastra projectnpm run do-co:up- Usesdocker-composeto 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
- Example MCP server URL:
- Use
ctrl+cto stop the server
- NOTE: this may take a while
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+cinstead
- NOTE: be careful with this command as it will remove the Docker image - if you only want to stop the server, use
npm run do-co:dev:up- Usesdocker-composeto 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
- The MCP server within the Mastra Playground will be available at
- Use
ctrl+cto stop the server
- NOTE: this may take a while
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+cinstead
- NOTE: be careful with this command as it will remove the Docker image - if you only want to stop the server, use
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.