MCP 서버: 개발자 연동
이 가이드는 자체 코드에서 finlight MCP 서버를 호출하는 방법을 보여 줍니다. AI 애플리케이션을 만들거나, 뉴스 수집을 자동화하거나, 금융 뉴스를 자체 시스템에 연결할 때 사용하세요.
MCP 도구는 API v3를 사용합니다. search_articles는 POST /v3/articles/search와 같은 필드를 받고, 모든 도구는 v3 JSON을 반환합니다. 예를 들어 기사 객체입니다. URL, 로그인, 헤더는 그대로이므로 기존 연결은 계속 작동합니다.
서버 정보
| 환경 | URL |
|---|---|
| 프로덕션 | https://mcp.finlight.me |
서버는 HTTP 위의 JSON-RPC 2.0으로 MCP(Model Context Protocol)를 구현합니다.
인증
MCP 엔드포인트로 보내는 모든 요청에는 API 키가 필요합니다. initialize와 tools/list도 마찬가지입니다. 키를 Bearer 토큰으로 보내세요:
Authorization: Bearer YOUR_API_KEY
x-api-key 헤더로 보낼 수도 있습니다. 예를 들어 브라우저가 없는 서버나 컨테이너에서 그렇게 합니다:
x-api-key: YOUR_API_KEY
OAuth를 쓰는 클라이언트(Claude Desktop 등)를 위해 서버는 PKCE를 사용하는 OAuth 2.0을 구현합니다. OAuth 흐름을 참조하세요.
빠른 시작
cURL 사용
사용 가능한 도구 목록:
curl -X POST https://mcp.finlight.me \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}'
NVIDIA 실적 뉴스 검색:
curl -X POST https://mcp.finlight.me \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search_articles",
"arguments": {
"tickers": ["NVDA"],
"eventTypes": ["earnings"],
"limit": 10
}
}
}'
TypeScript 사용
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'
const transport = new StreamableHTTPClientTransport(new URL('https://mcp.finlight.me'), {
requestInit: {
headers: {
Authorization: `Bearer ${process.env.FINLIGHT_API_KEY}`,
},
},
})
const client = new Client({
name: 'my-app',
version: '1.0.0',
})
await client.connect(transport)
// List the available tools
const tools = await client.listTools()
console.log('Available tools:', tools)
// Search articles
const result = await client.callTool({
name: 'search_articles',
arguments: {
query: 'Federal Reserve interest rates',
from: '2026-11-01',
limit: 5,
},
})
// The tool answers with one text item that holds JSON
const [item] = result.content as { type: 'text'; text: string }[]
const page = JSON.parse(item.text)
console.log('Articles:', page.articles)
Python 사용
import json
import os
import requests
API_KEY = os.environ["FINLIGHT_API_KEY"]
MCP_URL = "https://mcp.finlight.me"
def mcp_request(method: str, params: dict | None = None):
response = requests.post(
MCP_URL,
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {API_KEY}",
},
json={
"jsonrpc": "2.0",
"id": 1,
"method": method,
"params": params or {},
},
)
return response.json()
# List the available tools
tools = mcp_request("tools/list")
print("Available tools:", json.dumps(tools, indent=2))
# Search articles
answer = mcp_request("tools/call", {
"name": "search_articles",
"arguments": {
"tickers": ["TSLA"],
"from": "2026-11-01",
"include": ["companies", "events"],
"limit": 10,
},
})
page = json.loads(answer["result"]["content"][0]["text"])
for article in page["articles"]:
print(article["publishedAt"], article["title"])
사용 가능한 도구
서버에는 도구가 다섯 개 있습니다. 각 도구는 여러분의 키로 finlight API에 요청을 하나 보냅니다.
| 도구 | 하는 일 | API 요청 |
|---|---|---|
search_articles | 쿼리와 필터로 기사 검색 | POST /v3/articles/search |
get_article | finlight id로 기사 하나 가져오기 | GET /v3/articles/{id} |
get_article_by_link | URL로 기사 하나 가져오기 | GET /v3/articles/by-link |
search_companies | 티커, 이름, ISIN으로 기업 찾기 | GET /v3/companies |
list_sources | 모든 뉴스 소스 목록 | GET /v3/sources |
모든 도구는 텍스트 항목 하나로 응답합니다. 텍스트는 API 요청의 데이터가 담긴 JSON입니다. 아래 섹션에서 도구별 형태를 보여 줍니다.
search_articles
금융 뉴스 기사를 검색합니다. 필드는 기사 검색과 같으며, 그 페이지에서 필터가 어떻게 결합되는지도 설명합니다. 모든 필드는 선택 사항입니다.
매개변수:
| 매개변수 | 타입 | 설명 |
|---|---|---|
query | string | 쿼리 문법으로 쓴 쿼리: AND, OR, NOT, 괄호, 구문, 그리고 {ticker:NVDA AND eventType:earnings} 같은 필드. 중괄호는 조건을 같은 기업이나 같은 이벤트에 묶습니다. 예: {ticker:TSLA AND role:defendant}. |
tickers | string[] | 이 기업에 관한 기사, 예: ["AAPL", "NVDA"]. 000660.KS 같은 벤더 표기도 됩니다. 티커 및 거래소를 참조하세요. |
sources | string[] | 이 소스 도메인만, 예: ["www.reuters.com"] |
optInSources | string[] | 기본 소스에 이 소스를 추가 |
excludeSources | string[] | 이 소스 제외 |
sourceTypes | string[] | 이 소스 유형만, 예: newswire 또는 press_release |
excludeSourceTypes | string[] | 이 소스 유형 제외 |
from | string | 날짜 범위의 시작(YYYY-MM-DD 또는 ISO 8601). orderBy 타임스탬프에 적용됩니다. |
to | string | 날짜 범위의 끝(YYYY-MM-DD 또는 ISO 8601) |
languages | string[] | ISO 639-1 코드. 기본값 ["en"]. |
countries | string[] | 기사가 다루는 국가, 대문자 ISO 3166-1 alpha-2(US) |
categories | string[] | 기사 카테고리, 예: markets 또는 technology |
roles | string[] | 태깅된 기업의 역할, 예: acquirer, target 또는 defendant |
minRelevance | number | 태깅된 기업의 최소 관련도, 0에서 1 사이 |
eventTypes | string[] | 이벤트 유형, 예: earnings, mna 또는 guidance |
eventDirections | string[] | positive, negative, neutral, unclear |
minImportance | string | low, medium, high 또는 critical |
sectors | string[] | 태깅된 기업의 섹터, 예: Technology |
companyCountries | string[] | 태깅된 기업이 소재한 국가, ISO 3166-1 alpha-2 |
exchanges | string[] | 태깅된 기업의 주 상장 거래소, MIC(XNAS) |
orderBy | string | publishedAt(기본값), firstSeenAt, revisedAt 또는 availableAt |
order | string | desc(기본값, 최신순) 또는 asc |
limit | number | 페이지당 기사 수, 1~100. 기본값 20. |
cursor | string | 다음 페이지를 위한 이전 결과의 pagination.nextCursor |
include | string[] | 기사별 추가 블록: companies, events |
요청 예시: AMD가 인수자인 M&A 뉴스.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search_articles",
"arguments": {
"tickers": ["AMD"],
"roles": ["acquirer"],
"eventTypes": ["mna"],
"from": "2026-09-01",
"include": ["companies", "events"],
"limit": 5
}
}
}
응답 예시: 도구는 JSON이 담긴 텍스트 항목 하나를 반환합니다:
{
"jsonrpc": "2.0",
"result": {
"content": [{
"type": "text",
"text": "{\"articles\":[{\"id\":\"pXhK9f2aQ1mZ0bT7cY3rLw\",\"title\":\"AMD to buy ZT Systems\", ...}],\"pagination\":{...}}"
}]
},
"id": 1
}
텍스트를 정리하고 줄인 모습:
{
"articles": [
{
"id": "pXhK9f2aQ1mZ0bT7cY3rLw",
"link": "https://www.reuters.com/markets/amd-zt-systems",
"source": { "domain": "www.reuters.com", "type": "newswire" },
"title": "AMD to buy ZT Systems",
"summary": "AMD agreed to buy server maker ZT Systems ...",
"language": "en",
"publishedAt": "2026-09-18T12:01:03.000Z",
"firstSeenAt": "2026-09-18T12:01:41.000Z",
"availableAt": "2026-09-18T12:03:05.000Z",
"countries": ["US"],
"categories": ["markets"],
"sentiment": { "label": "positive", "confidence": 0.98 },
"companies": [
{
"companyId": 13,
"name": "Advanced Micro Devices, Inc.",
"primaryListing": { "ticker": "AMD", "mic": "XNAS", "country": "US" },
"role": "acquirer",
"relevance": 0.95
},
{
"companyId": 90412,
"name": "ZT Systems",
"primaryListing": null,
"role": "target",
"relevance": 0.9
}
],
"events": [
{ "type": "mna", "direction": "positive", "importance": "high", "confidence": 0.9, "companyIds": [13, 90412] }
]
}
],
"pagination": { "limit": 5, "returned": 1, "hasMore": false, "nextCursor": null }
}
기사의 모든 필드는 기사 객체에 설명되어 있습니다. sentiment, companies, events는 요금제에 따라 다릅니다. 요금제 및 이용 권한을 참조하세요.
다음 페이지: 같은 인수로 search_articles를 다시 호출하고 cursor를 pagination.nextCursor로 설정하세요. 마지막 페이지에서는 nextCursor가 null입니다. 페이지네이션을 참조하세요.
get_article
finlight id로 기사 하나를 가져옵니다. id는 검색 결과의 id 필드입니다. 검색 결과에 블록을 더 불러올 때 쓰세요.
오래된 기사는 id 조회가 not_found로 응답할 수 있습니다. 그럴 때는 검색 결과의 link로 get_article_by_link를 호출하세요. 링크 조회는 모든 기사에 닿습니다.
매개변수:
| 매개변수 | 타입 | 필수 | 설명 |
|---|---|---|---|
id | string | 예 | 기사 id, 22자 |
include | string[] | 아니요 | 추가 블록: companies, events |
요청 예시:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_article",
"arguments": {
"id": "pXhK9f2aQ1mZ0bT7cY3rLw",
"include": ["events", "companies"]
}
}
}
응답 텍스트는 기사 객체입니다.
get_article_by_link
URL로 기사 하나를 가져옵니다.
매개변수:
| 매개변수 | 타입 | 필수 | 설명 |
|---|---|---|---|
link | string | 예 | 기사의 전체 URL |
include | string[] | 아니요 | 추가 블록: companies, events |
요청 예시:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_article_by_link",
"arguments": {
"link": "https://www.reuters.com/technology/example-article",
"include": ["companies"]
}
}
}
응답 텍스트는 기사 객체입니다.
search_companies
티커, 이름, ISIN 또는 벤더 표기로 finlight 기업 데이터에서 기업을 찾습니다. 예: NVDA, Samsung Electronics, US0079031078, 000660.KS 또는 XNAS:AMD. 그다음 어시스턴트는 쿼리에 companyId:<id>를 넣어 기사를 검색할 수 있습니다. 기업 데이터가 포함된 요금제가 필요합니다.
매개변수:
| 매개변수 | 타입 | 필수 | 설명 |
|---|---|---|---|
q | string | 예 | 티커, 이름, ISIN 또는 벤더 표기, 최대 200자 |
mic | string | 아니요 | 이 거래소에 상장된 기업만 남김. MIC(XNAS) 또는 별칭(NASDAQ) |
요청 예시:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "search_companies",
"arguments": {
"q": "000660.KS"
}
}
}
응답 텍스트는 {"companies": [...]}이며, 가장 잘 맞는 기업부터 최대 10개가 들어 있습니다. 각 기업에는 companyId, name, country, sector, industry, isins, primaryListing, listings, updatedAt이 있습니다. 기업 레코드를 참조하세요.
list_sources
쓸 수 있는 모든 뉴스 소스를 가져옵니다.
매개변수: 없음
요청 예시:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_sources",
"arguments": {}
}
}
응답 텍스트는 소스의 JSON 배열입니다. 각 소스에는 다음이 있습니다:
domain: 소스의 도메인.sources,optInSources,excludeSources에 쓰는 값입니다name: 표시 이름type: 소스 유형.sourceTypes와excludeSourceTypes에 쓰는 값입니다isDefault: 이름을 지정하지 않아도 검색되는 소스인지 여부isCustom: 여러분에게 부여된 커스텀 소스인지 여부country와languages
isDefault: false인 소스는 optInSources로 검색에 추가합니다. 소스를 참조하세요.
MCP 프로토콜 메서드
서버는 다음 MCP 메서드를 구현합니다:
| 메서드 | 설명 |
|---|---|
initialize | MCP 세션 시작 |
notifications/initialized | 초기화 완료 확인 |
tools/list | 사용 가능한 도구와 스키마 목록 |
tools/call | 인수로 도구 실행 |
ping | 상태 확인 |
초기화 예시:
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {
"name": "my-client",
"version": "1.0.0"
}
}
}
응답:
{
"jsonrpc": "2.0",
"result": {
"protocolVersion": "2024-11-05",
"capabilities": {
"tools": {}
},
"serverInfo": {
"name": "finlight-news-api",
"version": "2.0.0"
}
},
"id": 1
}
OAuth 흐름
OAuth를 지원하는 클라이언트(Claude Desktop 등)를 위해 서버는 PKCE를 사용하는 OAuth 2.0을 구현합니다.
엔드포인트
| 엔드포인트 | 메서드 | 설명 |
|---|---|---|
/.well-known/oauth-protected-resource | GET | 보호된 리소스 메타데이터 |
/.well-known/oauth-authorization-server | GET | 인가 서버 메타데이터 |
/register | POST | 동적 클라이언트 등록 |
/authorize | GET | 인가 페이지 |
/authorize/submit | POST | 인가 처리 |
/token | POST | 코드를 토큰으로 교환 |
흐름 개요
1. The client finds the OAuth endpoints through .well-known
2. The client can register through /register
3. The client sends the user to /authorize with a PKCE challenge
4. The user enters an API key and submits
5. The server redirects back with an authorization code
6. The client exchanges code + verifier for an access token
7. The client uses the access token as Bearer token for tool calls
보안 기능
- PKCE 필수: 인가 코드 가로채기를 막습니다
- 암호화된 코드: 인가 코드는 암호화(AES-256-GCM)되므로 서버는 상태를 보관하지 않습니다
- 짧은 수명의 코드: 코드는 120초 후 만료됩니다
- 리디렉션 URI 확인: 코드는 발급된 리디렉션 URI에서만 작동합니다
오류 처리
도구 오류
어시스턴트가 고칠 수 있는 이유로 도구 호출이 실패하면, 응답은 isError: true가 있는 일반 도구 결과입니다. 텍스트는 JSON이며 항상 error가 있습니다. API에서 온 오류에는 status와 message가 더해지고, 개별 필드가 잘못되었으면 issues도 더해집니다. 어시스턴트는 이유를 읽고 호출을 바꿀 수 있습니다. 예를 들어 매개변수를 고치거나 필터를 뺍니다.
{
"jsonrpc": "2.0",
"result": {
"isError": true,
"content": [{
"type": "text",
"text": "{\"error\":\"forbidden\",\"status\":403,\"message\":\"Company master data requires the entityAccess entitlement.\"}"
}]
},
"id": 1
}
error | status | 발생 시점 |
|---|---|---|
invalid_arguments | 없음 | 도구가 모르는 인수, 잘못된 타입의 값, 또는 범위를 벗어난 값(limit 1minRelevance 0id, link 또는 q, 200자를 넘는 q). error와 issues만 있으며, issues가 인수를 알려 줍니다. 서버가 API를 호출하기 전에 응답하므로 크레딧이 들지 않습니다. |
validation | 없음 | 요청을 보내기 전에 검사하는 값. 예: 빈 languages 목록, 빈 cursor, 3개를 넘는 include 값. API를 호출하기 전에 응답합니다. |
validation_failed | 400 | API가 값을 거부함. 예: query의 알 수 없는 필드. issues가 필드를 알려 줍니다. |
cursor_invalid | 400 | cursor가 이 API의 커서가 아님 |
cursor_mismatch | 400 | 페이지 사이에 정렬이나 필터가 바뀜. limit과 include는 바꿔도 됩니다. |
unauthorized | 401 | API 키가 틀렸거나 삭제됨 |
forbidden | 403 | 요금제에 포함되지 않음. 예: 기업 데이터 없이 search_companies 호출 |
not_found | 404 | 이 id나 링크의 기사가 없거나, 기사가 요금제의 날짜 범위 밖에 있음. 오래된 기사에는 get_article_by_link를 쓰세요. |
rate_limited | 429 | 버스트 제한 또는 월간 크레딧에 도달함 |
internal_error | 500 | 저희 쪽에서 문제가 생김 |
timeout, network | 없음 | API가 제때 응답하지 않음. 다시 호출하세요. |
status 값과 그 원인은 REST API와 같습니다. 오류를 참조하세요.
요금제에 포함되지 않은 블록(companies나 events 등)은 오류 없이 기사에서 빠집니다. 요금제 및 이용 권한을 참조하세요.
JSON-RPC 오류 코드
| 코드 | 발생 시점 |
|---|---|
| -32700 | 요청 본문이 유효한 JSON이 아님 |
| -32600 | jsonrpc가 "2.0"이 아니거나 method가 없음 |
| -32601 | 알 수 없는 메서드 |
| -32602 | 도구 이름이 없거나 알 수 없는 도구 이름인 tools/call |
| -32001 | API 키 없음. 키가 없으면 서버는 HTTP 401로 응답하고 OAuth 메타데이터를 가리킵니다. |
| -32603 | 예상하지 못한 실패. message에 이유가 나옵니다. |
빈 요청 본문에는 JSON-RPC 오류가 아니라 HTTP 400과 {"error":"Request body is required"}로 응답합니다.
{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Unknown tool: search_news"
},
"id": 1
}
속도 제한
모든 도구 호출은 여러분의 키로 보내는 API 요청 하나이므로 API와 같은 제한이 적용됩니다. search_articles, get_article, get_article_by_link, search_companies, list_sources는 호출마다 1 크레딧이 듭니다. 검색의 다음 페이지도 각각 1 크레딧이 듭니다. 검색 전에 기업을 찾는 어시스턴트는 그 질문에 2 크레딧을 씁니다.
API 오류로 끝난 호출도 API와 마찬가지로 1 크레딧이 듭니다. 잘못된 키 같은 예외는 속도 제한 및 크레딧에 나와 있습니다. 제한에 도달하면 도구는 rate_limited와 상태 429로 응답합니다.
사용량과 제한은 app.finlight.me에서 확인하세요.
지원
- 문서: docs.finlight.me
- 대시보드: app.finlight.me
- 지원: 문의하기