ContextBase (MCP Server)
LocalAbout ContextBase (MCP Server)
ContextBase is an MCP server for AI agents, assistants, and apps to store, retrieve, and manage per-user context through an API. It combines persistent memory endpoints with authentication, logging, and database-backed storage.
Key features
- 01Store and retrieve user memories
- 02Create, update, and delete memories
- 03JWT authentication
- 04User action logs
- 05PostgreSQL storage and Redis caching
Use cases
- 01Give an AI app access to per-user context
- 02Manage stored memories through API endpoints
- 03Review recorded user actions
MCP support
Provides an MCP server for AI agents, assistants, and apps managing user context. The README describes memory and account functions through API endpoints.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEContextBase (MCP Server)
ContextBase – A Model Context Protocol (MCP) server for AI agents, assistants, and apps which store, retrieve, and manage per-user context using a simple API.
Features
- Authentication System: Secure user authentication using JWT and bcrypt
- Memory Management: API endpoints for storing and retrieving memory data
- Logging System: Comprehensive logging of user actions
- Modern Tech Stack: Built with TypeScript, Fastify, Prisma ORM
- Database Integration: PostgreSQL for persistent storage
- Caching: Redis for high-performance caching
Prerequisites
- Node.js (v14 or higher)
- PostgreSQL
- Redis
- Docker and Docker Compose (optional, for containerized deployment)
Installation
-
Clone the repository
git clone https://github.com/imfeniljikadara/contextbase.git cd mcp -
Install dependencies
cd mcp-server npm install -
Set up environment variables Create a
.envfile in themcp-serverdirectory with the following variables:DATABASE_URL=postgresql://username:password@localhost:5432/mcp REDIS_HOST=localhost REDIS_PORT=6379 JWT_SECRET=your_jwt_secret PORT=3000 -
Run database migrations
npx prisma migrate dev -
Start the server
npm startOr using Docker:
docker-compose up
API Endpoints
-
Authentication
POST /api/auth/register- Register a new userPOST /api/auth/login- Login and get JWT token
-
Memory
GET /api/memory- Get all memoriesPOST /api/memory- Create a new memoryGET /api/memory/:id- Get a specific memoryPUT /api/memory/:id- Update a memoryDELETE /api/memory/:id- Delete a memory
-
Logs
GET /api/logs- Get user action logs
Development
-
Run in development mode:
npm run dev -
Run tests:
npm test
Project Structure
mcp-server/
├── prisma/ # Database schema and migrations
├── src/
│ ├── api/ # API routes and controllers
│ ├── config/ # Configuration files
│ ├── db/ # Database connections (PostgreSQL, Redis)
│ ├── middleware/ # Custom middleware
│ ├── models/ # Data models
│ ├── services/ # Business logic
│ ├── utils/ # Utility functions
│ └── index.ts # Application entry point
├── scripts/ # Helper scripts
├── .env # Environment variables
└── package.json # Dependencies and scripts
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.