Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ rl-mcp Public

πŸš€ Modern Model Context Protocol server - Connect AI models to your data with FastAPI + PostgreSQL. Secure, scalable, and ready to power the next generation of AI applications ✨

Notifications You must be signed in to change notification settings

rlefko/rl-mcp

Repository files navigation

πŸš€ RL-MCP: Ryan's Model Context Protocol Server

Python FastAPI PostgreSQL Docker

🎯 A powerful, scalable Model Context Protocol (MCP) server built with modern Python technologies

🌟 What is RL-MCP?

RL-MCP is a robust Model Context Protocol server designed to provide AI models with structured access to external data and services. Think of it as a bridge πŸŒ‰ that allows AI assistants to interact with your applications, databases, and APIs in a standardized, secure way.

πŸŽͺ Current Features

  • πŸ” Secure Authentication - Built-in auth system to protect your endpoints
  • πŸ“Š RESTful API - Clean, well-documented API endpoints with FastAPI
  • πŸ—„οΈ PostgreSQL Integration - Robust database layer with SQLModel/SQLAlchemy
  • 🐳 Docker Ready - Fully containerized development and deployment
  • πŸ”„ Database Migrations - Alembic-powered schema management
  • πŸ“ˆ Health Monitoring - Built-in health checks and connection monitoring
  • 🎨 Interactive Docs - Auto-generated API documentation
  • πŸ› οΈ Development Tools - Pre-commit hooks, linting, and formatting

πŸ“ˆ Stock Market Intelligence

πŸš€ Transform your applications with AI-powered financial intelligence

RL-MCP includes a comprehensive Stock Market Intelligence API that combines cutting-edge AI with real-time financial data:

🧠 AI-Powered Capabilities

  • πŸ” Vector Search: Semantic search across news, analysis, and market data using advanced NLP
  • πŸ“Š Sentiment Analysis: Real-time sentiment scoring for news and market content
  • πŸ€– Smart Analysis: AI-driven stock analysis with confidence scoring and recommendations
  • 🎯 Relevance Scoring: Intelligent content ranking and filtering

πŸ’Ή Real-Time Market Data

  • πŸ“ˆ Live Pricing: Current stock prices with change indicators and market metrics
  • πŸ“° News Intelligence: Latest financial news with sentiment analysis from multiple sources
  • 🌍 Market Overview: Comprehensive market summaries with top movers and trends
  • πŸ”₯ Trending Analysis: Most active and discussed stocks based on data volume

⚑ High-Performance Architecture

  • πŸš€ Intelligent Caching: Multi-layer caching for lightning-fast responses
  • πŸ”„ Background Processing: Async data ingestion and processing
  • πŸ“Š Performance Monitoring: Built-in health checks and cache statistics
  • πŸ›‘οΈ Enterprise-Ready: Secure, scalable, and production-ready

🎯 Use Cases

  • πŸ€– AI Trading Assistants - Portfolio analysis and trading signals
  • πŸ“Š Financial Research - Market research and competitive intelligence
  • πŸ“± Investment Apps - Smart notifications and educational content
  • 🏒 Enterprise Systems - Risk management and client reporting

πŸ“š Comprehensive Documentation

Explore our detailed stock market API documentation:

πŸš€ Future Vision

This MCP server is designed to be the foundation for AI-powered applications that need:

  • πŸ€– AI Model Integration - Seamless connection between AI models and your data
  • πŸ”Œ Plugin Architecture - Extensible system for adding new capabilities
  • πŸ“‘ Real-time Communication - WebSocket support for live data streaming
  • 🌐 Multi-tenant Support - Serve multiple clients with isolated data
  • πŸ” Advanced Search - Vector search and semantic querying capabilities
  • πŸ“Š Analytics Dashboard - Monitor usage, performance, and insights

πŸ› οΈ Technology Stack

  • 🐍 Backend: Python 3.12 + FastAPI
  • πŸ—„οΈ Database: PostgreSQL with SQLModel
  • 🐳 Containerization: Docker + Docker Compose
  • πŸ”„ Migrations: Alembic
  • πŸ§ͺ Code Quality: Black, isort, pylint, pre-commit hooks
  • πŸ“š Documentation: Auto-generated OpenAPI/Swagger docs
  • 🧠 AI/ML: Sentence Transformers, Vector Search, Sentiment Analysis

πŸš€ Quick Start

Prerequisites

  • 🐳 Docker and Docker Compose
  • 🐍 Python 3.12+ (for local development)
  • 🍺 Homebrew (macOS) or equivalent package manager

