Skip to main content
Glama
gustavo-sacchi

Financial Data MCP Server

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

Related MCP server: Agentic AI with 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:

📺 Assistir no YouTube

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

Related MCP Connectors

  • A Model Context Protocol server exposing real-time and historical Colombo Stock Exchange (CSE) data to AI agents and LLM applications. Provides quotes and OHLCV price history, full financial statements (income, balance sheet, cash flow), pre-computed technicals (moving averages, RS ratings, volume signals), macroeconomic indicators, corporate actions, and rule-based screening across CSE stocks and sector indices, everything needed to build CSE-aware trading assistants, research tools, and market-analysis agents. This is the official MCP server of www.ceyloncharts.com

  • Your agent needs markets — prices and fundamentals for listed companies, the filings behind them, crypto, and what the prediction markets put the odds at. **What you can ask for** • "Pull this company's income statement, cash flow and balance sheet for the last 8 quarters." • "What did insiders buy or sell, and when?" • "Snapshot prices for these 50 tickers, then the OHLC history for the three that moved." • "What are the current odds on this event across Kalshi and Polymarket?" • "Screen for companies matching these financial criteria." **How to use it** Point any MCP client at https://mcp.aisa.one/finance/mcp and sign in with OAuth — there is no key to create or paste. 49 tools: prices and snapshots, income statements, balance sheets and cash flows, metrics and ratios, earnings and analyst estimates, filings and line-item search, insider trades, macro interest rates, news, a screener; CoinGecko spot prices, market tables, OHLC, per-venue tickers and trending; Kalshi and Polymarket markets and trades; plus EDINET filings for Japan. **Why this rather than the source** Equities, crypto and event markets behind one account, so a cross-asset question is one conversation. **It is also a door to the rest** The same login reaches 26 sources and 580+ operations. Read the number here, then ask the same agent what X is saying about the ticker today — without adding a second server. **What it costs** Finding and inspecting an operation is free. Running one is billed per call at API prices, with no seat and no monthly minimum, and every call takes max_price_usd so an agent cannot overspend by accident. **Where else it reaches** https://mcp.aisa.one/marketpulse/mcp · /crypto-market-data/mcp · /prediction-market-data/mcp · /stock-pulse/mcp for one slice each.

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • A Model Context Protocol server for Wix AI tools

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    A Model Context Protocol server providing real-time stock data and options analysis through Yahoo Finance, enabling LLMs to access market data, analyze stocks, and evaluate options strategies.
    3
    26
    MIT
  • F
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that enhances LLM capabilities by connecting to Wikipedia, internet search (Tavily), and financial data (Yahoo Finance) tools, enabling contextual responses to user queries.
    3
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    A Model Context Protocol server built with FastMCP that provides financial data tools for AI agents, enabling them to access and analyze stock market information from Yahoo Finance through natural language queries.
    2
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    A Model Context Protocol server providing comprehensive access to Yahoo Finance data through the yahooquery library, enabling AI assistants to retrieve stock prices, financial statements, market data, and company analytics.
    14
    MIT