Semantic PostgreSQL MCP Server logo

Semantic PostgreSQL MCP Server

by cpenniman12

A Model Context Protocol (MCP) server that enables AI assistants like Claude to perform semantic search on PostgreSQL databases. It provides a standardized way for AI models to interact with external systems through a client-server architecture.

View on GitHub

Last updated: N/A

What is Semantic PostgreSQL MCP Server?

This is an MCP server that connects Claude (or any MCP-compatible AI assistant) to a PostgreSQL database with semantic search capabilities. It allows the AI assistant to understand your database structure semantically, execute natural language queries, perform hybrid search, and provide context-aware responses.

How to use Semantic PostgreSQL MCP Server?

First, set up your PostgreSQL database with the pgvector extension and run the provided schema.sql script. Then, clone the repository, install dependencies, configure environment variables with your PostgreSQL and OpenAI credentials, and start the server. Finally, configure Claude Desktop to connect to the MCP server by adding the server configuration to the claude_desktop_config.json file.

Key features of Semantic PostgreSQL MCP Server

  • Vector-based semantic search

  • Metadata-driven

  • No schema modification needed

  • Simple integration with Claude Desktop

Use cases of Semantic PostgreSQL MCP Server

  • Ask Claude to show customer information

  • Ask Claude what products are currently low in stock

  • Ask Claude to find orders with a total amount over $1000

  • Ask Claude to show the relationship between customers and orders

FAQ from Semantic PostgreSQL MCP Server

What is MCP?

Model Context Protocol (MCP) is an open standard developed by Anthropic that connects AI assistants to external systems where data lives.

What databases are supported?

Currently, only PostgreSQL is supported.

Do I need to modify my existing database schema?

No, your existing database tables remain unchanged; metadata is stored separately.

What is the role of OpenAI API key?

The OpenAI API key is used for generating vector embeddings for semantic search.

How does the server generate SQL queries?

The system converts your question to an embedding and finds semantically similar columns/tables. Based on the matched metadata, the system generates appropriate SQL queries.