Skip to content

added stateful PostgreSQL server #2170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ahmedmustahid
Copy link

@ahmedmustahid ahmedmustahid commented Jun 20, 2025

Description

Implemented MCP tools and resources using the latest MCP SDK

Server Details

  • Server: Postgre SQL
  • Changes to:
    1. Implemented tools, resources with latest SDK
    2. Implemented both streamable HTTP and stdio transport
    3. Implemented Stateful sessions
    4. Made the code more modular
    5. Added docker compose scripts
    6. Improved package.json

Motivation and Context

The problem with previous code:

  1. only implemented with Stdio
  2. The SDK was old
  3. The code was not modular: addition of new tools, resources was difficult
  4. There was no docker compose file
  5. Sessions were not stateful

How Has This Been Tested?

Yes. Tests have been carried out.

  1. Using MCP Inspector: Can successfully access resources and call tools (from a running postgres Database)
  2. Using langchain ReAct agent: The agent successfully uses the Postgre SQL server for performing necessary tasks

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follows MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional context

First setup Environment variables (database credentials) Environment Variables Setup
For http: npx @ahmedmustahid/postgres-mcp-server
For stdio: npx @ahmedmustahid/postgres-mcp-server stdio

Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, could you update this branch to make sure that it only includes your changes? Thanks!

@olaservo olaservo added the waiting for submitter Waiting for the submitter to provide more info label Jul 11, 2025
@ahmedmustahid
Copy link
Author

ahmedmustahid commented Jul 12, 2025

Sorry for the trouble.
Done.

Edit: There was a merge conflict at line 278 (where I added my change). I have accepted both incoming and outgoing changes to resolve the conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for submitter Waiting for the submitter to provide more info
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants