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
- 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
# 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_NAMECREATE TABLE todo_items (
id UUID PRIMARY KEY,
text TEXT NOT NULL,
completed BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);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.
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 application is under development and you can just ignore it for now.