Skip to main content
Glama
ShanthiniJoshitha

MCP-Finance-Server

MCP-Powered Financial Intelligence Server

A lightweight financial intelligence server built with Python and FastAPI that exposes financial-data capabilities as modular tools. The project combines a tool-based architecture with an interactive agent that interprets user queries, selects the appropriate financial tool, resolves company names to stock/crypto symbols, and retrieves market information using Yahoo Finance.

๐Ÿš€ Features

  • Financial Data Retrieval โ€” Fetch current price, daily percentage change, market state, market capitalization, and trading volume.

  • Intelligent Tool Selection โ€” Determines which financial tool should handle a user's query.

  • Company & Ticker Resolution โ€” Converts common company names such as Apple or Tesla into their corresponding symbols using fuzzy matching.

  • Stock & Cryptocurrency Support โ€” Supports selected equities and cryptocurrencies such as Apple, Tesla, Microsoft, Infosys, Bitcoin, and Ethereum.

  • Specific Metric Extraction โ€” Retrieve individual metrics such as price, market cap, volume, or daily change.

  • REST API โ€” Financial capabilities are exposed through FastAPI endpoints.

  • Interactive CLI Agent โ€” Query the server through a simple command-line interface.

  • Basic Tool Demonstration โ€” Includes greeting, addition, and multiplication tools to demonstrate modular tool integration.

  • Error Handling โ€” Handles invalid symbols, unavailable metrics, and external API/network errors.

Related MCP server: FinanceKit MCP

๐Ÿ—๏ธ Architecture

                         User Query
                              โ”‚
                              โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚    Agent    โ”‚
                       โ”‚  agent.py   โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚
                    Select Financial Tool
                              โ”‚
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ–ผ                         โ–ผ
       FinancialDataFinder        GetFinancialMetric
                 โ”‚                         โ”‚
                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ–ผ
                    Symbol Resolution
                       RapidFuzz
                              โ”‚
                              โ–ผ
                    Financial Data Fetch
                         yfinance
                              โ”‚
                              โ–ผ
                    Structured Response
                              โ”‚
                              โ–ผ
                           User

๐Ÿ› ๏ธ Technologies Used

  • Python

  • FastAPI

  • Uvicorn

  • Requests

  • RapidFuzz

  • yfinance

  • REST APIs

๐Ÿ“ Project Structure

MCP_Finance_Server/
โ”‚
โ”œโ”€โ”€ agent.py                  # Interactive agent and tool-selection logic
โ”œโ”€โ”€ config.py                 # API configuration and request headers
โ”œโ”€โ”€ main.py                   # FastAPI application and API endpoints
โ”œโ”€โ”€ requirements.txt          # Python dependencies
โ”‚
โ”œโ”€โ”€ tools/
โ”‚   โ”œโ”€โ”€ basic_tools.py        # Basic demonstration tools
โ”‚   โ””โ”€โ”€ finance_tools.py      # Financial data and metric tools
โ”‚
โ””โ”€โ”€ utils/
    โ”œโ”€โ”€ fetch_data.py         # Yahoo Finance data retrieval
    โ””โ”€โ”€ matcher.py            # Company/ticker resolution using RapidFuzz

โš™๏ธ Installation

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/MCP_Finance_Server.git
cd MCP_Finance_Server

2. Create a virtual environment

python -m venv venv

3. Activate the virtual environment

Windows:

venv\Scripts\activate

Linux/macOS:

source venv/bin/activate

4. Install dependencies

pip install -r requirements.txt

โ–ถ๏ธ Running the Server

Start the FastAPI server using Uvicorn:

uvicorn main:app --reload

The server will be available at:

http://127.0.0.1:8000

FastAPI's interactive API documentation is available at:

http://127.0.0.1:8000/docs

๐Ÿ“Š API Endpoints

Health Check

GET /

Returns a message confirming that the server is running.

Greeting

GET /greet?name=Jo

Addition

GET /add?a=10&b=20

Multiplication

GET /multiply?a=10&b=20

Financial Data

