McpLLMServer
A FastAPI-based MCP server that enables LLM agents to interact with Ollama models through standardized MCP tools, with optional MySQL and Redis integration for data persistence and caching.
README
이 문서는 FastAPI 서버를 MySQL, Redis와 함께 Docker로 실행하고, Python 3.12.10 로컬 개발환경에서도 동일하게 사용할 수 있도록 구성하는 방법을 안내합니다.
🧱 아키텍처 구성
┌─────────────────────────────┐
│ Cursor / VSCode / Client │
│ (LLM Agent) │
└──────────────┬──────────────┘
│ MCP (HTTP)
▼
┌─────────────────────────────┐
│ MCP Server (FastMCP) │
│ FastAPI + MCP SDK │
│ │
│ ├── Tool Registry │
│ ├── LLM Tool │
│ └── DB Tool (optional) │
└──────────────┬──────────────┘
│
▼
┌─────────────────────────────┐
│ Ollama Server │
│ (LLM Runtime, Docker) │
└─────────────────────────────┘
- LLM(Client)은 MCP HTTP API만 호출
- FastAPI는 Tool Router + 비즈니스 로직 분리
- Redis는 캐시, MySQL은 영속 데이터 저장소 역할
🧱 전체 디렉토리 구조
mcp-llm-stack/
│
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
│
└── app/
├── main.py # FastMCP 엔트리
│
├── mcp/
│ ├── __init__.py
│ └── tools.py # MCP Tools (LLM 호출)
│
└── llm/
└── ollama_client.py # Ollama 호출 로직
📌 VS Code 디버그 세팅
다음 파일들은 디버그 모드 전용입니다.
Dockerfile_debugdocker-compose.yml_debug
👉 VS Code에서 FastAPI + Docker + breakpoints 디버깅 가능
📌 1. 실행 방법
⚠ Windows 환경에서는 Docker Desktop이 실행 중이어야 합니다.
🐳 Docker Compose 실행
docker-compose up --build
🚀 백그라운드(데몬) 실행
docker-compose up --build -d
🛑 컨테이너 종료
docker-compose down
📌 Docker 캐시 제거 (빌드 오류 시)
docker build --no-cache -t myfastapi .
📌 Docker 캐시 충돌 오류 해결
캐시 충돌로 인해 빌드 오류가 발생할 경우 아래 명령어로 해결할 수 있습니다.
docker system prune -a
⚠ 실행 시 모든 미사용 Docker 이미지/컨테이너가 제거됩니다.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.