my-mcp-server
Provides tools and resources for managing users in a PostgreSQL database, including creating, updating, and deleting user records, listing all users, and retrieving a single user profile by ID.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@my-mcp-servershow me all the users in the database"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
my-mcp-server
A playground and experimentation project for building an MCP (Model Context Protocol) server using TypeScript. It demonstrates how to expose tools and resources to AI agents and language models via the stdio transport.
The server manages a user database backed by PostgreSQL (via Drizzle ORM) and exposes tools and resources that an AI agent can call to read, create, update, and delete user records.
Features
Tool —
create_user: Creates a new user fromname,email,address, andphonefields (all required) and returns the created record with its database id.Tool —
update_user: Updates an existing user by id; at least one field must be provided and only the provided fields are changed.Tool —
delete_user: Deletes a user by id and returns the deleted record.Resource —
users://all: Returns the full list of users from the database as JSON.Resource —
users://{userId}/profile: Returns the profile of a single user identified byuserId.
Related MCP server: FastMCP Example Server
Prerequisites
Setup
Install dependencies:
npm installConfigure the database connection. Copy
.env.exampleto.envand adjust the values if needed:cp .env.example .envStart the Postgres container:
npm run db:up # or: docker compose up -d dbApply the database schema:
npm run db:migrate
On startup the server connects to the database and seeds it from data/users.json the first time (the seed is skipped once the table has data). The schema is managed by Drizzle migrations in src/db/migrations/: after changing src/db/schema.ts, run npm run db:generate to emit a new migration and npm run db:migrate to apply it.
Running the Server
Development mode (using tsx, no build step)
npm run server:devBuild & run compiled output
npm run server:build # compiles TypeScript → JavaScript
npm start # run the compiled serverWatch mode (auto-recompile on changes)
npm run server:build:watchInspect with MCP Inspector UI
The MCP Inspector lets you interactively call tools and browse resources in a browser UI:
npm run server:inspectNote:
server:inspectsetsDANGEROUSLY_OMIT_AUTH=true— use this only for local development.
Loading the MCP Server in Agent Environments
Agent CLI (e.g. Claude Code CLI)
Existence of .mcp.json should be picked up by the agent and prompted to load the server. Otherwise it's a simple MCP server config that needs to be added to the configuration with other servers.
Project Structure
my-mcp-server/
├── src/
│ ├── server.ts # MCP server entry point (tools & resources)
│ ├── db.ts # Postgres connection, startup checks, and seeding
│ └── db/
│ ├── schema.ts # Drizzle table definitions
│ └── migrations/ # Generated SQL migrations (committed)
├── data/
│ ├── users.json # Seed data imported into Postgres on first start
│ └── env.ts # Env validation used by drizzle-kit
├── drizzle.config.ts # drizzle-kit configuration
├── docker-compose.yml # Local Postgres container
├── package.json
└── tsconfig.jsonTech Stack
Package | Role |
| MCP server SDK (tools, resources, stdio transport) |
| TypeScript ORM / query builder for Postgres |
| Generates and applies SQL migrations |
| Postgres driver |
| Input schema validation for tools |
| Loads |
| Run TypeScript directly without a build step |
| TypeScript compiler |
| Browser-based MCP debug UI |
License
ISC
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
- UnifAPIOAuthcom.unifapi
Hosted MCP server for live public-data APIs and Skills for AI agents.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA lightweight MCP server that connects a local AI model (Ollama) with custom CRUD tools for an in-memory database, enabling natural language database management.-
- FlicenseNot gradedqualityDmaintenanceEducational example of an MCP server built with FastMCP, demonstrating how to expose tools, resources, and prompts for AI clients.-
- FlicenseNot gradedqualityDmaintenanceExample MCP server built with FastMCP, demonstrating tools, resources, and prompts for AI integration.14-
- AlicenseNot gradedqualityDmaintenanceA demonstrative MCP server that exposes a query-user tool for retrieving user info by ID, integrated with LangChain for agent-driven model reasoning and tool calls.ISC