How to Add an MCP Server to Claude Code: Step-by-Step
How to add an MCP server to Claude Code with claude mcp add: hosted, local and OAuth servers, scopes, .mcp.json, status checks and fixes for common errors.
10 min read
Agentic workflows let a model choose its next step at runtime. Five patterns from Anthropic and LangGraph, real GitHub and IBM examples, and when to skip them.
Agentic workflows are the way most teams put a language model to work on a multi-step job without handing it the whole job. The model reads the situation, picks a tool, checks what came back and decides what to do next. This post separates the vocabulary, walks through five patterns you can copy, and says when a plain LLM call is the better choice.
Agentic workflows are multi-step AI processes in which a language model decides at runtime what to do next, calls tools, checks the results and repeats until a goal is met. The goal is fixed, but the path is not. That separates them from fixed pipelines, where code decides every step in advance.
An agentic workflow works by looping through four activities: planning, tool use, reflection and orchestration. Neo4j's March 2026 guide describes the loop this way: the system interprets the goal and decides what to do, executes an action with a tool, reflects on the result and loops back to plan again if the goal is not met, and coordinates several agents and states when the job needs it.
Neo4j also lays out where the line sits between three kinds of workflow:
| Workflow type | How it runs | Best for |
|---|---|---|
| Deterministic | Fixed steps and rules | Stable, repeatable processes |
| Non-agentic AI | Fixed pipeline with an LLM step | Bounded tasks like summarizing, classifying, extracting |
| Agentic AI | Plans, uses tools, iterates with feedback | Investigation, diagnosis, open-ended work |
The term is used in two ways, and mixing them causes most of the confusion in design discussions. Anthropic's Building effective agents calls everything an "agentic system" and then splits it. Workflows are systems where LLMs and tools are orchestrated through predefined code paths. Agents are systems where LLMs dynamically direct their own processes and tool usage.
IBM and Neo4j use "agentic workflow" for the adaptive kind: IBM defines it as AI-driven processes where autonomous agents make decisions, take actions and coordinate tasks with minimal human intervention. In practice you will build something on a spectrum between the two. The five patterns below sit at the predictable end of it, and Anthropic's autonomous agent sits at the other.
Anthropic's post publishes five workflow patterns that developers can combine, and LangChain's LangGraph docs implement the same set with a graph API. Anthropic says these are not prescriptive: shape and combine them to fit the use case, and add complexity only when it demonstrably improves outcomes.

Prompt chaining splits a task into a sequence where each LLM call processes the output of the previous one. You can add a programmatic check, which Anthropic calls a gate, on any intermediate step to confirm the process is still on track. Use it when the task decomposes cleanly into fixed subtasks. It trades latency for accuracy by making each call easier. Anthropic's examples: generate marketing copy and then translate it, or write an outline, check it against criteria, then write the document.
Routing classifies an input and sends it to a specialized follow-up task. It keeps prompts focused, because optimizing one prompt for one kind of input can hurt performance on other inputs. Anthropic's examples are sorting customer service queries (general questions, refund requests, technical support) into different downstream processes, and sending easy questions to a smaller model such as Claude Haiku 4.5 and hard ones to a more capable model such as Claude Sonnet 4.5.
Parallelization runs LLM calls at the same time and aggregates the outputs in code. It comes in two variants. Sectioning splits a task into independent subtasks. Voting runs the same task several times for diverse outputs. Anthropic cites guardrails as a sectioning case (one instance answers the user while another screens the request) and code review for vulnerabilities as a voting case, where several prompts each flag a problem.
In the orchestrator-workers pattern a central LLM breaks a task into subtasks, delegates them to worker LLMs and synthesizes the results. It looks like parallelization, but the subtasks are not predefined: the orchestrator picks them from the input. Coding tools that change several files per task are the standard case, because the number of files and the change in each depend on the task. LangGraph supports this with its Send API, which creates worker nodes dynamically and gives each one its own state while all worker outputs land in a shared state key.
Evaluator-optimizer puts one LLM call in a loop with another: one generates a response and the other evaluates it and returns feedback. Anthropic says it fits when you have clear evaluation criteria and when iterative refinement has measurable value. Its two signs of a good fit are that responses improve when a human articulates feedback and that the LLM can produce that feedback. Neo4j's version of this idea is the reflection pattern, and its advice is to cap the number of iterations, define explicit evaluation criteria and use a second prompt or model as the critic.
The clearest examples are the ones that ship: IBM's support scenario, GitHub's repository automation and the LangGraph code that wires a chain together.
IBM contrasts a rule-based IT chatbot with an agentic one. When an employee reports that wifi is not working, the rule-based bot runs a static decision tree and escalates if that fails. The agentic version asks clarifying questions, runs diagnostic steps, calls an internal monitoring API if it suspects a server-side issue, changes approach when a step fails, and logs the fix. If the problem stays unresolved it escalates with a report of what it already tried.
GitHub Agentic Workflows (gh-aw) is repository automation written in Markdown with YAML frontmatter and run in GitHub Actions. The overview page says the gh-aw CLI compiles the source into a standard Actions workflow while adding controls for permissions, tools, sandboxing and writes. This is the example on its home page:
---
on:
schedule: daily
permissions:
contents: read
issues: read
pull-requests: read
safe-outputs:
create-issue:
title-prefix: "[team-status] "
labels: [report, daily-status]
close-older-issues: true
---
## Daily Issues Report
Create an upbeat daily status report for the team as a GitHub issue.
## What to include
- Recent repository activity (issues, PRs, discussions, releases, code changes)
- Progress tracking, goal reminders and highlights
- Project status and recommendations
- Actionable next steps for maintainersThe agent gets read-only access to repository context and can only request the outputs declared under safe-outputs. The site lists five stable built-in engines: GitHub Copilot (the default), Claude Code, OpenAI Codex, Google Gemini and Pi. Custom engine definitions for Cursor, Kiro and Aider exist as unsupported samples.

