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.
Este proyecto es una demo de un servidor MCP (Model Context Protocol) en Python, integrado con una interfaz de chat web hecha en Streamlit y un modelo de lenguaje local usando Ollama. Permite gestionar usuarios en una base de datos PostgreSQL (agregar, eliminar, modificar, consultar) tanto desde el chat como desde herramientas MCP externas.
requirements.txt
Clona el repositorio:
git clone https://github.com/tu-usuario/mcp-server-demo.git cd mcp-server-demo
Crea y activa un entorno virtual:
python -m venv .venv source .venv/bin/activate # En Linux/Mac .venv\\Scripts\\activate # En Windows
Instala las dependencias:
pip install -r requirements.txt
Configura tu base de datos PostgreSQL y ajusta los datos de conexión en server.py
.
(Opcional) Crea un archivo .env
si usas claves de API.
ollama run llama3
streamlit run streamlit.py
Abre el navegador en http://localhost:8501.
mcp run server.py
o
uv run --with mcp mcp run server.py
agregar usuario Juan juan@mail.com clave123
eliminar usuario juan@mail.com
modificar usuario juan@mail.com nombre=Juan Perez contraseña=nuevaClave
consultar usuarios
o consultar usuario juan@mail.com
¡Contribuciones y sugerencias son bienvenidas!
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!