Spark History Server MCP
Spark History Server MCP (TypeScript)
LLM에 Spark History Server에 대한 읽기 권한을 부여하여 Spark 작업의 지루한 부분(작업 실패 원인 찾기, 느린 작업이 시간을 소비하는 위치 찾기)을 처리하도록 합니다.
이것은 kubeflow/mcp-apache-spark-history-server의 TypeScript 포트로, Python 원본과 응답 대 응답으로 검증되었습니다 — PARITY.md를 참조하세요. 포트 위에 두 가지 에이전트 스킬을 제공하여 원시 도구를 근본 원인 분석 및 성능 튜닝을 위한 전문가 워크플로로 전환합니다.
┌──────────────────┐
data engineer ──▶ │ LLM client │ Claude Code / Claude Desktop / any MCP client
│ + skills │ ← skills/ supply the method
└────────┬─────────┘
│ MCP (stdio or streamable-http)
┌────────▼─────────┐
│ this server │ 17 tools, 2 prompts
└────────┬─────────┘
│ HTTP GET /api/v1/...
┌────────▼─────────┐
│ Spark History │ your existing one, or the bundled demo
│ Server │
└────────┬─────────┘
│ reads
┌────────▼─────────┐
│ event logs │ s3://…, hdfs://…, file://…
└──────────────────┘이 서버는 History Server의 REST API에 GET 요청만 발행합니다. 어떤 것도 수정할 수 없습니다.
목차
Related MCP server: Spark EventLog MCP Server
1. 빠른 시작
옵션 A — Docker (Docker 외에 설치할 것이 없음)
샘플 이벤트 로그가 로드된 Spark History Server와 이 MCP를 함께 시작합니다:
git clone https://github.com/ukonduru91/spark-history-mcp.git
cd spark-history-mcp
docker compose up --buildSpark History Server UI | |
Spark History REST API | |
MCP 엔드포인트 |
번들된 로그에는 정상 파이프라인과 의도적으로 실패한 작업이 포함되어 있어, 자체 클러스터를 연결하기 전에 도구가 보여줄 실제 데이터가 있습니다.
History Server만 실행하려면:
./start_local_spark_history.sh # macOS / Linux / Git Bash
.\start_local_spark_history.ps1 # Windows PowerShell옵션 B — 소스에서
Node.js 20+ 필요 (22 권장).
git clone https://github.com/ukonduru91/spark-history-mcp.git
cd spark-history-mcp
npm install
npm run build
npm start작동 확인
node scripts/mcp-cli.mjs list-tools
node scripts/mcp-cli.mjs call list_applications '{"limit": 5}'애플리케이션이 반환되면 연결된 것입니다.
2. Spark History Server 연결
이것이 반드시 구성해야 하는 유일한 항목입니다. 세 가지 방법, 우선순위가 높은 순서대로 — 환경 변수가 .env 파일보다 우선하고, .env 파일이 YAML보다 우선합니다.
a. 환경 변수 (컨테이너 및 CI에 가장 적합)
중첩은 이중 밑줄을 사용합니다. 아래 LOCAL은 서버에 대해 선택하는 이름일 뿐입니다:
export SHS_SERVERS__LOCAL__URL=http://spark-history.internal:18080
export SHS_SERVERS__LOCAL__DEFAULT=trueb. YAML 구성 파일
서버는 다음 순서로 파일을 찾습니다:
--config에 지정된 경로 또는$SHS_MCP_CONFIG작업 디렉터리의
./config.yaml~/.config/spark-mcp/config.yaml
servers:
prod:
url: "https://spark-history.company.com:18080"
default: true # used when a tool call omits `server`
verify_ssl: true
ssl_ca_cert: "/etc/ssl/custom-ca/ca-bundle.pem" # private CA
timeout: 30 # seconds
auth:
username: admin
password: ${SPARK_PASSWORD} # see the note below
# token: <bearer token> # or a bearer token instead
staging:
url: "https://spark-history-staging.company.com:18080"비밀 정보에 관하여: YAML의 값은 리터럴입니다 —
${SPARK_PASSWORD}는 확장되지 않습니다. 자격 증명은 환경 변수(SHS_SERVERS__PROD__AUTH__PASSWORD)에 보관하세요. 이는 파일보다 우선합니다. 이는 업스트림 프로젝트의 동작과 일치합니다.
c. .env 파일
(a)와 동일한 변수 이름을 사용하며, 작업 디렉터리의 .env에서 읽습니다.
여러 서버
원하는 만큼 구성하세요. 도구는 선택적 server 인수를 받습니다. 생략하면 서버가 해당 애플리케이션을 보유한 구성된 History Server를 발견하여 사용합니다(5분 동안 캐시됨). 따라서 엔지니어는 어떤 클러스터에서 실행되었는지 모르는 상태에서도 애플리케이션 ID에 대해 질문할 수 있습니다.
모든 설정
설정 | 환경 변수 | 기본값 | 의미 |
|
|
| History Server 기본 URL |
|
|
|
|
|
| — | 기본 인증 |
|
| — | 기본 인증 |
|
| — | bearer 토큰 |
|
|
| TLS 검증 |
|
| — | 사설 CA용 PEM 번들 |
|
|
| 요청 시간 초과, 초 단위 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| HTTP 바인드 주소 |
|
|
| HTTP 바인드 포트 |
|
|
| 상세 로깅 |
단일 밑줄 변수(SHS_MCP_PORT)는 여전히 작동하지만 업스트림과 동일하게 사용 중단 경고를 기록합니다.
라우팅할 수 없는 History Server에 연결
SSH 터널과 use_proxy: true를 함께 사용하면 일반적인 잠긴 클러스터 사례를 해결합니다:
ssh -D 8157 -N user@bastion # SOCKS5 proxy on :81573. LLM 클라이언트 연결
stdio (Claude Code, Claude Desktop, 대부분의 클라이언트)
{
"mcpServers": {
"spark-history": {
"command": "node",
"args": ["/absolute/path/to/spark-history-mcp/dist/index.js"],
"env": {
"SHS_MCP__TRANSPORT": "stdio",
"SHS_SERVERS__PROD__URL": "https://spark-history.company.com:18080",
"SHS_SERVERS__PROD__DEFAULT": "true"
}
}
}
}Claude Code 사용자는 한 줄로 동일하게 수행할 수 있습니다:
claude mcp add spark-history \
--env SHS_MCP__TRANSPORT=stdio \
--env SHS_SERVERS__PROD__URL=https://spark-history.company.com:18080 \
--env SHS_SERVERS__PROD__DEFAULT=true \
-- node /absolute/path/to/spark-history-mcp/dist/index.jsstreamable-http (팀을 위한 공유 서버 하나)
한 번 실행하고 모두가 연결하도록 합니다:
SHS_MCP__TRANSPORT=streamable-http SHS_MCP__ADDRESS=0.0.0.0 npm start클라이언트는 http://<host>:18888/mcp에 연결합니다. 서버는 읽기 전용이지만 인증되지도 않습니다 — 일반 내부 인그레스 뒤에 배치하고, 브라우저에서 접근 가능하다면 DNS 리바인딩 보호를 활성화하세요:
mcp:
transport_security:
enable_dns_rebinding_protection: true
allowed_hosts: ["spark-mcp.internal:*"]
allowed_origins: ["https://spark-mcp.internal"]4. 스킬 설치
도구는 모델에 데이터 접근 권한을 제공합니다. 스킬은 방법론을 제공합니다 — 증거를 수집하는 순서, 발견과 노이즈를 구분하는 임계값, 그리고 데이터에서 확인하지 않은 원인을 지목해서는 안 된다는 규칙입니다.
# per project
mkdir -p .claude/skills
cp -r skills/spark-rca skills/spark-optimization .claude/skills/
# or for every project
mkdir -p ~/.claude/skills
cp -r skills/spark-rca skills/spark-optimization ~/.claude/skills/스킬 | 처리 대상 | 트리거 조건 |
| 실패, 종료 또는 중단된 작업 | "왜 실패했지", 스택 추적, 앱 ID, "OOM", "멈춤" |
| 느리거나, 비싸거나, 회귀된 작업 | "왜 느리지", "튜닝", "예전엔 20분 걸렸는데", "비용 절감" |
일반적인 질문만으로 자동으로 트리거됩니다 — 명령을 기억할 필요가 없습니다:
"새벽 2시 로드가 또 실패했어, app_1724… — 확인해줄 수 있어?"
각 스킬의 내용과 팀 자체 지식으로 확장하는 방법은 skills/README.md를 참조하세요.
5. 도구
17개 모두 src/tools/tools.ts에 있으며, JSON 스키마는 src/schemas/generated.ts에 있습니다. 인수와 함께 확인하려면 node scripts/mcp-cli.mjs list-tools를 실행하세요.
찾기
도구 | 반환값 |
| 애플리케이션, 상태 및 날짜로 필터링 가능, 또는 |
| 애플리케이션의 작업 — 기본적으로 실패한 작업이 먼저; |
| 스테이지, 동일한 정렬 옵션, 선택적 요약 메트릭 |
| 실행자, 기본적으로 활성 상태, 전체 기록은 |
| 선별된 SQL 실행 요약, 설명으로 필터링 가능 |
심층 분석
도구 | 반환값 |
| 분위수에서의 작업별 메트릭 분포가 포함된 단일 스테이지 |
| 작업별 예외 및 스택 추적 — 근본 원인이 있는 곳 |
| 단일 쿼리: 헤더, 물리적 계획, 노드별 메트릭, 작업, 스테이지 |
| 런타임 버전, Spark/시스템/Hadoop 속성, 클래스패스 — |
| 애플리케이션에 대한 집계된 실행자 메트릭 |
| JVM 스레드 덤프 — 실행 중인 애플리케이션만 |
진단
도구 | 반환값 |
| 가장 느린 스테이지와 작업, 스필, GC 압력, 활용도, 권장 사항 |
| 실행자 추가/제거 및 스테이지 타임라인 요약 |
두 실행 비교
도구 | 반환값 |
| 구성 차이 — 두 실행 사이에 변경된 사항 |
| 리소스 및 기간 차이 |
| 두 쿼리의 메트릭 차이, 선택적 계획 구조 차이 포함 |
| 스테이지 메트릭 및 작업 분위수를 나란히 비교 |
프롬프트
investigate_failure(app_id, server?) 및 compare_applications(app_a, app_b, server?, context?) — 엔지니어가 분석을 넘기지 않고 직접 주도하려는 경우를 위한 업스트림 프로젝트의 대화형 워크스루입니다.
6. 작동 방식
도구 호출은 /api/v1/...에 대한 하나 이상의 GET이 되며, JSON은 Python 원본이 형성한 것과 정확히 동일한 형태로 반환됩니다.
src/
index.ts CLI entry, transport selection (stdio | streamable-http)
config/config.ts YAML + .env + SHS_* resolution and precedence
core/
app.ts MCP request handlers; maps results to content blocks
validation.ts pydantic-compatible argument validation and messages
json.ts Python-compatible JSON rendering
pyfloat.ts int/float fidelity across the JSON round-trip
pyrepr.ts Python repr() for validation messages
errors.ts error text shaping
api/
httpClient.ts HTTP transport, ApiException taxonomy, auth, TLS, SOCKS
sparkClient.ts Spark REST facade: pagination, attempts, status filters
models/
generated.ts model shapes, generated from the upstream OpenAPI models
deserialize.ts from_dict / model_dump equivalents
mcpTypes.ts curated LLM-facing output models
tools/tools.ts the 17 tools
prompts/prompts.ts the 2 prompts
schemas/generated.ts tool + prompt catalogue (names, descriptions, schemas)수정할 계획이 있다면 알아둘 만한 세 가지 세부 사항:
models/generated.ts및schemas/generated.ts는 생성됩니다,tools/gen_models.py와tools/gen_schemas.py에 의해 업스트림 Python 프로젝트에서 생성됩니다. 수동 편집보다는 재생성하세요 — 이것이 카탈로그와 응답 형태를 원본과 동일하게 유지하는 방법입니다.저수준
ServerAPI가 사용되며McpServer가 아닙니다, 결과 형태가 FastMCP와 일치해야 하기 때문입니다: 목록 요소당 텍스트 블록 하나, 그리고 Python 시그니처가 구체적인 반환 유형을 선언한 도구에만structuredContent가 사용됩니다.애플리케이션 발견을 통해 도구가
server를 생략할 수 있습니다.ApplicationDiscovery는 각 구성된 서버에서 애플리케이션 ID를 탐색하고 답변을 5분 동안 캐시합니다.
7. 배포
Docker
docker build -t spark-history-mcp .
docker run -p 18888:18888 \
-e SHS_SERVERS__PROD__URL=https://spark-history.company.com:18080 \
-e SHS_SERVERS__PROD__DEFAULT=true \
-e SHS_MCP__ADDRESS=0.0.0.0 \
spark-history-mcpKubernetes
환경 변수의 URL과 Secret의 자격 증명을 사용하여 일반 Deployment로 실행합니다:
env:
- name: SHS_MCP__TRANSPORT
value: streamable-http
- name: SHS_MCP__ADDRESS
value: "0.0.0.0"
- name: SHS_SERVERS__PROD__URL
value: http://spark-history-server.spark.svc.cluster.local:18080
- name: SHS_SERVERS__PROD__DEFAULT
value: "true"
- name: SHS_SERVERS__PROD__AUTH__TOKEN
valueFrom:
secretKeyRef: { name: spark-history-auth, key: token }이 프로세스는 5분 디스커버리 캐시를 제외하면 상태가 없으므로 조정 없이 수평 확장할 수 있습니다.
8. 문제 해결
증상 | 원인 및 해결 방법 |
| 잘못된 URL 또는 포트, 또는 History Server가 다운됨. 동일 호스트에서 |
| ID가 설정된 서버에 없거나, 이벤트 로그가 아직 수집되지 않음 — |
|
|
| 어떤 태스크도 완료되기 전에 실패한 스테이지에 대한 Spark 자체의 응답. 도구 문제가 아님 — 대신 태스크 예외를 읽으세요 |
| 예상된 동작: History Server는 스레드 덤프를 유지하지 않습니다. 앱이 실행되는 동안에만 작동합니다 |
Empty |
|
Very large responses |
|
| EMR persistent-UI 인증은 포팅되지 않음; 대신 직접 접근 가능한 URL을 지정하세요 |
SHS_MCP__DEBUG=true를 설정하면 상세 로그가 출력됩니다.
9. 개발
npm install
npm run build # compile to dist/
npm run dev # run from source, no build step
npm test # unit tests
npm run typecheck # tsc --noEmit교차 구현 일관성 테스트는 parity/에 있습니다 — 이 서버와 Python 원본에 동일한 MCP 호출을 실행하여 모든 응답을 비교합니다. PARITY.md는 결과와 남아 있는 정확한 차이를 기록합니다.
업스트림에서 포팅되지 않음
업스트림 모듈 | 상태 |
| 포팅되지 않음 — |
| 포팅되지 않음 — AWS 호스팅 MCP 엔드포인트에 프록시하며, AWS 자격 증명이 있을 때만 등록됩니다 |
| 포팅되지 않음 — 도구 호출이 없는 Playwright 스크린샷 헬퍼 |
라이선스
Apache-2.0, 업스트림 프로젝트와 동일합니다.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to interact with Delta Lake tables stored in MinIO through Spark using natural language queries. Provides read-oriented data operations on Delta Lake tables through the Model Context Protocol.
- AlicenseNot gradedqualityDmaintenanceEnables comprehensive analysis of Apache Spark event logs from S3, HTTP, or local sources, providing performance metrics, resource monitoring, shuffle analysis, and automated optimization recommendations with interactive HTML reports.MIT
- FlicenseNot gradedqualityNot gradedmaintenanceExposes Spark History Server metrics and metadata as tools for LLM-based analysis of Spark applications. It enables deep optimization of Spark jobs by providing access to job summaries, stage details, SQL execution plans, and executor performance.
- AlicenseNot gradedqualityAmaintenanceExposes Spark History Server data as tools for AI agents, enabling natural language querying of Spark applications, jobs, stages, and performance metrics.189Apache 2.0
Related MCP Connectors
The grounded data layer for any LLM: governed SQL, metrics, lineage and catalog over your data.
Enable language models to perform advanced AI-powered web scraping with enterprise-grade reliabili…
LLM chat, text summarization and AI image generation
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/ukonduru91/spark-history-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server