Skip to main content
Glama
kr-dart-mcp
by partrita
README.md
# kr-dart-mcp

**An MCP server for Korean DART filings — company lookup, disclosures, financials and major shareholders in one tool call.**

[![CI](https://github.com/partrita/kr-dart-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/partrita/kr-dart-mcp/actions/workflows/ci.yml)
[![Python](https://img.shields.io/badge/python-3.10%2B-blue)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![MCP](https://img.shields.io/badge/MCP-compatible-6f42c1)](https://modelcontextprotocol.io)
[![PyPI](https://img.shields.io/badge/pypi-kr--dart--mcp-blue)](https://pypi.org/project/kr-dart-mcp/)

Give Claude Desktop, Claude Code, Cursor, Antigravity, Codex, OpenCode or any MCP-compatible agent the four questions an
analyst asks about a Korean listed company: **what is its DART code**, **what did it just
file**, **how is it doing**, and **who owns it**.

DART (Data Analysis, Retrieval and Transfer System) is the Financial Supervisory Service's
filing system — the Korean equivalent of EDGAR. Every KOSPI, KOSDAQ and KONEX company files
there, and OpenDART exposes it as a free JSON API. This server wraps that API in four small
tools that return compact, agent-friendly JSON.

> 한국어 요약은 [아래](#한국어-요약)에 있습니다.

---

## Why not call the OpenDART API directly?

| | Raw OpenDART | **kr-dart-mcp** |
| --- | --- | --- |
| Auth | API key in every query string | key read once from `DART_API_KEY` |
| Company names | you must already know the 8-digit `corp_code` | `search_company` resolves name · ticker · code |
| Financials | 200+ XBRL rows per filing | 7 headline accounts, KRW integers, prior period alongside |
| Amounts | `"300,870,903,000,000"` strings | `300870903000000` ints |
| Errors | `{"status":"013"}` with no context | `{"error": ..., "source": "opendart"}` + what to do next |
| Context cost | one filing can be tens of thousands of tokens | one compact record per item, long text trimmed |

---

## Quick start

```bash
# Run without installing
uvx kr-dart-mcp

# or install it into a project
uv add kr-dart-mcp
```

You need a free OpenDART key: <https://opendart.fss.or.kr> → 오픈API → 인증키 신청. The key
is a 40-character string; the same account covers all OpenDART endpoints.

```bash
export DART_API_KEY="your-40-character-key"
```

### Claude Desktop

`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or
`%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```json
{
  "mcpServers": {
    "dart": {
      "command": "uvx",
      "args": ["kr-dart-mcp"],
      "env": {
        "DART_API_KEY": "your-40-character-key"
      }
    }
  }
}
```

### Cursor

`~/.cursor/mcp.json` — same `mcpServers` block as above.

### Claude Code

```bash
claude mcp add dart --env DART_API_KEY=your-key -- uvx kr-dart-mcp
```

### Antigravity CLI (`agy`)

Global `~/.gemini/config/mcp_config.json` (or `.agents/mcp_config.json` for one workspace):

```json
{
  "mcpServers": {
    "dart": {
      "command": "uvx",
      "args": ["kr-dart-mcp"],
      "env": {
        "DART_API_KEY": "your-40-character-key"
      }
    }
  }
}
```

### Codex CLI (`codex`)

`~/.codex/config.toml` (global) or `.codex/config.toml` (project):

```toml
[mcp_servers.dart]
command = "uvx"
args = ["kr-dart-mcp"]

[mcp_servers.dart.env]
DART_API_KEY = "your-40-character-key"
```

The same entry from the shell:

```bash
codex mcp add dart --env DART_API_KEY=your-key -- uvx kr-dart-mcp
```

### OpenCode CLI (`opencode`)

```bash
opencode mcp add dart --env DART_API_KEY=your-key -- uvx kr-dart-mcp
```

or by hand in `~/.config/opencode/opencode.jsonc` (or the project's `opencode.jsonc`):

```jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "dart": {
        "type": "local",
        "command": ["uvx", "kr-dart-mcp"],
        "environment": {
          "DART_API_KEY": "{env:DART_API_KEY}"
        }
      }
    }
  }
}
```

`{env:DART_API_KEY}` is read from the environment OpenCode starts in, so export the key
before launching it. With `opencode mcp add`, add `--global` to write the global config
instead of the project one.


---

## Tools

### `search_company`

```text
search_company(query="삼성전자", limit=5)
```

Accepts a Korean or English name, a 6-digit ticker (`005930`) or an 8-digit DART code
(`00126380`). Matching ignores whitespace and legal suffixes, so `엔씨소프트`, `(주)엔씨소프트`
and `036570` all resolve to the same company. Listed companies rank above unlisted ones.

```json
{
  "query": "005930",
  "source": "opendart",
  "count": 1,
  "results": [
    {
      "corp_code": "00126380",
      "corp_name": "삼성전자",
      "corp_eng_name": "Samsung Electronics Co., Ltd.",
      "stock_code": "005930"
    }
  ]
}
```

The corporation table behind this tool (`corpCode.xml`, about 120,000 companies) is
distributed as a ZIP; it is downloaded once and cached for 7 days at
`~/.cache/kr-dart-mcp/` (override with `DART_MCP_CACHE_DIR`). After that, lookups work even
without a key.

### `list_disclosures`

```text
list_disclosures(company="005930", days=30, disclosure_type="periodic", limit=10)
```

Filing types: `periodic` (정기공시), `major` (주요사항보고), `issuance` (발행공시),
`ownership` (지분공시), `other` (기타공시), `audit` (외부감사관련), `fund`, `asset-backed`,
`exchange`, `ftc`. Omit the argument for all types.

```json
{
  "corp_code": "00126380",
  "source": "opendart",
  "period": "2026-02-09..2026-03-11",
  "disclosure_type": "A",
  "total_count": 2,
  "count": 2,
  "omitted": 0,
  "disclosures": [
    {
      "date": "2026-03-10",
      "report": "사업보고서 (2025.12)",
      "filer": "삼성전자",
      "rcept_no": "20260310002820",
      "url": "https://dart.fss.or.kr/dsaf001/main.do?rcpNo=20260310002820"
    },
    {
      "date": "2026-03-09",
      "report": "주식등의대량보유상황보고서(약식)",
      "filer": "국민연금공단",
      "rcept_no": "20260309000111",
      "url": "https://dart.fss.or.kr/dsaf001/main.do?rcpNo=20260309000111",
      "note": "유"
    }
  ]
}
```

### `get_financial_summary`

```text
get_financial_summary(company="005930", year=2025, report="annual", consolidated=True)
```

Returns revenue, operating profit, net income, total assets, liabilities, equity and cash,
matched by XBRL standard account id (`ifrs-full_Revenue`, …) with a Korean-name fallback —
account names change between years, ids do not. If consolidated statements are not filed,
the separate ones are used and `fallback` says so.

```json
{
  "corp_code": "00126380",
  "source": "opendart",
  "year": 2025,
  "report": "annual",
  "fs_div": "CFS",
  "account_count": 229,
  "accounts": [
    {
      "account": "영업수익",
      "current": 300870903000000,
      "previous": 258935494000000,
      "unit": "KRW",
      "statement": "손익계산서"
    },
    {
      "account": "영업이익",
      "current": 32725961000000,
      "previous": 6566976000000,
      "unit": "KRW",
      "statement": "손익계산서"
    },
    {
      "account": "당기순이익",
      "current": 34451351000000,
      "previous": 15487100000000,
      "unit": "KRW",
      "statement": "손익계산서"
    },
    {
      "account": "자산총계",
      "current": 514531948000000,
      "previous": 455905980000000,
      "unit": "KRW",
      "statement": "재무상태표"
    },
    {
      "account": "자본총계",
      "current": 402192044000000,
      "previous": 360543624000000,
      "unit": "KRW",
      "statement": "재무상태표"
    }
  ]
}
```

`account_count` is how many XBRL rows the filing contained (229 for this example); the
`accounts` list holds only the headline items that were found.

### `get_major_shareholders`

```text
get_major_shareholders(company="005930", year=2025, report="annual", limit=20)
```

Largest shareholder and related parties with shares and stake at the start and end of the
period, sorted by closing stake and capped by `limit`.

```json
{
  "corp_code": "00126380",
  "source": "opendart",
  "year": 2025,
  "report": "annual",
  "period_end": "2025-12-31",
  "count": 2,
  "omitted": 0,
  "shareholders": [
    {
      "name": "이재용",
      "relation": "최대주주 본인",
      "stock_kind": "보통주",
      "shares_start": 1266991133,
      "pct_start": 21.22,
      "shares_end": 1266991133,
      "pct_end": 21.2,
      "note": "특별관계자 포함"
    },
    {
      "name": "삼성생명보험",
      "relation": "계열회사",
      "stock_kind": "보통주",
      "shares_start": 508157148,
      "pct_start": 8.51,
      "shares_end": 508157148,
      "pct_end": 8.51
    }
  ]
}
```

---

## Design notes

- **Errors never raise.** A missing key, a bad company name or an upstream `status: 010`
  comes back as `{"error": "...", "source": "opendart"}`, plus a `hint` when there is an
  action to take. An agent can correct itself instead of losing the turn.
- **Empty is not an error.** OpenDART answers `013` (조회된 데이터가 없습니다) for a company
  with no data for that period; the tool returns an empty list with a hint.
- **Token-lean by construction.** Amounts are ints, dates are ISO, empty fields are dropped,
  free-text fields (`report_nm`, `rm`) are whitespace-collapsed and trimmed, and list lengths
  are capped with an `omitted` count.
- **Codes are strings.** Tickers like `005930` keep their leading zeros; nothing is parsed as
  an int except monetary amounts.
- **The API key is never echoed.** Request failures report the endpoint, HTTP status and
  exception type, not the URL that carries `crtfc_key`.

## Development

```bash
git clone https://github.com/partrita/kr-dart-mcp
cd kr-dart-mcp
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"

ruff check .
pytest            # no network: the OpenDART HTTP layer is faked
```

An optional live check runs the real API and is skipped unless a key is present:

```bash
DART_API_KEY=... pytest -m live
```

## 한국어 요약

한국 상장사의 DART 공시를 조회하는 MCP 서버입니다. Claude Desktop·Claude Code·Cursor
같은 MCP 클라이언트에 연결하면 네 가지를 바로 물어볼 수 있습니다.

| 툴 | 하는 일 |
| --- | --- |
| `search_company` | 회사명·종목코드(6자리)·DART 고유번호(8자리)로 회사를 찾습니다 |
| `list_disclosures` | 최근 공시를 유형별로 조회합니다 (정기·주요사항·발행·지분 등) |
| `get_financial_summary` | 매출·영업이익·순이익·자산·부채·자본·현금을 원 단위 정수로 돌려줍니다 |
| `get_major_shareholders` | 최대주주와 특수관계인의 기초·기말 지분을 보여줍니다 |

[opendart.fss.or.kr](https://opendart.fss.or.kr)에서 무료 인증키를 발급받아
`DART_API_KEY` 환경변수로 넣어 주세요. 키가 없어도 회사명 검색은 캐시된 목록으로 동작하며,
나머지 툴은 무엇을 해야 하는지 알려 주는 오류를 돌려줍니다.

## License

MIT