Developer API

Connect AI Agents to Tadawul with SAHMK MCP

Add SAHMK from the ChatGPT Plugins Directory or the Claude directory, connect Claude Code with hosted MCP, or run the local server for Claude Desktop and Cursor. The same connection can read Tadawul data and manage portfolios. Each path uses your existing SAHMK subscription, permissions, and daily quota.

MCPChatGPTAIPythonBeginner8 min read

1. What is MCP?

MCP (Model Context Protocol) is an open standard that lets AI assistants call external tools. The SAHMK MCP server gives your assistant these Tadawul and portfolio tools:

ToolWhat it does
get_quoteGet live quote details for one company identifier
get_quotesCompare live quotes for multiple company identifiers
companies_listDiscover symbols with search, market, limit, and offset
get_market_summarySee how an index is performing today
get_market_moversGet top gainers, losers, or active stocks with stable type, index, count, and items
get_sectorsView sector performance with stable index, count, and items
get_companyGet company profile and key fundamentals
get_historicalFetch historical OHLCV price data (5min, 15min, 30min, 60min, 1d, 1w, 1mo; default 1d. Also accepts 30m for 30min, 60m for 60min, and 1m for 1mo (monthly, not 1 minute); plan/date-window limits apply)
get_financialsReview company financial statements and metrics
get_dividendsSee dividend history and payout details
get_portfoliosList your portfolios
get_portfolioRead one portfolio
create_portfolioCreate a portfolio
get_portfolio_summaryCash, holdings, and profit or loss
get_portfolio_performanceDaily portfolio value series
get_portfolio_transactionsList the portfolio ledger
create_portfolio_transactionAppend one transaction, or an atomic batch
reverse_portfolio_transactionReverse the latest ledger transaction
set_portfolio_holdingsReconcile holdings: dry_run first, then apply with plan_token

Note: get_financials and get_dividends may require an eligible plan (Starter+ or above).

Read tools such as get_portfolios use the mcp.read.portfolios scope. Write tools create_portfolio, create_portfolio_transaction, reverse_portfolio_transaction, and set_portfolio_holdings use mcp.write.portfolios. Holdings reconciliation requires scope (full or partial), cash_policy (auto_fund or require_cash), and a holdings list. Always run dry_run first, then resubmit with plan_token to apply. Portfolios are available on every plan; the portfolio count and performance window still follow your plan.

Every path uses your existing SAHMK subscription

ChatGPT, Claude.ai, Claude Desktop, and Cursor use the same SAHMK developer account, the same daily quota, and the permissions already on your plan.

  • Plan: the Free, Starter, Pro, Business, or Enterprise plan you already have.
  • Permissions: what your API key and plan already allow. Real-time data is available only when your plan includes it.
  • Quota: every tool call counts toward your SAHMK daily request limit.

2. Connect SAHMK to ChatGPT

SAHMK is listed in the ChatGPT Plugins Directory. Add it from the public listing.

You need a SAHMK developer account and an API key. Create an account, or open API Keys if you already have one.

Add SAHMK to ChatGPT
  1. Open the SAHMK listing in the ChatGPT Plugins Directory.
  2. Add or connect SAHMK.
  3. Sign in to SAHMK.
  4. Select an API key and allow access. Requests run through that key and your current plan.
  5. Start a conversation and select @SAHMK.

Example:

ما سعر سهم أرامكو الآن، وما حجم التداول وأفضل سعري طلب وعرض؟

3. Connect SAHMK to Claude

SAHMK is listed in the Claude directory. Add it from the public listing.

You need a SAHMK developer account and an API key. Create an account, or open API Keys if you already have one.

Add SAHMK to Claude
  1. Open the SAHMK listing in the Claude directory.
  2. Sign in to Claude and add SAHMK.
  3. Sign in to SAHMK.
  4. Select an API key and allow access. Requests run through that key and your current plan.
  5. In a conversation, Claude uses SAHMK tools automatically when they are relevant.

Example:

ما سعر سهم أرامكو الآن، وما حجم التداول وأفضل سعري طلب وعرض؟

4. Local MCP for Claude Desktop and Cursor

Claude Desktop and Cursor run the official SAHMK MCP server locally from PyPI. This path also uses your existing API key and SAHMK subscription; every tool call counts toward the same daily quota.

PyPI version

Get your API key

You need a SAHMK API key. Get your free key by signing up here.

Your key starts with shmk_live_ or shmk_test_.

Installation

Install the MCP server from PyPI:

bash
pip install -U sahmk-mcp

If MCP tools reject newer parameters, upgrade with pip install -U sahmk-mcp and restart your MCP client.

Verify it's installed:

bash
sahmk-mcp --help

Connect to Claude Desktop

Add the following to your Claude Desktop config file.

On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%\Claude\claude_desktop_config.json

claude_desktop_config.json
{
  "mcpServers": {
    "sahmk": {
      "command": "sahmk-mcp",
      "env": {
        "SAHMK_API_KEY": "your_api_key_here"
      }
    }
  }
}

Restart Claude Desktop. You should see the SAHMK tools available in the tools menu.

Connect to Cursor

Add the following to your project's .cursor/mcp.json:

.cursor/mcp.json
{
  "mcpServers": {
    "sahmk": {
      "command": "sahmk-mcp",
      "env": {
        "SAHMK_API_KEY": "your_api_key_here"
      }
    }
  }
}

Restart Cursor. The SAHMK tools will be available to the AI assistant in your editor.

5. Try it out

After connecting in ChatGPT, Claude, or Cursor, ask questions in plain language. The tools and limits are the same because every path uses your SAHMK subscription.

Quote tools accept identifiers: symbol, Arabic company name, English name, or alias. Symbols are still supported. If a prompt resolves to multiple companies, ask the model to retry with the exact symbol.

For discovery workflows, use companies_list first (supports search, market, limit, and offset).

Prompt

ما سعر سهم أرامكو الآن، وما حجم التداول وأفضل سعري طلب وعرض؟

Asks for Aramco’s price, volume, and best bid and ask.

Prompt

prompt
How is the Saudi market doing today?

Calls get_market_summary.

Prompt

prompt
Show the top gainers in TASI

Calls get_market_movers.

Prompt

prompt
Show sector performance in TASI

Calls get_sectors.

Prompt

prompt
Get financials for Aramco

Calls get_financials.

Prompt

prompt
Show dividends for Aramco

Calls get_dividends.

Prompt

prompt
Compare Aramco and Al Rajhi Bank

Calls get_quotes.

Prompt

prompt
Show Aramco's price history for the last 3 months

Calls get_historical.

Prompt

prompt
List my portfolios, then summarize the first one.

Calls get_portfolios, then get_portfolio_summary.

Prompt

prompt
Preview setting my portfolio to 10 shares of 2222 at an average cost of 25 SAR. Do not apply it yet.

Calls set_portfolio_holdings with dry_run. Nothing is written until you resubmit with plan_token.

Financials and dividends may require an eligible plan (Starter+ or above).

6. Available plans

These limits apply to MCP tool calls in ChatGPT and in local clients alike.

PlanPriceRequests/day
Free0 SAR100
Starter149 SAR/mo5,000
Pro499 SAR/mo50,000
Business1,499 SAR/mo150,000
EnterpriseContact usCustom

The free plan gives you 100 requests per day — enough to get started and test the integration.

7. Next steps

Give your AI assistant access to Tadawul

Add SAHMK from the ChatGPT Plugins Directory or the Claude directory, or install the local server for Claude Desktop and Cursor. 100 free requests per day, no credit card required.

Resources

Published by @sahmk_sa · Licensed by Tadawul (Saudi Exchange)