midas-mcp

midas-mcp

Enables AI assistants to read portfolio and place orders on BIST and US markets via Midas brokerage.

Category
Visit Server

README

midas-mcp

An MCP server for the Midas brokerage (atlas.getmidas.com), so an AI assistant can read your portfolio and place orders on BIST and US markets.

Midas has no public API. This server drives the Atlas web app with Playwright: it keeps one authenticated browser session alive and issues the same GraphQL calls the web app itself makes, from inside the page so the session cookies are attached automatically.

This places real orders with real money. Read the safety section before using it.

Tools

Tool Arguments What you get
get_portfolio Total value in TRY, today's P/L, cash and buying power per account
get_assets Every open position: quantity, average cost, price, market value, P/L
get_asset_price symbol, optional currency Last price, previous close, % change, session status
get_asset_info symbol Instrument name, market and description, plus current price
buy_asset symbol, quantity, optional limit_price Places a buy order, returns the order id and status
sell_asset symbol, quantity, optional limit_price Places a sell order, returns the order id and status
get_pending_orders symbol Orders still waiting to execute, with their ids
cancel_order order_id, symbol Cancels a pending order

Omitting limit_price places a market order. Symbols are resolved by search, so both tickers (TUCLK) and names work; BIST and US instruments are both supported.

Safety

Every order is checked before it reaches Midas:

  • Value cap — the order's estimated value is converted to TRY (Midas will quote any instrument in TRY) and refused if it exceeds MAX_ORDER_VALUE_TRY, which defaults to 5000. One cap therefore covers both the TRY and USD accounts.
  • Price band — limit prices outside the instrument's daily band are refused locally rather than bounced by the exchange.
  • Position check — sells larger than your sellable quantity are refused.
  • Fractional check — fractional quantities are refused for instruments that don't support them.

cancel_order exists so a mistake can be undone immediately. Note that BIST trades 10:00–18:00 Turkey time; orders placed outside the session queue for the next one, which means they can be cancelled before they ever reach the exchange.

Setup

Requires Node.js 20+.

git clone https://github.com/<you>/midas-mcp.git
cd midas-mcp
npm install
npx playwright install chromium
cp .env.example .env    # then fill in your credentials
npm run build

.env:

MIDAS_PHONE=5XXXXXXXXX      # Turkish mobile number, no country code
MIDAS_PASSWORD=your-password
MAX_ORDER_VALUE_TRY=5000    # refuse any order estimated above this, in TRY
HEADLESS=true

.env and the browser profile in .midas-session/ are both gitignored — they hold your credentials and session cookies, so keep them out of version control.

First login

Midas requires approving a push notification in the Midas mobile app, so the first login has to be interactive:

npm run login          # opens a visible browser, then approve the prompt on your phone

The session is saved to .midas-session/ and reused afterwards, so this is a one-off until the session expires. Only one process can use that profile at a time — stop the MCP server before running npm run login.

Verify it works:

npm run smoke          # prints your portfolio, positions and a quote

Register with Claude Code

claude mcp add midas -- node /absolute/path/to/midas-mcp/dist/index.js

Or, for any MCP client that reads a JSON config:

{
  "mcpServers": {
    "midas": {
      "command": "node",
      "args": ["/absolute/path/to/midas-mcp/dist/index.js"]
    }
  }
}

How it works

src/session.ts launches a persistent Chromium profile and handles login. Auth is entirely cookie-based, so src/api.ts runs each GraphQL request via page.evaluate inside the authenticated page rather than reimplementing the token flow.

Two details are easy to miss when working on this:

  • The API gateway requires an x-midas-rid header. It is a stable per-profile request id generated by the web app, so the session observes it on the app's own requests instead of trying to recompute it.
  • The gateway routes on x-apollo-operation-name, which must be the root field name, not the operation name. When a document's first selection is an alias (as in OverviewAllPositions), the real field name has to be passed explicitly.

Headless Chromium is rejected with a 403 unless it presents a normal user agent and client hints; session.ts sets these.

scripts/ holds the tooling used to map the API, kept for when Midas changes it: browser-daemon.ts (logging browser with a CDP port), analyze.ts (summarise captured GraphQL traffic), dump-panel-bundles.ts (download lazy-loaded chunks), and extract-ops.ts / extract-document.ts (recover GraphQL documents from the minified bundle's embedded AST — introspection is disabled server-side).

Verifying trading end-to-end

src/order-test.ts places one real single-share order and cancels it immediately. It also checks that the value cap rejects an oversized order. It refuses to run without an explicit confirmation:

CONFIRM_REAL_ORDER=yes node dist/order-test.js CANTE 1.08 BUY
CONFIRM_REAL_ORDER=yes node dist/order-test.js TUCLK 4.04 SELL

Pick a limit price at the far end of the daily band so the order cannot fill, and run it while the market is closed for extra margin.

Disclaimer

Unofficial, not affiliated with or endorsed by Midas. It depends on undocumented internal endpoints that can change without notice. You are responsible for every order it places. Use at your own risk.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured