Database · MODEL CONTEXT PROTOCOL

NetanelBollag simple psql mcp

A beginner-friendly MCP server template featuring a PostgreSQL connector with clean, easy-to-understand code. Perfect for developers new to Model Context Protocol who want to experiment and create their own AI tool connectors with minimal setup.

WHAT IT CONNECTS

NetanelBollag simple psql mcp 为 AI Agent 提供什么

  • **Tools**
  • `execute_query` - Run SQL queries against your database
  • `test_connection` - Verify the database connection is working
  • **Resources**
  • `db://tables` - List of all tables in the schema
  • `db://tables/{table_name}` - Schema information for a specific table
  • `db://schema` - Complete schema information for all tables in the database
  • **Prompts**
  • Query generation templates
  • Analytical query builders
  • Based on the templates in this repo
  • Python 3.8+
  • [uv](https://github.com/astral-sh/uv) - Modern Python package manager and installer
  • npx (included with Node.js)
  • PostgreSQL database you can connect to
  • **Create a virtual environment and install dependencies:**
  • **Run the server with the MCP Inspector:**
  • **Using the Inspector:**
  • Click the "Connect" button in the interface (unless there's an error message in the console on the bottom left)
  • Explore the "Tools", "Resources", and "Prompts" tabs to see available functionality
  • Try clicking on listed commands or typing resource names to retrieve resources and prompts
  • The interface allows you to test queries and see how the MCP server responds
  • **Take a look at the official docs**
  • "What are all the tables in my database?"
  • "Show me the top 5 users by creation date"
  • "Count addresses by state"
  • Create a new directory under `/src` (e.g., `/src/my-new-mcp`)
  • Implement your MCP server following the PostgreSQL example
  • Add your new MCP to `pyproject.toml`:
  • MCP docs included for easy LLM development
  • Based on the approach at: https://modelcontextprotocol.io/tutorials/building-mcp-with-llms

SECURITY

MCP 收录不等于安全审核

MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。