Financial Data MCP Server
A Model Context Protocol server that provides financial tools for retrieving real-time stock data, analyst recommendations, financial statements, and web search capabilities for a LangGraph-powered ReAct agent.
README
Tutorial MCP + LangGraph
Este projeto demonstra como integrar o Model Context Protocol (MCP) com LangGraph para criar um agente ReAct inteligente que pode acessar dados financeiros em tempo real.
Objetivo
- Como criar um servidor MCP com ferramentas personalizadas
- Como conectar um agente LangGraph ao servidor MCP
- Como implementar memoria de conversacao persistente
- Como usar ferramentas de analise financeira via MCP
Pre-requisitos
- Python 3.13+
- Chaves de API do OpenAI e/ou Groq
- FastMCP
- LangGraph MCP Adapter
Instalacao
1. Instalar UV (Gerenciador de Pacotes Python)
Windows:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
2. Clonar e Configurar o Projeto
# Clone o repositorio
git clone https://github.com/gustavo-sacchi/tutorial_mcp_langgraph.git
cd tutorial_mcp_langgraph
# Instale as dependencias e crie o ambiente virtual
uv sync
# Configure as variaveis de ambiente
cp .env.exemple .env
3. Configurar Chaves de API
Edite o arquivo .env e adicione suas chaves:
OPENAI_API_KEY=sua-chave-openai-aqui
GROQ_API_KEY=sua-chave-groq-aqui
Como Usar
1. Iniciar o Servidor MCP
Em um terminal:
uv run server_mcp.py
O servidor estara disponivel em http://localhost:4200
2. Executar o Cliente (Agente)
Em outro terminal:
uv run client_mcp.py
3. Interagir com o Agente
Agora voce pode fazer perguntas sobre financas:
User: Qual e o preco atual da acao da Apple?
User: Me de um resumo completo da VALE3.SA
User: Pesquise noticias recentes sobre investimentos em IA
Testando o MCP
Para testar a interface MCP diretamente:
npx @modelcontextprotocol/inspector uv run server_mcp.py
Arquitetura
┌─────────────────┐ HTTP ┌─────────────────┐
│ Client │◄──────────►│ MCP Server │
│ (LangGraph) │ │ (FastMCP) │
│ │ │ │
│ • ChatOpenAI │ │ • YFinance │
│ • ReAct Agent │ │ • DuckDuckGo │
│ • Memory │ │ • Web Scraping │
└─────────────────┘ └─────────────────┘
Ferramentas Disponiveis
O servidor MCP fornece estas ferramentas financeiras:
- Resumo de Acoes: Preco, volume e data
- Estimativas de Analistas: Precos-alvo
- Recomendacoes: Buy/Hold/Sell
- Dividendos: Historico de pagamentos
- Setor/Industria: Classificacao da empresa
- Demonstracoes Financeiras: Balanco, DRE, Fluxo de Caixa
- Pesquisa Web: Noticias e conteudo relevante
Video Tutorial
Este projeto foi criado para acompanhar o tutorial no YouTube. Assista ao video completo para entender todos os detalhes da implementacao:
Personalizacao
- Modelos: Altere entre OpenAI e Groq no
client_mcp.py - Transporte: Configure HTTP ou stdio no
server_mcp.py - Ferramentas: Adicione novas ferramentas MCP no servidor
- Prompts: Customize os prompts disponiveis
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.