0Pricing
MCP Academy · 강의

긴 작업의 진행 상황 보내기

완료율 업데이트를 클라이언트에 스트리밍합니다.

긴 작업의 진행 상황 보내기은(는) CoddyKit의 무료 MCP Academy 강의입니다. 이것은 4개 중 1번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 MCP Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. MCP Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Why Progress Matters

When a tool takes seconds or minutes, the client should not just hang. MCP lets your server send progress updates so the user sees movement.

The Progress Token

The client opts in by attaching a progressToken to the request. Without that token, your server simply skips sending updates.

Reach the Context Object

In the Python SDK, a tool receives a Context object. It is your handle for talking back to the client mid-call, including progress.

from mcp.server.fastmcp import Context

@mcp.tool()
async def crunch(n: int, ctx: Context) -> str:
    return "done"

Call report_progress

To push an update, you call ctx.report_progress. Each call tells the client how far along the work has come.

await ctx.report_progress(progress=3, total=10)

Progress and Total

The total argument is the finish line. The client can divide progress by total to draw a percent-done bar for the user.

await ctx.report_progress(progress=5, total=10)  # 50%

Update Inside a Loop

The natural place to report is inside your work loop. After each chunk finishes, send one update so the bar climbs steadily.

for i, item in enumerate(items):
    process(item)
    await ctx.report_progress(i + 1, len(items))

Progress Without a Total

Sometimes you cannot know the total upfront. You may omit it; the client then shows an indeterminate spinner instead of a precise bar.

await ctx.report_progress(progress=42)  # total unknown

Add an Optional Message

Many SDK versions let you attach a short message to a progress call, like "Indexing files", giving the user friendly human context.

await ctx.report_progress(2, 5, message="Fetching pages")

It Is a Notification

Progress travels as a JSON-RPC notification, so it has no reply and never blocks. Your tool keeps working while updates flow out.

Keep Updates Reasonable

Do not flood the client with thousands of tiny updates. Report at meaningful steps so the stream stays useful and lightweight.

Progress Plus a Result

Progress notifications are separate from your tool's return value. You stream updates as you go, then hand back the final result at the end.

await ctx.report_progress(10, 10)
return "index built"

Quick Check

Test your grasp of how progress reporting begins.

Recap: Progress

You learned to call ctx.report_progress with progress and total, loop your updates, and let the client draw a live bar. Nice work!

자주 묻는 질문

“긴 작업의 진행 상황 보내기” 강의는 무료인가요?

네 — “긴 작업의 진행 상황 보내기” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 MCP Academy 강의 전체를 잠금 해제할 수 있습니다. MCP Academy 강의에는 총 4개의 강의가 포함되어 있습니다.

“긴 작업의 진행 상황 보내기”에서 뭘 배우나요?

완료율 업데이트를 클라이언트에 스트리밍합니다. 브라우저에서 직접 실행하는 실습 코드로 MCP Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

MCP Academy을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 MCP Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 1번째 강의입니다.

“긴 작업의 진행 상황 보내기” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 MCP Academy 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 MCP Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 긴 작업의 진행 상황 보내기
  2. 취소 요청 처리하기
  3. 클라이언트에 구조화된 로깅 보내기
  4. 실행 중 로그 수준 설정하기
← MCP Academy(으)로 돌아가기