Blog

How to Build a Multi-Source Financial AI Agent with APIs and MCP

Explore how to design a multi-source financial AI agent that combines stock data, SEC filings, prediction market expectations, and FX rates through APIs and MCP

Multi-Source Financial AI Agent with APIs and MCP

Financial research rarely depends on a single dataset. Understanding a company's performance, market reaction, or exposure to external risks requires combining market prices, regulatory disclosures, forward-looking expectations, and currency movements.

A multi-source financial AI agent brings these datasets together through structured API calls and Model Context Protocol (MCP) tools. Rather than relying on an LLM's existing knowledge, it retrieves, aligns, and analyzes financial evidence before generating a response.

With FinFeedAPI, developers can build this architecture using historical stock market data, SEC filings, prediction market data, and foreign exchange rates within a common provider ecosystem.

The challenge is not simply connecting an AI model to financial APIs.

It is designing a system that produces traceable, reproducible, and evidence-based financial research.

A well-designed financial research agent separates information into four complementary categories. Each answers a different financial question.

Data LayerFinancial QuestionFinFeedAPI Product
Market pricesHow did the market react?Stock Historical API
Regulatory eventsWhat has the company disclosed?SEC API
Forward-looking expectations What outcomes is the market pricing in?Prediction Markets API
Currency contextWhat external currency movements could affect the analysis?Currencies AP
financial data layers within a multi-source AI research system

Figure 1. Four complementary financial data layers within a multi-source AI research system.

The FinFeedAPI Stock Historical API provides historical daily and intraday OHLCV, exchange and symbol metadata, and native IEX datasets, including trades, quotes, and order book events.

An agent can use this data to calculate event-window returns, analyze trading activity, investigate historical volatility, or compare securities across exchanges.

Stock data is delivered on a historical T+1 basis, rather than as a live equity market feed.

The SEC API gives agents access to corporate disclosures, including 10-K, 10-Q, and 8-K filings.

Available workflows include:

  • Filing discovery and full-text search.
  • Extraction of specific filing sections.
  • Original document downloads.
  • XBRL-to-JSON conversion.
  • WebSocket notifications for newly published filings.

These capabilities allow agents to retrieve relevant financial statements and corporate disclosures without passing entire unfiltered documents into an LLM.

The Prediction Markets API provides a separate layer of forward-looking market information across supported venues, including Polymarket and Kalshi.

Depending on endpoint and venue availability, agents can retrieve market metadata, outcome prices, OHLCV, trades, quotes, and order books.

This allows the research system to investigate changes in market-implied expectations around economic releases, political developments, regulatory decisions, and other events.

Prediction market prices should be treated as market-derived expectation signals, not objective forecasts or guaranteed probabilities.

The Currencies API provides real-time and historical exchange rates, alongside historical OHLC time series.

Agents can use FX data to investigate currency exposure, international revenue sensitivity, cross-border market performance, and currency-adjusted returns.

FX movements provide additional context but do not independently establish the cause of a stock price change.

Model Context Protocol enables AI applications to discover available tools, inspect their parameters, and request financial data programmatically.

Instead of manually defining every API operation inside an agent, developers can connect dedicated FinFeedAPI MCP servers.

The Flat Files MCP server additionally supports discovering bulk historical datasets and storage objects for larger research and backtesting workflows.

Consider an analyst asking:

How did a company's stock react to its latest earnings disclosure, and did broader market expectations change during the same period?

The agent should first discover the necessary tools, resolve the company and security identifiers, locate the relevant filing, and determine which historical datasets cover the event.

Only then should it retrieve the evidence required to answer the question.

A typical MCP configuration can include multiple financial data servers:

1{
2  "mcpServers": {
3    "FinFeedAPI-Stocks": {
4      "url": "https://api-historical.stock.finfeedapi.com/mcp",
5      "headers": {
6        "X-APIKey": "YOUR_API_KEY"
7      }
8    },
9    "FinFeedAPI-SEC": {
10      "url": "https://api.sec.finfeedapi.com/mcp",
11      "headers": {
12        "X-APIKey": "YOUR_API_KEY"
13      }
14    },
15    "FinFeedAPI-PredictionMarkets": {
16      "url": "https://api.prediction-markets.finfeedapi.com/mcp",
17      "headers": {
18        "X-APIKey": "YOUR_API_KEY"
19      }
20    },
21    "FinFeedAPI-FX": {
22      "url": "https://api-historical.fx.finfeedapi.com/mcp",
23      "headers": {
24        "X-APIKey": "YOUR_API_KEY"
25      }
26    }
27  }
28}

Configuration syntax may vary between MCP clients.

MCP is not a replacement for REST, WebSocket, or JSON-RPC. A production financial agent can combine MCP-based discovery and retrieval with direct API integrations, streaming event ingestion, and historical batch processing.

A production-ready financial research agent should separate data retrieval, evidence processing, model reasoning, and output validation into distinct layers.

This separation makes the system easier to maintain, test, audit, and scale.

architecture for a multi-source financial AI research agent

