mcp/examples: add PostgreSQL MCP server example #70
+1,960
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add standalone PostgreSQL MCP server example with development environment and tooling. This implementation provides read-only database access, schema introspection, and query capabilities while maintaining clean dependency separation from the main SDK.
Motivation and Context
This is part of #33. This PR adds example of implementing mcp on PostgreSQL from https://modelcontextprotocol.io/examples.
The PR provides a production-ready PostgreSQL MCP server example with proper deployment options, testing, and development tooling.
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context
Architecture Decisions
examples/postgres/go.mod
for this exampleFiles Added
main.go
- PostgreSQL MCP server implementation with schema introspection and query toolsmain_test.go
- Comprehensive test suite with mock database testinggo.mod/go.sum
- Independent module definition with local SDK referenceDockerfile
- Multi-stage build for production deploymentdocker-compose.yml
- Complete development environment with PostgreSQLinit.sql
- Sample database schema and data for testingMakefile
- Build automation and development workflowdemo.sh
- Interactive demonstration scriptREADME.md
- Complete documentation following Python server format.env.example
- Configuration template.gitignore
- Proper exclusions for Go and Docker artifactsDevelopment Experience
make dev
sets up complete environmentMCP Features Implemented
postgres://host/table/schema
This implementation serves as a reference for building production MCP servers while maintaining clean project architecture.