Mastra is an opinionated TypeScript framework that helps you build AI applications and features quickly. It gives you the set of primitives you need: workflows, agents, RAG, integrations and evals. You can run Mastra on your local machine, or deploy to a serverless cloud.
The main Mastra features are:
- Node.js (v20.0+)
If you don't have an API key for an LLM provider, you can get one from the following services:
If you don't have an account with these providers, you can sign up and get an API key. Anthropic require a credit card to get an API key. Some OpenAI models and Gemini do not and have a generous free tier for its API.
The easiest way to get started with Mastra is by using create-mastra. This CLI tool enables you to quickly start building a new Mastra application, with everything set up for you.
npx create-mastra@latestFinally, run mastra dev to open the Mastra playground.
npm run devIf you're using Anthropic, set the ANTHROPIC_API_KEY. If you're using Gemini, set the GOOGLE_GENERATIVE_AI_API_KEY.
MCP Server (@mastra/mcp-docs-server)
Use our MCP server @mastra/mcp-docs-server to teach your LLM how to use Mastra.
This is a Model Context Protocol (MCP) server that provides AI assistants with direct access to Mastra.ai's complete knowledge base.
Create or update .cursor/mcp.json in your project root:
{
"mcpServers": {
"mastra": {
"command": "npx",
"args": ["-y", "@mastra/mcp-docs-server"]
}
}
}
{
"mcpServers": {
"mastra": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@mastra/mcp-docs-server"]
}
}
}
This will make all Mastra documentation tools available in your Cursor workspace. Note that the MCP server wont be enabled by default. You'll need to go to Cursor settings -> MCP settings and click "enable" on the Mastra MCP server.
Create or update ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"mastra": {
"command": "npx",
"args": ["-y", "@mastra/mcp-docs-server"]
}
}
}
For more installation options visit https://www.npmjs.com/package/@mastra/mcp-docs-server
Looking to contribute? All types of help are appreciated, from coding to testing and feature specification.
If you are a developer and would like to contribute with code, please open an issue to discuss before opening a Pull Request.
Information about the project setup can be found in the development documentation
We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.
It's also super helpful if you leave the project a star here at the top of the page