Figure 2. Recommended architecture for a multi-source financial AI research agent.

The orchestrator receives a research question or an event trigger and determines which financial datasets are needed.

Its responsibilities include identifying companies, resolving instruments, selecting tools, defining time windows, and managing dependencies between requests.

Not every question requires all four data sources. Unnecessary retrieval increases processing costs without necessarily improving the analysis.

Each connected API or MCP server serves a specialized purpose:

ToolAgent responsability
Stock toolRetrieve historical prices, volume, trades, and market activity
SEC toolDiscover disclosures, extract sections, and retrieve financial facts
Prediction market toolDiscover relevant contracts and analyze expectation changes
FX toolRetrieve currency rates and historical exchange-rate movements

Independent requests can run in parallel, while dependent requests should wait until the necessary identifiers or event timestamps have been resolved.

The evidence store preserves the information retrieved during research, including:

  • Filing excerpts, CIKs, and accession numbers.
  • Stock symbols, exchange identifiers, and historical observations.
  • Prediction market identifiers, outcomes, prices, and contract metadata.
  • Currency pairs, exchange rates, and observation timestamps.
  • Original responses, query parameters, and retrieval timestamps.

This creates an auditable record of the information used to generate each research output.

The LLM receives relevant, structured evidence rather than being treated as the primary financial data source.

It interprets disclosures, compares market behavior, identifies relationships, and explains potential implications.

Calculations such as returns, volatility, currency conversions, and financial ratios should preferably be performed by deterministic application logic rather than generated directly by the model.

The final layer checks whether the research output is supported by retrieved evidence before publishing it as an analyst brief, dashboard entry, alert, or structured JSON response.

Unsupported conclusions should be removed or explicitly marked as uncertain.

Using a common financial data provider simplifies integration, but it does not mean that every dataset uses an identical schema.

Stock candles, SEC filings, prediction market contracts, and FX observations represent fundamentally different financial objects.

DatasetRelevant identifiersData structure
StocksExchange ID, symbol IDOHLCV, trades, quotes
SEC filingsCIK, accession number, form typeMetadata, text, financial facts
Prediction marketsExchange ID, market ID, outcomePrices, activity, contract metadata
FXBase asset, quote assetExchange rates, OHLC

The agent therefore needs an application-level normalization layer that preserves dataset-specific information while making records interoperable.

Application-level normalization without losing dataset-specific financial information

Figure 3. Application-level normalization without losing dataset-specific financial information.

A practical approach is to wrap retrieved records in a standardized evidence envelope while retaining their original payloads.

For example:

1{
2  "evidence_id": "evidence_001",
3  "provider": "FinFeedAPI",
4  "dataset": "stock_ohlcv",
5  "entity_id": "IEXG:AAPL",
6  "event_time": "2025-04-07T14:30:00Z",
7  "available_at": null,
8  "retrieved_at": "2025-04-09T09:00:00Z",
9  "source_reference": {
10    "exchange_id": "IEXG",
11    "symbol_id": "AAPL",
12    "period_id": "1MIN"
13  },
14  "schema_version": "1.0",
15  "payload": {
16    "price_open": 185.20,
17    "price_close": 185.45,
18    "volume_traded": 12500
19  }
20}

This is an illustrative application-level schema, not a native FinFeedAPI response. The values are synthetic.

The same envelope can contain an SEC filing excerpt, a prediction market observation, or an exchange-rate record without forcing them into an identical financial data structure.

A company ticker alone is not a sufficient universal identifier.

The agent must establish relationships between corporate entities, securities, trading venues, currencies, and relevant prediction market contracts.

For prediction markets, this requires an additional relevance check based on the contract's underlying event, outcome, expiration, and resolution conditions.

A prediction market mentioning a company or economic event is not necessarily an appropriate signal for that company's stock.

One of the most important challenges in multi-source financial research is aligning information across datasets with different publication schedules, trading sessions, and observation frequencies.

An SEC filing can appear outside stock exchange trading hours. Prediction markets may continue trading overnight. Currency markets follow different schedules from equities.

Additionally, the time at which an event occurred is not necessarily the time at which the corresponding data became available to the agent.

TimestampPurpose
Event timeWhen the underlying event occurred
Publication timeWhen information was publicly released
Observation timeWhen a price or rate was recorded
Availability timeWhen the record became accessible to the system
Retrieval timeWhen the agent requested or received the data

All timestamps should be normalized to UTC while preserving their original meaning.

Aligning an after-hours SEC disclosure with markets operating on different schedules. Trading hours are illustrative.

Figure 4. Aligning an after-hours SEC disclosure with markets operating on different schedules. Trading hours are illustrative.

A historical research agent must not use information that became available after the time being analyzed.

For example, when reconstructing an investment research scenario as of a particular date, the agent should exclude:

  • Filings published after the research cutoff.
  • Candles that had not yet completed.
  • Financial statement revisions unavailable at that time.
  • Prediction market outcomes that were resolved later.
  • Records not yet accessible under the dataset's delivery schedule.