GET /tool/FinancialDataFinder?symbol=AAPL

Example response:

{
  "Asset Name": "Apple Inc.",
  "Symbol": "AAPL",
  "Current Price": 000.00,
  "Daily Change (%)": 0.00,
  "Market State": "REGULAR",
  "Market Summary": "Apple Inc. is currently trading at ...",
  "Reference": "https://finance.yahoo.com/quote/AAPL"
}

Specific Financial Metric

GET /tool/GetFinancialMetric?symbol=AAPL&metric=marketcap

Supported metrics:

price
change
marketcap
volume

Example response:

{
  "Symbol": "AAPL",
  "Metric": "marketcap",
  "Value": 0000000000000
}

๐Ÿค– Using the Interactive Agent

Start the agent separately:

python agent.py

The agent accepts natural-language-style queries and determines which financial tool should be used.

Example:

๐Ÿ’ฌ Ask something: price AAPL

The agent identifies the appropriate tool, extracts the symbol, calls the FastAPI server, and displays the resulting financial information.

It also supports explicit function-style requests:

FinancialDataFinder("TSLA")

or:

GetFinancialMetric("AAPL","MarketCap")

๐Ÿ” Symbol Resolution

The project includes a fuzzy-matching layer using RapidFuzz.

For example, known company names can be resolved to their corresponding symbols:

Company / Asset

Symbol

Apple

AAPL

Google

GOOG

Tesla

TSLA

Infosys

INFY

Microsoft

MSFT

Bitcoin

BTC-USD

Ethereum

ETH-USD

This allows the financial tools to accept either recognized company names or ticker symbols.

๐Ÿ”„ How It Works

  1. The user enters a financial query.

  2. The agent analyzes the query and determines the required tool.

  3. The requested symbol/company is extracted.

  4. The symbol resolver validates or maps the input to a known ticker.

  5. The financial tool requests market information through yfinance.

  6. Relevant financial metrics are extracted.

  7. The server returns a structured JSON response.

  8. The agent displays the result to the user.

๐ŸŽฏ Project Objective

The goal of this project is to demonstrate how financial capabilities can be organized into modular, callable tools and exposed through a lightweight API server. It provides a foundation for integrating financial data retrieval with agent-based applications and MCP-style tool architectures.

๐Ÿ”ฎ Future Enhancements

  • Expand support for additional stocks, ETFs, indices, and cryptocurrencies.

  • Replace rule-based tool selection with an LLM-based agent.

  • Implement the official MCP protocol for native MCP client compatibility.

  • Add authentication and API access control.

  • Add caching to reduce repeated financial-data requests.

  • Add historical price and charting capabilities.

  • Add Docker-based deployment.

  • Add automated testing and CI/CD.

  • Build a web interface for interacting with the financial tools.

๐Ÿ“Œ Disclaimer

Financial information retrieved by this project is intended for educational and software-development purposes only. It should not be considered financial advice. Market data may be delayed, incomplete, or unavailable depending on the external data provider.

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Shanthini Joshitha

Built as a software engineering project exploring FastAPI, financial APIs, intelligent tool selection, and MCP-style architectures.

Related MCP Connectors

  • Financial data MCP server for Claude, ChatGPT, Cursor and Codex. Real-time stock quotes, financial statements, options flow, SEC filings, insider trades, 13F holdings, macro data and market news from gloom.sh, the open-source Bloomberg Terminal alternative.

  • Stock market data for AI agents: real-time quotes, financials, options, SEC filings and news.

  • Agent-native SEC filing data: statements assembled, filings read and synthesized. No API key.

  • 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.

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Provides AI agents with real-time financial market intelligence including stock quotes, crypto data, technical analysis, and portfolio insights. Enables natural language queries for current prices, technical indicators, asset comparisons, and portfolio analysis.
    17
    7
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables LLMs to access stock market and cryptocurrency data through the Financial Datasets API, including financial statements, prices, metrics, and press releases.
    17 npm
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Provides stock market data and analysis tools using the Finnhub API, including stock prices, financial metrics, news, and historical data.
    6
    7
    -