mcp_server

davidan90/mcp_server

3.1

If you are the rightful owner of mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This is a proof of concept for a Model Context Protocol (MCP) server using NestJS, Prisma, and SQLite, integrated with AI connectors for OpenAI and Gemini LLMs.

MCP Server POC

Proof of concept of an MCP (Model Context Protocol) server built with NestJS, Prisma, and SQLite. It allows retrieving and modifying the context of the User model via commands.

Includes an AI connector to OpenAI and Gemini LLMs to trigger commands programmatically.


๐Ÿš€ Technologies Used


๐Ÿ“ฆ Installation

npm install

โš™๏ธ Configuration

1. Create .env file

DATABASE_URL="file:./dev.db"
OPENAI_API_KEY=sk-...
GEMINI_API_KEY=AIza...

2. Generate the database

npx prisma migrate dev --name init

๐Ÿงช Sample Seed (optional)

npx ts-node prisma/seed.ts

๐Ÿ Useful Scripts

npm run start:dev         # Run the server in development mode
npm run prisma:generate   # Generate Prisma client
npm run prisma:migrate    # Run database migrations

๐Ÿง  MCP Endpoints

Get context

GET /mcp/context

Update context

PATCH /mcp/context

{
  "userId": 1,
  "isActive": false
}

Execute command

POST /mcp/commands

{
  "command": "deactivateUser",
  "args": { "userId": 1 }
}

๐Ÿค– LLM Connectors

OpenAI (GPT-4 + functions)

npx ts-node connectors/openai-mcp.ts

Sends a user message to GPT-4 and calls MCP commands automatically if needed.

Gemini (Google AI)

npx ts-node connectors/gemini-mcp.ts

Uses Gemini 1.5 Flash to generate tool calls and execute MCP actions.


๐Ÿ“ Project Structure

mcp-server/
โ”œโ”€โ”€ src/              # NestJS backend
โ”œโ”€โ”€ prisma/           # Prisma schema & seeds
โ”œโ”€โ”€ connectors/       # AI-based external clients
โ”œโ”€โ”€ .env              # API keys and DB
โ”œโ”€โ”€ package.json

๐Ÿ“ฌ Contact

This project is a proof of concept and ready to be expanded with more tools, validation layers, and LLM functions.