This distinction is particularly important when combining live SEC filing notifications with T+1 historical stock data.

The agent may produce an immediate disclosure summary when a filing arrives, then update the research output with historical price-reaction analysis once the relevant stock data becomes available.

Research objective: Identify material corporate events and analyze the associated market reaction.

Trigger: A newly published 8-K filing.

The agent:

  1. Receives a filing notification through the SEC WebSocket API.
  2. Retrieves the relevant 8-K items and classifies the disclosed event.
  3. Resolves the associated security and exchange.
  4. Retrieves historical stock candles or trades around the event once available.
  5. Checks relevant prediction markets and FX movements where applicable.

Output: A corporate event summary containing the original disclosure, observed stock price reaction, relevant expectation changes, and supporting source references.

This architecture separates what the company disclosed from what subsequently happened in the market.

Research objective: Combine reported financial performance with market reaction and external expectations.

Trigger: A new earnings-related filing.

The agent retrieves the relevant 10-Q, 10-K, or 8-K filing and extracts financial facts using XBRL-to-JSON where supported.

It then compares reported financial performance across periods, retrieves historical stock activity, and investigates relevant prediction market and currency movements.

EvidenceAnalysis
XBRL financial factsRevenue, margins, earnings, cash flow
Filing sectionsManagement explanations and disclosures
Historical stock pricesEvent-window returns and volume
Prediction marketsRelevant expectation changes
FX historyCurrency-related financial context

Output: A structured earnings brief combining reported results, historical market reaction, and external financial context.

The agent should validate reporting periods, accounting units, currency denominations, and financial fact definitions before comparing figures.

Research objective: Identify changes in a company's disclosed risk profile.

Trigger: A new periodic filing or an analyst research request.

The agent retrieves the Risk Factors sections from the latest and previous relevant filings, identifies substantive changes, and evaluates supporting market information.

For example, a newly disclosed supply chain risk could be analyzed alongside historical stock volatility, related geopolitical prediction markets, and movements in relevant currency pairs.

Output: A risk-change report distinguishing newly disclosed risks, modified disclosures, historical market observations, and potential implications.

The original filing excerpts remain attached to the analysis so that researchers can verify the model's interpretation.

Research objective: Identify companies potentially exposed to currency movements or macroeconomic developments.

Trigger: A significant FX movement or a change in relevant market expectations.

The agent monitors exchange rates, searches SEC disclosures for currency-related risks, retrieves historical stock market data, and optionally analyzes prediction markets associated with relevant macroeconomic events.

For a company with substantial international operations, the system can investigate whether currency movements coincide with changes in its stock performance and previously disclosed exposures.

Output: A portfolio research brief identifying potentially affected companies, documented exposures, historical market behavior, and relevant external signals.

The agent should distinguish disclosed exposure from estimated financial sensitivity rather than treating them as equivalent.

A reliable financial AI agent should never generate financial conclusions before determining whether the necessary evidence exists.

The recommended execution sequence is retrieval first, analysis second, and validation third.

Figure 5. Evidence retrieval, model reasoning, and validation as separate execution stages. Failed validation requires revision, additional retrieval, or an explicit insufficient-evidence response.

Each research output should distinguish three types of information:

Information typeExample
Retrieved factThe company disclosed increased foreign currency exposure
Calculated observationThe stock declined 2.4% during the selected trading window
Model interpretationCurrency exposure may have contributed to investor concerns

These illustrative statements represent different levels of certainty.

The first is supported by a filing, the second by a reproducible calculation, and the third is an interpretation that requires appropriate qualification.

Moving from a prototype to a production financial research agent introduces additional engineering requirements.

RequirementsRecommended approach
Tool discoveryInspect and version MCP tool schemas API efficiency
API efficiencyCache metadata and parallelize independent requests
Event processingDeduplicate filing notifications and support replay
Historical researchPreserve point-in-time availability and original records
Large datasetsDiscover bulk files through MCP and process them externally
Context managementPass relevant excerpts and calculated results rather than entire datasets
SecurityKeep API credentials outside prompts and treat retrieved content as untrusted data
ObservabilityLog tool calls, execution failures, evidence references, and model outputs

For large historical workloads, the agent should act as a research orchestrator rather than processing millions of market observations directly inside its context window.

External analytical systems can perform time-series calculations, statistical analysis, and dataset joins, while the model interprets the resulting evidence.

This hybrid architecture combines the flexibility of LLM reasoning with the reproducibility of conventional financial data engineering.

Financial AI becomes more useful when its conclusions are connected to verifiable financial evidence.

FinFeedAPI brings historical stock market data, structured SEC filings, prediction market data, and foreign exchange rates into one developer ecosystem, with dedicated MCP servers and programmatic API access.

Start with $25 in free credits, connect your first MCP server, and build a financial research agent that retrieves, compares, and analyzes real financial data rather than relying on generated assumptions.

Explore FinFeedAPI MCP

Explore financial data products

Get your API key

Recent Articles

FinFeedAPI Blog - How to Build a Multi-Source Financial AI Agent with APIs and MCP