🎯 One-Command Setup

Get up and running in seconds! Our setup script handles everything:

make setup-environment

This magical command will:

  • πŸ”§ Install all required dependencies
  • 🐍 Create and configure a Python virtual environment
  • 🐳 Set up Docker containers
  • πŸ“¦ Install all Python packages
  • βœ… Verify everything is working

πŸƒβ€β™‚οΈ Running the Application

🐳 Docker Development (Recommended)

# Build and start all services
make up

# Or run in background
docker compose up -d

Your services will be available at:

🐍 Local Development

# Activate virtual environment
source venv/bin/activate

# Start the api and db at port 8000
make up

πŸ“– API Documentation

Once running, explore the interactive API documentation:

πŸ”‘ Authentication

All API endpoints require authentication. Include your auth token in requests:

curl -H "Authorization: Bearer YOUR_TOKEN" http://localhost:8000/v1/item

πŸ“ˆ Stock API Quick Example

# Search for Tesla battery technology insights
curl -X POST "http://localhost:8000/v1/stock/search" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Tesla battery technology innovations",
    "symbols": ["TSLA"],
    "similarity_threshold": 0.8,
    "limit": 10
  }'

# Get current Apple stock price
curl -H "Authorization: Bearer YOUR_TOKEN" \
     "http://localhost:8000/v1/stock/price/AAPL"

# Get market summary
curl -H "Authorization: Bearer YOUR_TOKEN" \
     "http://localhost:8000/v1/stock/market/summary"

πŸ—„οΈ Database Management

πŸ”„ Creating Migrations

When you modify database models:

MSG="Add new awesome feature" make migration

πŸ—οΈ Database Commands

# Start the api and db at port 8000
make up

# Check database health
curl http://localhost:8000/health

πŸ› οΈ Development Workflow

πŸ“¦ Managing Dependencies

# Regenerate requirements.txt with latest versions
make regen-requirements

🧹 Cleanup

# Remove all containers and volumes
make clean

πŸ” Code Quality

Pre-commit hooks automatically run:

  • 🎨 Black - Code formatting
  • πŸ“‹ isort - Import sorting
  • πŸ” Pylint - Code linting

πŸ—οΈ Project Structure

rl-mcp/
β”œβ”€β”€ πŸ“ app/                    # Main application code
β”‚   β”œβ”€β”€ πŸ“ api/               # API layer
β”‚   β”‚   └── πŸ“ v1/           # API version 1
β”‚   β”‚       β”œβ”€β”€ πŸ“ base/     # Base models and tables
β”‚   β”‚       β”œβ”€β”€ πŸ“ item/     # Item management endpoints
β”‚   β”‚       └── πŸ“ stock/    # πŸ“ˆ Stock market intelligence
β”‚   β”‚           β”œβ”€β”€ πŸ“ services/  # AI services (vector search, market data)
β”‚   β”‚           β”œβ”€β”€ πŸ“„ routes_stock.py     # Stock API endpoints
β”‚   β”‚           β”œβ”€β”€ πŸ“„ models_stock.py     # Data models
β”‚   β”‚           └── πŸ“„ controllers_stock.py # Business logic
β”‚   β”œβ”€β”€ πŸ“ databases/        # Database configuration
β”‚   └── πŸ“„ main.py          # Application entry point
β”œβ”€β”€ πŸ“ docs/                 # πŸ“š Comprehensive documentation
β”‚   └── πŸ“ stock/           # Stock API documentation
β”œβ”€β”€ πŸ“ docker/               # Docker configurations
β”œβ”€β”€ πŸ“ migrations/           # Database migrations
β”œβ”€β”€ πŸ“ scripts/             # Utility scripts
β”œβ”€β”€ πŸ“ utilities/           # Helper utilities
└── πŸ“„ Makefile            # Development commands

🀝 Contributing

We welcome contributions! πŸŽ‰

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch
  3. ✨ Make your changes
  4. πŸ§ͺ Run tests and linting
  5. πŸ“ Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

Having issues? πŸ€”


πŸš€ Built with ❀️ for the future of AI-powered applications

Ready to revolutionize how AI models interact with your data? Let's build something amazing together! ✨

πŸ“ˆ Featuring comprehensive stock market intelligence with AI-powered semantic search, real-time data, and intelligent caching πŸ€–πŸ’Ή

About

πŸš€ Modern Model Context Protocol server - Connect AI models to your data with FastAPI + PostgreSQL. Secure, scalable, and ready to power the next generation of AI applications ✨

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages