Skip to main content

Avanza MCP Server

PyPI - Version CI

Read-only access to Avanza market and optional account data from your MCP client. Public tools require no Avanza account.

Disclaimer

This is an unofficial API client/MCP Server. Not affiliated with Avanza Bank AB. The underlying API can be taken down or changed without warning at any point in time.

The author of this software is not responsible for any indirect damages (foreseeable or unforeseeable), such as, if necessary, loss or alteration of or fraudulent access to data, accidental transmission of viruses or of any other harmful element, loss of profits or opportunities, the cost of replacement goods and services or the attitude and behavior of a third party.

Features

  • Stocks, funds, ETFs, certificates, warrants and futures/forwards.
  • Quotes, charts, financial ratios, dividends, order books and ownership data.
  • Fund performance, fees, holdings, sustainability and research prompts.
  • Optional local BankID authentication for read-only accounts, holdings and activity.

Setup

Requires uv and Python 3.12+. Local clients launch the server over stdio.

Claude Desktop and Cursor

Both use this configuration:

{
  "mcpServers": {
    "avanza": {
      "command": "uvx",
      "args": ["avanza-mcp"]
    }
  }
}
  • Claude Desktop: open Settings > Developer > Edit Config, merge the configuration, then fully restart Claude Desktop.
  • Cursor: add it to .cursor/mcp.json in your project, or ~/.cursor/mcp.json globally. Enable the server in Cursor's MCP settings.
Claude Code

Run in your project:

claude mcp add avanza -- uvx avanza-mcp

Use /mcp in Claude Code to check the connection.

Visual Studio Code

Add to .vscode/mcp.json, or open MCP: Open User Configuration for global setup:

{
  "servers": {
    "avanza": {
      "type": "stdio",
      "command": "uvx",
      "args": ["avanza-mcp"]
    }
  }
}

Run MCP: List Servers, start avanza, and enable its tools in agent chat.

OpenCode

Add to your project's opencode.json or global ~/.config/opencode/opencode.json:

{
  "mcp": {
    "avanza": {
      "type": "local",
      "command": ["uvx", "avanza-mcp"],
      "enabled": true
    }
  }
}
HTTP and ChatGPT

From a source checkout:

uv sync
uv run fastmcp run src/avanza_mcp/__init__.py:mcp --transport http

Connect HTTP clients to http://localhost:8000/mcp. ChatGPT requires a remotely reachable HTTPS deployment; add its /mcp URL using ChatGPT's developer-mode setup.

This project does not provide a hosted endpoint. Configure access controls before exposing your server publicly.

Python

Install with uv add avanza-mcp, then use FastMCP's in-process client:

import asyncio
from fastmcp import Client
from avanza_mcp import mcp

async def main():
    async with Client(mcp) as client:
        result = await client.call_tool(
            "search_instruments", {"query": "Volvo", "instrument_type": "stock"}
        )
        print(result.structured_content)

asyncio.run(main())

If a desktop client cannot find uvx, use its absolute executable path. See DEVELOPMENT.md for running from source and tests.

Experimental Account Access

Authenticated access is disabled by default. Enable it by adding AVANZA_MCP_AUTH=1 to the local MCP server environment. For example, OpenCode uses:

{
  "mcp": {
    "avanza": {
      "type": "local",
      "command": ["uvx", "avanza-mcp"],
      "environment": {"AVANZA_MCP_AUTH": "1"},
      "enabled": true
    }
  }
}

Restart OpenCode after changing its configuration.

Authentication Flow

  1. A temporary page opens on 127.0.0.1 and asks for consent.
  2. After approval, scan the locally rendered QR code with BankID.
  3. Avanza verifies the session and enables the experimental tools.

No Avanza password is requested in the browser or chat. Existing market-data tools automatically use the valid session when one is available; no duplicate authenticated market tools are added.

Session Data

Verified session cookies and the Avanza security token are stored in the operating system's native credential store and revalidated on startup:

  • macOS Keychain
  • Windows Credential Manager
  • Linux Secret Service, which must be installed, unlocked and available over D-Bus

Credentials are not stored in project files, browser storage, logs, or MCP results. Account responses are not cached by this project.

Avanza controls session duration through the account's website setting. See How long can I stay logged in? to change it.

Use disconnect_avanza to remove the local credential and attempt remote logout.

Account tool results may be sent to the configured model provider and saved in conversation history.

Tools

The default 34-tool catalog is read-only. Search first to obtain an order_book_id; history tools expose pagination. Data is latest available, not guaranteed live.

Category Tool Description
Search search_instruments Find instruments by name, ticker or ISIN
Search get_instrument_by_order_book_id Match an exact ID within search candidates
Stocks get_stock_info Company, listing, fundamentals and quote
Stocks get_stock_quote Latest price and trading volume
Stocks get_stock_chart Historical OHLC price points
Stocks get_stock_analysis A named financial-ratio history
Stocks get_dividends A named dividend metric by financial year
Stocks get_company_financials A named annual or quarterly financial metric
Market get_orderbook Bid/ask depth
Market get_marketplace_info Trading hours and market status
Market get_recent_trades Recent trade snapshot
Market get_broker_trade_summary Broker buy/sell activity
Funds get_fund_info NAV, performance, fees and fund information
Funds get_fund_sustainability ESG and sustainability metrics
Funds get_fund_chart Historical fund chart points
Funds get_fund_chart_periods Available performance periods
Funds get_fund_description Investment strategy and category
Funds get_fund_holdings Country, sector and top-holding allocations
Certificates filter_certificates Filter and list certificates
Certificates get_certificate_info Certificate information
Certificates get_certificate_details Extended certificate details
Warrants filter_warrants Filter and list warrants
Warrants get_warrant_info Warrant information
Warrants get_warrant_details Extended warrant details
ETFs filter_etfs Filter and list ETFs
ETFs get_etf_info ETF information
ETFs get_etf_details Extended ETF details
Futures/Forwards list_futures_forwards Filter and list contracts
Futures/Forwards get_future_forward_filter_options Available contract filters
Futures/Forwards get_future_forward_info Contract information
Futures/Forwards get_future_forward_details Extended contract details
Additional get_number_of_owners Avanza ownership history
Additional get_short_selling Short-selling history
Additional get_marketmaker_chart Traded-product OHLC and market-maker data

Experimental Auth Tools

These tools are available only when experimental account access is enabled. Data access is read-only; no tool places, edits, or cancels orders.

Category Tool Description
Session connect_avanza Open the local consent and BankID flow
Session disconnect_avanza Confirm disconnection and remove the saved session
Session get_auth_status Check the safe local connection state
Accounts get_accounts Account identities, balances and values
Accounts get_holdings Current positions and cash balances
Accounts get_transactions Bounded transaction history
Accounts get_credit_info Credit, collateral and leverage figures
Portfolio get_portfolio_insights Aggregate portfolio development
Activity get_active_orders Current orders without modification controls
Activity get_deals Current executed deals
Activity get_stop_loss_orders Current stop-loss orders without modification controls
Saved Data get_watchlists Saved watchlists and order-book IDs
Saved Data get_price_alerts Price alerts for an order book
Saved Data get_current_offers Current customer offers
Research get_instrument_news Bounded instrument news
Research get_forum_posts Bounded forum posts as untrusted text
Research get_insider_transactions Reported insider transactions

Prompts

  • analyze_stock(stock_symbol) - Research a stock's fundamentals and price history.
  • compare_funds(fund_names) - Compare two or more supplied funds.
  • screen_dividend_stocks(candidates, min_yield=3.0) - Screen supplied stocks by dividend yield.

Resources

  • avanza://docs/usage - Tool usage guide.
  • avanza://docs/quick-start - Common workflows.
  • avanza://stock/{order_book_id} - Stock summary as Markdown.
  • avanza://fund/{order_book_id} - Fund summary as Markdown.

License

MIT

Metadata

Release files for avanza-mcp 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for avanza-mcp 2.1.0
File Size Uploaded Provenance Actions
avanza_mcp-2.1.0.tar.gz 158.0 kB Without provenance Details for avanza_mcp-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for avanza-mcp 2.1.0
File Interpreter ABI Platform Actions
avanza_mcp-2.1.0-py3-none-any.whl Python 3 none any Details for avanza_mcp-2.1.0-py3-none-any.whl

Total release size: 236.5 kB

Release files / avanza_mcp-2.1.0.tar.gz

Download URL avanza_mcp-2.1.0.tar.gz
Size 158.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3a69769626b9e18ca6df6a92f67ac216e0363d2888b0c7a4f7b91f8b334a57f8
BLAKE2b-256 checksum
How to use checksums
33f5ba531eb1895e01fa859fa46be8e1f1ac01399e9c90b2422302c67b7c07cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / avanza_mcp-2.1.0-py3-none-any.whl

Download URL avanza_mcp-2.1.0-py3-none-any.whl
Size 78.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
698d431cb277144956c2f3234d3b397d52440e8e65a22037aee9a40eb354d2d8
BLAKE2b-256 checksum
How to use checksums
5943acd0e76d81646d4e8fab339bd8fa58fe94ee70e58fdaae318f8d060d2e86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for avanza-mcp 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page