Integrates with Ollama to provide local LLM capabilities (using Llama 3 or other compatible models) for processing natural language queries and responding to free-form conversation.
Manages user data in a PostgreSQL database, supporting CRUD operations (add, delete, modify, query) for user profiles with details like names and email addresses.
Provides a web-based chat interface built with Streamlit, allowing users to interact with the system through natural language commands for database operations and free conversation.
MCP Server Demo with Streamlit and Ollama
This project is a demo of a Model Context Protocol (MCP) server in Python, integrated with a web chat interface built in Streamlit and a local language model using Ollama. It allows users to manage users in a PostgreSQL database (add, delete, modify, and query) both from the chat and from external MCP tools.
Characteristics
- Web chat with Streamlit.
- Local LLM using Ollama (Llama 3 or other compatible model).
- MCP server with tools for user CRUD.
- PostgreSQL database for storing users.
- Flexible integration : You can use just the chat, just the MCP server, or both.
Requirements
- Python 3.9+
- PostgreSQL running and accessible
- Ollama installed and running (for local LLM)
- Virtual environment (recommended)
- Dependencies in the
requirements.txt
file
Facility
- Clone the repository:
- Create and activate a virtual environment:
- Install the dependencies:
- Configure your PostgreSQL database and configure the connection details in
server.py
. - (Optional) Create a
.env
file if you use API keys.
Use
1. Levanta Ollama and the LLM model
2. Open the Streamlit chat
Open your browser at http://localhost:8501 .
3. (Optional) Start the MCP server
either
Chat Features
- Add user:
Write:agregar usuario Juan juan@mail.com clave123
- Delete user:
Type:eliminar usuario juan@mail.com
- Modify user:
Type:modificar usuario juan@mail.com nombre=Juan Perez contraseña=nuevaClave
- Consult users:
Write:consultar usuarios
orconsultar usuario juan@mail.com
- Free conversation:
If the message is not an action, the local LLM responds.
Credits
Contributions and suggestions are welcome!
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
A Python-based Model Context Protocol server with Streamlit chat interface that allows users to manage a PostgreSQL database through both web UI and MCP tools, powered by Ollama for local LLM integration.
Related MCP Servers
- -securityFlicense-qualityAn interactive chat interface that combines Ollama's LLM capabilities with PostgreSQL database access through the Model Context Protocol (MCP). Ask questions about your data in natural language and get AI-powered responses backed by real SQL queries.Last updated -28TypeScript
- -securityFlicense-qualityA Model Context Protocol server providing both read and write access to PostgreSQL databases, enabling LLMs to query data, modify records, and manage database schemas.Last updated -4JavaScript
- -securityAlicense-qualityA Model Context Protocol server that enables powerful PostgreSQL database management capabilities including analysis, schema management, data migration, and monitoring through natural language interactions.Last updated -5821TypeScriptAGPL 3.0
- -securityFlicense-qualityA Model Context Protocol server that enables performing PostgreSQL database operations (create, read, update, delete) on User and Post entities through MCP tools.Last updated -TypeScript