nhplug-mcp
OfficialThe nhplug-mcp server connects Claude Desktop and other MCP clients to the NH Investment & Securities Open API, enabling Korean stock market data retrieval and account management. It automatically handles authentication, token issuance, API headers, and request envelopes.
Core Tools
list_apis: Discover and filter 131 available NH Open API endpoints by asset class, category, or keyword.describe_api: Inspect the input schema and required parameters for any specific API endpoint.call_api: Execute any of the 131 supported endpoints byoperationId— authentication, headers, and pagination are handled automatically.get_stock_price: Retrieve the current market price of a Korean stock by its 6-digit code (e.g.,005930for Samsung Electronics).get_stock_balance: Query holdings and balance for a specified domestic stock account.list_accounts: View your registered NH accounts.
Additional Notes
Trading APIs are disabled by default — enable via
NHPLUG_ENABLE_TRADING=true. Even when enabled, AI models will not execute actual buy/sell orders due to safety policies.Currently focused on Korean domestic stocks (krstock), but extensible to other asset classes (global stocks, futures) by adding OpenAPI spec files.
Supports multiple environments: development/production mock and real trading servers via
NHPLUG_BASE_URL.Can be run via
npxdirectly from GitHub or as a local build, and integrates with Claude Desktop throughmcpServersconfiguration.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nhplug-mcp삼성전자 현재가 알려줘"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
NH투자증권 Open API — Local MCP Server
NH투자증권 Open API 를 Claude Desktop 등 MCP 클라이언트에서 바로 사용할 수 있게 해주는 로컬 MCP 서버입니다. 국내주식(krstock)·해외주식(gbstock) 자산군의 시세·조회·주문 API 를 Claude 가 도구로 호출합니다.
인증 · 토큰 발급 · 헤더 ·
Input_0봉투 처리를 서버가 자동으로 대신합니다.131개 엔드포인트를 몇 개의 메타 도구로 노출해, 도구가 많아 성능이 떨어지는 문제를 피합니다.
주문(거래) API 는 기본 비활성이며, 명시적으로 켠 경우에만 사용됩니다.
현재 버전은 국내주식(krstock)·해외주식(gbstock) 자산군을 포함합니다. 다른 자산군은
specs/폴더에 openapi.json 을 추가하면 확장됩니다(맨 아래 참고).
1. 사전 요건
Node.js 18 이상 — nodejs.org 에서 설치. (
node -v로 확인.npx는 Node 에 포함)NH투자증권 Open API 앱키/시크릿 — 포털 www.nhplug.com 에서 발급.
Git — 방법 A(npx github)·방법 B(clone) 모두 필요. git-scm.com 에서 설치. (
git --version으로 확인)API 서버 네트워크 접근 — 이 MCP 는 당신 PC 에서
*.nhplug.comAPI 서버로 직접 연결합니다. 사내망 등에서만 접근 가능한 환경이라면, MCP 를 실행하는 PC 도 그 네트워크에 있어야 합니다.
Related MCP server: KIS MCP Server
2. 설치 및 실행
방법 A — npx로 GitHub에서 바로 실행 (권장, 설치 불필요)
별도 다운로드·빌드 없이 Claude 설정 한 줄이면 됩니다. 고객용 설정에 아래 command/args 를 씁니다(전체 설정은 3번).
"command": "npx",
"args": ["-y", "github:plug-support/nhplug-mcp"]첫 실행 예열(권장): npx 는 첫 실행 때 GitHub 에서 받아 빌드하느라 1분 정도 걸립니다. Claude 가 기다리다 실패하지 않도록, 터미널에서 한 번 미리 실행해 두면 좋습니다:
npx -y github:plug-support/nhplug-mcp
[nhplug-mcp] 시작됨 ...로그가 뜨면Ctrl + C로 종료. 이후 Claude 실행이 빨라집니다.업데이트 반영: npx 는 받은 코드를 캐시합니다. 새 버전을 받으려면
npm cache clean --force후 Claude 재시작.
방법 B — git clone 후 로컬 빌드
git clone https://github.com/plug-support/nhplug-mcp.git
cd nhplug-mcp
npm install
npm run build빌드가 끝나면 dist/index.js 가 생성됩니다. 이 경로를 Claude 설정에 "command": "node", "args": ["<경로>/dist/index.js"] 로 등록합니다.
3. Claude Desktop 연결
Claude Desktop 설정 파일 claude_desktop_config.json 을 엽니다.
가장 쉬운 방법: Claude Desktop → 설정(Settings) → 개발자(Developer) → Edit Config 버튼.
직접 열기 — Windows:
%APPDATA%\Claude\claude_desktop_config.json· macOS:~/Library/Application Support/Claude/claude_desktop_config.json
아래 내용을 붙여넣습니다. (방법 A · GitHub npx 기준)
{
"mcpServers": {
"nhplug": {
"command": "npx",
"args": ["-y", "github:plug-support/nhplug-mcp"],
"env": {
"NHPLUG_APP_KEY": "발급받은_APP_KEY",
"NHPLUG_APP_SECRET": "발급받은_APP_SECRET",
"NHPLUG_BASE_URL": "https://devapi.nhplug.com:8443",
"NHPLUG_ENABLE_TRADING": "false"
}
}
}
}저장 후 Claude Desktop 을 완전히 종료(트레이 포함)했다가 다시 실행하면 nhplug 도구가 나타납니다.
JSON 주의: 항목 사이엔 콤마(
,), 마지막 항목 뒤엔 콤마 없음. Windows 경로의\는\\로 두 개씩. 이미 다른 서버가 있으면"nhplug": { ... }블록만mcpServers안에 추가하세요.방법 B(로컬 빌드)를 쓰면
command를"node",args를["C:\\경로\\nhplug-mcp\\dist\\index.js"]로 바꾸면 됩니다. 키는 설정의env대신 저장소 폴더의.env파일(.env.example참고)로 넣어도 됩니다.
4. 환경변수
변수 | 필수 | 설명 |
| ✅ | 발급받은 앱키 |
| ✅ | 발급받은 앱시크릿 |
| REST Base URL. 기본값 | |
|
| |
| 잔고/주문 단축 도구에서 계좌번호 생략 시 사용 |
접속 환경(Base URL)
환경 | URL |
🟢 테스트 (Test) — 실매매 전 검증 [기본] |
|
🟢 모의투자 (Mock) — 교육이수 |
|
🔴 실거래 (Live) — 검증 후에만 |
|
5. 제공 도구
도구 | 종류 | 설명 |
| 메타 | 호출 가능한 API 목록. domain/category/keyword 필터. 여기서 operationId 를 찾습니다. |
| 메타 | 특정 operationId 의 입력 필드(Input_0) 스키마 조회. |
| 메타 | operationId + 입력값으로 실제 호출. 131개 엔드포인트 전부 커버. |
| 단축 | 국내주식 현재가 (종목코드만 입력). |
| 단축 | 국내주식 계좌 잔고. |
| 단축 | 보유 계좌 목록 조회 (잔고·주문 전 계좌번호 확보용, |
동작 흐름(메타 도구): list_apis 로 원하는 API 를 찾고 → describe_api 로 입력값을 확인한 뒤 → call_api 로 호출합니다. 자주 쓰는 현재가·잔고는 단축 도구로 한 번에 호출할 수 있습니다.
사용 예시 프롬프트
"삼성전자(005930) 현재가 알려줘" →
get_stock_price"국내주식 시세 관련 API 목록 보여줘" →
list_apis"krstockQuoteCurrentDaily 는 어떤 입력이 필요해?" →
describe_api"내 계좌 목록 보여줘" →
list_accounts"내 계좌 20101036881 잔고 조회해줘" →
get_stock_balance
6. 주문(거래)에 대하여 ⚠️
중요 — 대화형 AI 는 실제 주문을 대신 체결하지 않습니다. Claude 등 AI 어시스턴트는 안전정책상 사용자를 대신해 증권 주문을 실행하지 않습니다. 이는 MCP 설정(
NHPLUG_ENABLE_TRADING)이나 환경과 무관한 모델 자체의 동작이라, 서버에서 끌 수 없습니다.따라서 이 MCP 는 시세·계좌 조회, 분석, 주문 파라미터 준비까지 담당하고, 실제 매수/매도 실행은 코드로 하세요:
파이썬 개발·자동매매:
nhplug-sdk주문 API 단발 테스트(사람이 직접 실행):
node scripts/order_test.mjs --account <계좌> --code 005930 --qty 1 --price 70000 --confirm
NHPLUG_ENABLE_TRADING=true 설정은 주문 API 를 도구 목록에 노출만 합니다(설계·검증용). 실행은 위 코드 경로를 사용하세요.
기본값
false이면 주문 API 는list_apis에 표시되지 않고call_api로도 거부됩니다.주문 관련 작업은 반드시 테스트/모의투자 환경(
devapi/moapi) 에서 충분히 검증 후 진행하세요.
7. 연결 검증 (self-test)
Claude 에 붙이기 전에, API 서버 접근·인증이 정상인지 로컬에서 먼저 확인할 수 있습니다.
# .env 에 APP_KEY / APP_SECRET / BASE_URL 을 채운 뒤
node scripts/selftest.mjs토큰 발급 → 삼성전자 현재가 조회까지 성공하면 전체 검증 통과 ✅ 가 출력됩니다.
8. 문제 해결
증상 | 원인 / 해결 |
| 설정의 |
| API 서버에 접근 불가. 사내망/방화벽/URL 확인 |
| 앱키·시크릿 오류 또는 해당 환경 미허용 |
Claude 에 도구가 안 보임 | 설정 저장 후 Claude Desktop 완전 종료 후 재시작 |
주문 도구가 안 보임 | 의도된 동작. |
로그는 표준오류(stderr)로 출력됩니다: [nhplug-mcp] 시작됨 · baseUrl=... · trading=...
9. 자산군 확장
다른 자산군을 추가하려면 해당 openapi.json 을 specs/ 폴더에 <도메인>.openapi.json 이름으로 넣고 다시 빌드하면 됩니다. 예:
specs/
krstock.openapi.json ← 현재 포함
gbstock.openapi.json ← 추가 시 해외주식 자동 노출
krfuture.openapi.json ← 추가 시 국내파생 자동 노출메타 도구(list_apis/describe_api/call_api)는 코드 수정 없이 새 자산군을 자동 인식합니다. (단축 도구는 자산군별로 추가 구현 가능)
라이선스
MIT. 문의: apisupport@nhsec.com
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/plug-support/nhplug-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server