mcpField
M
MCP (Model Context Protocol) Server

MCP (Model Context Protocol) Server

Local
github.com/VajraM-devDatabases0Updated 81w ago

About MCP (Model Context Protocol) Server

This Python MCP server connects to PostgreSQL and includes a tool for listing database tables. It is intended for deployments that need configurable SSE or stdio transport and AI provider settings for Anthropic or Google.

Key features

  1. 01PostgreSQL database connection
  2. 02List database tables
  3. 03SSE or stdio transport
  4. 04Anthropic and Google provider settings
  5. 05Extensible tool registration

Use cases

  1. 01Expose PostgreSQL table listings to MCP clients
  2. 02Choose SSE or stdio communication
  3. 03Configure Anthropic or Google providers
  4. 04Add custom server tools

MCP support

The project implements an MCP server with a `list_tables()` tool and customizable tool registration. It supports SSE and stdio transports.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MCP (Model Context Protocol) Server

Project Structure

├── client.py             # Client-side interaction script
├── server.py             # Main MCP server implementation
├── pg_connect.py         # PostgreSQL database connection
├── lm_config.py          # Language model configuration
│
├── .env.example          # Example environment configuration
├── .env.dev              # Development environment configuration
├── requirements.txt      # Project dependencies
└── .gitignore            # Git ignore file

Prerequisites

  • Python 3.10+
  • PostgreSQL
  • API access to AI providers (Anthropic, Google)

Installation

1. Clone the Repository
git https://github.com/VajraM-dev/Postgres-MCP-Server-With-SSE-Transport.git
2. Create Virtual Environment
python -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
3. Install Dependencies
pip install -r requirements.txt
4. Configure Environment
  1. Copy .env.example to .env.dev
  2. Fill in the required configuration:
cp .env.example .env.dev
nano .env.dev  # or use your preferred text editor
Configuration Parameters
  • POSTGRES_USERNAME: PostgreSQL database username
  • POSTGRES_PASSWORD: PostgreSQL database password
  • POSTGRES_DB_NAME: Database name
  • POSTGRES_HOST: Database host
  • POSTGRES_PORT: Database port
  • MCP_NAME: Server name
  • MCP_HOST: Server host
  • MCP_PORT: Server port
  • TRANSPORT: Communication transport (sse/stdio)
  • ANTHROPIC_API_KEY: Anthropic API key
  • GOOGLE_API_KEY: Google API key
  • USE_PROVIDER: Default AI provider

Running the Server

Development Mode
python server.py
Client Interaction
python client.py

Key Features

  • 🔒 Secure configuration management
  • 🗃️ PostgreSQL database integration
  • 🤖 Multi-provider AI model support
  • 📡 Flexible communication transport
  • 🛡️ Extensible tool registration

Supported AI Providers

  • Anthropic (Claude models)
  • Google (Gemini models)

Tools and Endpoints

Available Tools
  • list_tables(): Retrieve database tables
  • Custom tools can be easily added via decorators
Endpoints
  • /sse: Server-Sent Events endpoint
  • Customizable routing and tool registration

Extending the Framework

Adding New Tools
@app.tool()
def custom_tool():
    """Custom tool implementation"""
    # Your tool logic here
Configuring AI Providers

Modify lm_config.py to add or configure new AI providers.

Comments

Markdown supported

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.