# Marketstack

```json
{
  "name": "Marketstack",
  "slug": "marketstack",
  "url": "https://composio.dev/toolkits/marketstack",
  "markdown_url": "https://composio.dev/toolkits/marketstack.md",
  "logo_url": "https://logos.composio.dev/api/marketstack",
  "categories": [
    "analytics & data",
    "finance & accounting"
  ],
  "is_composio_managed": false,
  "updated_at": "2026-03-29T06:41:39.139Z"
}
```

![Marketstack logo](https://logos.composio.dev/api/marketstack)

## Description

Securely connect your AI agents and chatbots (Claude, ChatGPT, Cursor, etc) with Marketstack MCP or direct API to fetch real-time prices, look up historical quotes, analyze stock performance, and discover ticker information through natural language.

## Summary

Marketstack is a financial data API offering real-time, intraday, and historical stock data for 125,000+ tickers across 72+ global exchanges. Instantly access accurate market insights for trading, analytics, and research.

## Categories

- analytics & data
- finance & accounting

## Toolkit Details

- Tools: 10

## Images

- Logo: https://logos.composio.dev/api/marketstack

## Authentication

- **Api Key**
  - Type: `api_key`
  - Description: Api Key authentication for Marketstack.
  - Setup:
    - Configure Api Key credentials for Marketstack.
    - Use the credentials when creating an auth config in Composio.

## Suggested Prompts

- Get the latest price for AAPL.
- Show historical prices for TSLA last month.
- List top gainers on NYSE today.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `MARKETSTACK_GET_DIVIDENDS` | Get Dividends | Tool to retrieve stock dividend data for one or more ticker symbols from Marketstack API. Use when you need historical dividend payment information for stocks, including dividend amounts and payment dates. |
| `MARKETSTACK_GET_EOD` | Get End-of-Day Data | Tool to retrieve end-of-day (EOD) stock data for one or multiple ticker symbols. Returns OHLCV data (open, high, low, close, volume) along with adjusted prices, dividends, and split factors. Use when you need historical daily stock prices or market data analysis. |
| `MARKETSTACK_GET_EXCHANGE` | Get Exchange Info | Tool to retrieve detailed information for a specific stock exchange by its MIC (Market Identifier Code). Use when you need comprehensive information about an exchange including its location, status, and operational details. |
| `MARKETSTACK_GET_SPLITS` | Get Stock Splits | Tool to retrieve stock split data for one or more stock symbols from Marketstack. Use when you need historical split information including split factors and dates. |
| `MARKETSTACK_GET_TICKER_EOD_DATA` | Get Ticker EOD Data | Tool to retrieve end-of-day stock price data for a specific ticker symbol. Use when you need historical daily price information including open, high, low, close, volume, and adjusted values. |
| `MARKETSTACK_GET_TICKER_EOD_LATEST` | Get Ticker EOD Latest | Tool to retrieve end-of-day (EOD) stock data for the latest available date for a specific ticker. Use when you need the most recent trading day data for a stock symbol. |
| `MARKETSTACK_GET_TICKER_INFO` | Get Ticker Info | Tool to retrieve detailed information about stock tickers including exchange, sector, and industry data. Use when you need comprehensive company information for a ticker symbol. |
| `MARKETSTACK_LIST_CURRENCIES` | List Currencies | Tool to retrieve a list of all supported currencies from the Marketstack API. Use when you need to get information about available currencies for stock market data. |
| `MARKETSTACK_LIST_STOCK_EXCHANGES` | List Stock Exchanges | Tool to retrieve information about supported stock exchanges. Use when you need to list or search for stock exchanges from the 2700+ exchanges available in Marketstack. |
| `MARKETSTACK_LIST_TICKERS` | List Tickers | Tool to get a list of all supported stock tickers. Use when you need to obtain the full list of tickers supported by Marketstack or search for specific tickers. |

## Supported Triggers

None listed.

## Installation and MCP Setup

### Path 1: SDK Installation

#### Path 1, Step 1: Install Composio

Install the Composio SDK
```python
pip install composio_openai
```

```typescript
npm install @composio/openai
```

#### Path 1, Step 2: Initialize Composio and Create Tool Router Session

Import and initialize Composio client, then create a Tool Router session
```python
from openai import OpenAI
from composio import Composio
from composio_openai import OpenAIResponsesProvider

composio = Composio(provider=OpenAIResponsesProvider())
openai = OpenAI()
session = composio.create(user_id='your-user-id')
```

```typescript
import OpenAI from 'openai';
import { Composio } from '@composio/core';
import { OpenAIResponsesProvider } from '@composio/openai';

const composio = new Composio({
  provider: new OpenAIResponsesProvider(),
});
const openai = new OpenAI({});
const session = await composio.create('your-user-id');
```

#### Path 1, Step 3: Execute Marketstack Tools via Tool Router with Your Agent

Get tools from Tool Router session and execute Marketstack actions with your Agent
```python
tools = session.tools
response = openai.responses.create(
  model='gpt-4.1',
  tools=tools,
  input=[{
    'role': 'user',
    'content': 'Get the latest price for AAPL stock.'
  }]
)
result = composio.provider.handle_tool_calls(
  response=response,
  user_id='your-user-id'
)
print(result)
```

```typescript
const tools = session.tools;
const response = await openai.responses.create({
  model: 'gpt-4.1',
  tools: tools,
  input: [{
    role: 'user',
    content: 'Get the latest price for AAPL stock.'
  }],
});
const result = await composio.provider.handleToolCalls(
  'your-user-id',
  response.output
);
console.log(result);
```

### Path 2: MCP Server Setup

#### Path 2, Step 1: Install Composio

Install the Composio SDK for Python or TypeScript
```python
pip install composio claude-agent-sdk
```

```typescript
npm install @composio/core ai @ai-sdk/openai @ai-sdk/mcp
```

#### Path 2, Step 2: Initialize Client and Create Tool Router Session

Import and initialize the Composio client, then create a Tool Router session for Marketstack
```python
from composio import Composio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions

composio = Composio(api_key='your-composio-api-key')
session = composio.create(user_id='your-user-id')
url = session.mcp.url
```

```typescript
import { Composio } from '@composio/core';

const composio = new Composio({ apiKey: 'your-api-key' });
const session = await composio.create('your-user-id');
console.log(`Tool Router session created: ${session.mcp.url}`);
```

#### Path 2, Step 3: Connect to AI Agent

Use the MCP server with your AI agent (Anthropic Claude or Mastra)
```python
import asyncio

options = ClaudeAgentOptions(
    permission_mode='bypassPermissions',
    mcp_servers={
        'tool_router': {
            'type': 'http',
            'url': url,
            'headers': {
                'x-api-key': 'your-composio-api-key'
            }
        }
    },
    system_prompt='You are a helpful assistant with access to Marketstack tools.',
    max_turns=10
)

async def main():
    async with ClaudeSDKClient(options=options) as client:
        await client.query('Get the historical closing prices for TSLA in the last month.')
        async for message in client.receive_response():
            if hasattr(message, 'content'):
                for block in message.content:
                    if hasattr(block, 'text'):
                        print(block.text)

asyncio.run(main())
```

```typescript
import { openai } from '@ai-sdk/openai';
import { experimental_createMCPClient as createMCPClient } from '@ai-sdk/mcp';
import { generateText } from 'ai';

const client = await createMCPClient({
  transport: {
    type: 'http',
    url: session.mcp.url,
    headers: {
      'x-api-key': 'your-composio-api-key',
    },
  },
});

const tools = await client.tools();
const { text } = await generateText({
  model: openai('gpt-4o'),
  tools,
  messages: [{
    role: 'user',
    content: 'Get the historical closing prices for TSLA in the last month.'
  }],
  maxSteps: 5,
});

console.log(`Agent: ${text}`);
```

## Why Use Composio?

### 1. AI Native Marketstack Integration

- Supports both Marketstack MCP and direct API based integrations
- Structured, LLM-friendly schemas for reliable tool execution
- Rich coverage for reading, writing, and querying your Marketstack data

### 2. Managed Auth

- Built-in OAuth handling with automatic token refresh and rotation
- Central place to manage, scope, and revoke Marketstack access
- Per user and per environment credentials instead of hard-coded keys

### 3. Agent Optimized Design

- Tools are tuned using real error and success rates to improve reliability over time
- Comprehensive execution logs so you always know what ran, when, and on whose behalf

### 4. Enterprise Grade Security

- Fine-grained RBAC so you control which agents and users can access Marketstack
- Scoped, least privilege access to Marketstack resources
- Full audit trail of agent actions to support review and compliance

## Use Marketstack with any AI Agent Framework

Choose a framework you want to connect Marketstack with:

- [OpenAI Agents SDK](https://composio.dev/toolkits/marketstack/framework/open-ai-agents-sdk)
- [Claude Agent SDK](https://composio.dev/toolkits/marketstack/framework/claude-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/marketstack/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/marketstack/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/marketstack/framework/codex)
- [OpenClaw](https://composio.dev/toolkits/marketstack/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/marketstack/framework/hermes-agent)
- [Google ADK](https://composio.dev/toolkits/marketstack/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/marketstack/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/marketstack/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/marketstack/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/marketstack/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/marketstack/framework/crew-ai)
- [Pydantic AI](https://composio.dev/toolkits/marketstack/framework/pydantic-ai)
- [AutoGen](https://composio.dev/toolkits/marketstack/framework/autogen)

## Related Toolkits

- [Firecrawl](https://composio.dev/toolkits/firecrawl) - Firecrawl automates large-scale web crawling and data extraction. It helps organizations efficiently gather, index, and analyze content from online sources.
- [Tavily](https://composio.dev/toolkits/tavily) - Tavily offers powerful search and data retrieval from documents, databases, and the web. It helps teams locate and filter information instantly, saving hours on research.
- [Exa](https://composio.dev/toolkits/exa) - Exa is a data extraction and search platform for gathering and analyzing information from websites, APIs, or databases. It helps teams quickly surface insights and automate data-driven workflows.
- [Serpapi](https://composio.dev/toolkits/serpapi) - SerpApi is a real-time API for structured search engine results. It lets you automate SERP data collection, parsing, and analysis for SEO and research.
- [Peopledatalabs](https://composio.dev/toolkits/peopledatalabs) - Peopledatalabs delivers B2B data enrichment and identity resolution APIs. Supercharge your apps with accurate, up-to-date business and contact data.
- [Stripe](https://composio.dev/toolkits/stripe) - Stripe is a global online payments platform offering APIs for managing payments, customers, and subscriptions. Trusted by businesses for secure, efficient, and scalable payment processing worldwide.
- [Snowflake](https://composio.dev/toolkits/snowflake) - Snowflake is a cloud data warehouse built for elastic scaling, secure data sharing, and fast SQL analytics across major clouds.
- [Posthog](https://composio.dev/toolkits/posthog) - PostHog is an open-source analytics platform for tracking user interactions and product metrics. It helps teams refine features, analyze funnels, and reduce churn with actionable insights.
- [Alpha vantage](https://composio.dev/toolkits/alpha_vantage) - Alpha Vantage is a financial data platform offering real-time and historical stock market APIs. Get instant, reliable access to equities, forex, and technical analysis data for smarter trading decisions.
- [Altoviz](https://composio.dev/toolkits/altoviz) - Altoviz is a cloud-based billing and invoicing platform for businesses. It streamlines online payments, expense tracking, and customizable invoice management.
- [Amplitude](https://composio.dev/toolkits/amplitude) - Amplitude is a digital analytics platform for product and behavioral data insights. It helps teams analyze user journeys and make data-driven decisions quickly.
- [Benzinga](https://composio.dev/toolkits/benzinga) - Benzinga provides real-time financial news and data APIs for market coverage. It helps you track breaking news and actionable market insights instantly.
- [Brex](https://composio.dev/toolkits/brex) - Brex provides corporate credit cards and spend management tailored for startups and tech businesses. It helps optimize company cash flow, streamline accounting, and accelerate business growth.
- [Bright Data MCP](https://composio.dev/toolkits/brightdata_mcp) - Bright Data MCP is an AI-powered web scraping and data collection platform. Instantly access public web data in real time with advanced scraping tools.
- [Browseai](https://composio.dev/toolkits/browseai) - Browseai is a web automation and data extraction platform that turns any website into an API. It's perfect for monitoring websites and retrieving structured data without manual scraping.
- [Chaser](https://composio.dev/toolkits/chaser) - Chaser is accounts receivable automation software that sends invoice reminders and helps businesses get paid faster. It streamlines the collections process to save time and improve cash flow.
- [ClickHouse](https://composio.dev/toolkits/clickhouse) - ClickHouse is an open-source, column-oriented database for real-time analytics and big data processing using SQL. Its lightning-fast query performance makes it ideal for handling large datasets and delivering instant insights.
- [Clientary](https://composio.dev/toolkits/clientary) - Clientary is a platform for managing clients, invoices, projects, proposals, and more. It streamlines client work and saves you serious admin time.
- [Coinbase](https://composio.dev/toolkits/coinbase) - Coinbase is a platform for buying, selling, and storing cryptocurrency. It makes exchanging and managing crypto simple and secure for everyone.
- [Coinmarketcal](https://composio.dev/toolkits/coinmarketcal) - CoinMarketCal is a community-powered crypto calendar for upcoming events, announcements, and releases. It helps traders track market-moving developments and stay ahead in the crypto space.

## Frequently Asked Questions

### Do I need my own developer credentials to use Marketstack with Composio?

Yes, Marketstack requires you to configure your own API key credentials. Once set up, Composio handles secure credential storage and API request handling for you.

### Can I use multiple toolkits together?

Yes! Composio's Tool Router enables agents to use multiple toolkits. [Learn more](https://docs.composio.dev/tool-router/overview).

### Is Composio secure?

Composio is SOC 2 and ISO 27001 compliant with all data encrypted in transit and at rest. [Learn more](https://trust.composio.dev).

### What if the API changes?

Composio maintains and updates all toolkit integrations automatically, so your agents always work with the latest API versions.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