The LangGraph docs build a chain with a StateGraph: nodes are functions, edges connect them, and a conditional edge acts as the gate. This excerpt is the wiring from the docs' example, with the State class and the three node functions defined earlier on the page:
workflow = StateGraph(State)
workflow.add_node("generate_joke", generate_joke)
workflow.add_node("improve_joke", improve_joke)
workflow.add_node("polish_joke", polish_joke)
workflow.add_edge(START, "generate_joke")
workflow.add_conditional_edges(
"generate_joke", check_punchline, {"Fail": "improve_joke", "Pass": END}
)
workflow.add_edge("improve_joke", "polish_joke")
workflow.add_edge("polish_joke", END)
chain = workflow.compile()The gate, check_punchline, is an ordinary Python function. A failed check routes the output through two more LLM calls, and a passing one ends the run. The same page shows each pattern in both a Graph API and a Functional API version.

Use an agentic workflow when the path to the result cannot be written down in advance, and skip it when a single well-prompted call would do. Anthropic recommends finding the simplest solution possible, which can mean not building an agentic system at all, because these systems often trade latency and cost for better task performance. For many applications, it says, optimizing single LLM calls with retrieval and in-context examples is enough.
Choose by how predictable the work is:
Neo4j adds production requirements: give each plan step a success or failure condition so the workflow can continue, retry or stop, and define tools with typed inputs and validated outputs. Anthropic's first principle is to keep the design simple, and it suggests starting with LLM APIs directly, since many patterns take a few lines of code. If you use a framework, understand the code under it: Anthropic calls incorrect assumptions about what is under the hood a common source of customer error.
If you are choosing what to build on, aiagentslisting.com lists about 587 published entries, including agents, MCP servers that give a workflow its tools, and skills.
max-ai-credits as a hard budget for each run, and gh aw logs and gh aw audit for finding the runs that use the most time, tokens and AI Credits. Sandbox runtimes include standard Docker and a preview cloud-hypervisor option.claude-sonnet-4-6 in its setup and streams the Functional API examples with stream_events(..., version="v3").An AI agent is the component that decides, and an agentic workflow is the process it runs inside. Anthropic draws a stricter line: in its terms a workflow follows predefined code paths and an agent directs its own process. IBM says a workflow is not agentic unless it contains an AI agent.
Yes, usually. Anthropic says agentic systems often trade latency and cost for better task performance, and that fully autonomous agents mean higher costs and the potential for compounding errors. Use them where the extra calls buy a measurably better result.
No. Anthropic suggests starting with LLM APIs directly because many patterns take a few lines of code. LangGraph is one option: its docs say it adds persistence, streaming, debugging support and deployment when you build workflows and agents on it.
Limit what the model can do and check what it proposes. GitHub Agentic Workflows layers sandboxing, scoped permissions, validated safe outputs and a threat-detection job that scans proposed outputs. Anthropic recommends sandboxed testing with guardrails, and Neo4j recommends capping the number of iterations.
Browse the AI agents directory to compare tools that already run these patterns.
One email a week. New agents, MCP servers and skills, and what is actually getting traction.
How to add an MCP server to Claude Code with claude mcp add: hosted, local and OAuth servers, scopes, .mcp.json, status checks and fixes for common errors.
10 min read
A comparison of open source AI agents: LangChain, CrewAI, OpenHands, goose, AutoGPT, Dify and n8n, with real license terms and 2026 release dates.
7 min read
Voice AI agents handle spoken calls with an LLM instead of a script. How the STT-LLM-TTS pipeline works, who builds voice AI agents, and what's new.
6 min read