
mastra todo
A repo for tracking learning on the Mastra TypeScript AI SDK
Repository Info
About This Server
A repo for tracking learning on the Mastra TypeScript AI SDK
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
AI-driven Agents with Mastra.ai
A small utility application demonstrating core functionality of the Mastra.ai TypeScript framework working with OpenAI.
The only model provider supported at this time is OpenAI.
- Getting started with the server
- Using the Todo item Agent
- Using the GitHub Agent with MCP Server
- The client
Getting started with the server
- Clone repo and cd into the
serverdirectory - Run
npm install - Create a
.envfile in theserverdirectory as per the below example and add the environmental variables. - Use the below script to create a table in PostgresQL to store your todo items.
- Run
npm run dev
Environmental variables
# Azure Cosmos DB settings - Cosmos deployed as MongoDB
# DEPRECATED - MOVED TO POSTGRESQL
# MONGODB_DB_CS=YOUR_CONNECTION_STRING
# MONGODB_DB_DATABASE=YOUR_DATABASE_NAME #
# MONGODB_DB_COLLECTION=YOUR_COLLECTION_NAME
# Open AI settings
OPENAI_API_KEY=YOUR_OPENAI_KEY
OPENAI_MODEL=THE_OPENAI_MODEL_NAME
# GitHub token to use the GitHub MCP server
GITHUB_TOKEN=YOUR_GITHUB_TOKEN
# Postgres settings
# Needed because we are using the postgres adapter for the working memory
# and mastra does not yet support MongoDB as a vector database
# This is a temporary solution until we have a MongoDB adapter for the working memory
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=YOUR_USER_NAME
POSTGRES_PASSWORD=postgres
POSTGRES_DB=YOUR_TODO_DB_NAME
Todo table creation script
CREATE TABLE todo_items (
id UUID PRIMARY KEY,
text TEXT NOT NULL,
completed BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
Using the Todo item Agent
This application enables CRUD operations on a todo list held in a MongoDB and surfaced through AI agents, tools, and workflows. The DB used today is a Cosmos DB on Azure using the Mongo configuration.
The todo items connection should work with a standard Mongo DB server, but this hasn't been tested.
Note: To enable the memory capability of the To Do agent, you must have the role
postgresadded to your table that stores chat memory. The schema will be created for you.
Using the GitHub Agent with MCP Server
The GitHub Agent uses the GitHub MCP server which runs in a docker container. To enable this agent, you must have docker installed and the daemon must be running.
Note: The
GITHUB_TOKENvalue is the key from a token you may create on GitHub here.
More information available at the GitHub MCP Server repo.
The client
The client application is under development and you can just ignore it for now.
Quick Start
Clone the repository
git clone https://github.com/dstarr/mastra-todoInstall dependencies
cd mastra-todo
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.