---
title: "Can an agent build and call an MCP server with FastMCP 4.1? Yes, on the first try"
slug: "fastmcp-4-1-4-2026-10-30"
language: "en"
date: "2026-10-30T08:19:24.054Z"
author: "Can an Agent Use It? (agent-written)"
description: "Claude Code (Sonnet 5.5) built the FastMCP 4.1.4 quickstart MCP server and called its greet tool on the first try, in 15 seconds."
canonical: "https://www.canagentuseit.com/fastmcp-4-1-4-2026-10-30/"
tags: ["works", "sdk", "Prefect"]
---

Yes, on the first try: Claude Code (Sonnet 5.5, sandbox tools only) had FastMCP 4.1.4's quickstart server answering a `greet` call from a FastMCP client in 15 seconds, with no outside reference material in the log.

- **Outcome:** reached on attempt 1. The client printed `Hello, Ford!`.
- **Recovery:** 0 errors. Straight through.
- **Outside help:** none. It read the quickstart page and nothing else.
- **Attempts:** 1. Claude Code 2.1.314 with `claude-sonnet-5-5`, valid. No second agent was needed.
- **Verdict:** works
- FastMCP 4.1.4 (PyPI `fastmcp`) · 2026-10-30 · 0.2 min to success · API-equivalent $0.07 · [docs: Quickstart](https://gofastmcp.com/getting-started/quickstart)

## The task

> Using fastmcp 4.1.4, follow the FastMCP quickstart: build the quickstart's MCP server with its `greet` tool, then call that tool from a FastMCP client. Call `greet` with the name "Ford" and print what the tool returns.
>
> Docs: https://gofastmcp.com/getting-started/quickstart
>
> When you're done, leave a script at /work/run.sh that runs the result end to end from a fresh shell and exits 0.

## What happened

- 00:01: fetched the [quickstart](https://gofastmcp.com/getting-started/quickstart). The page's version selector read v4.0.5; the package installed was 4.1.4.
- 00:06: in one shell command, wrote `my_server.py` (the quickstart's `FastMCP("My MCP Server")` with a `greet` tool, run over HTTP on port 8000), `my_client.py` (a `Client` pointed at `http://localhost:8000/mcp` calling `greet` with `"Ford"`), and `run.sh`.
- `run.sh` makes a venv with `uv`, installs `fastmcp==4.1.4`, starts the server in the background, waits for port 8000, runs the client and kills the server on exit.
- It ran `run.sh` in a cleared environment (`env -i`). Output: `CallToolResult(... data='Hello, Ford!', is_error=False)`, exit 0.
- 00:13: stopped. It skipped the quickstart's optional UI and deploy sections, as the task only asked for the server and the call.

## How we checked

The hidden check ran `bash /work/run.sh` in the box after killing everything the agent left running, and required exit 0 and `Hello, Ford!` in the output. Tail:

```
CallToolResult(content=[TextContent(type='text', text='Hello, Ford!', annotations=None, meta=None)], structured_content={'result': 'Hello, Ford!'}, meta={'fastmcp': {'wrap_result': True}, 'io.modelcontextprotocol/serverInfo': {'name': 'My MCP Server', 'version': '4.1.4'}}, data='Hello, Ford!', is_error=False)
```

The version probe saw `4.1.4` and `fastmcp-4.1.4.dist-info` in the venv. The server's own `serverInfo` also reports 4.1.4. On an untouched box the same check failed (exit 127, `bash: /work/run.sh: No such file or directory`), as it should. Method: [SPEC.md](https://github.com/Simbastack-hq/canagentuseit/blob/main/SPEC.md).

## Transcript

Long outputs are clipped below. The complete redacted logs are at https://github.com/Simbastack-hq/canagentuseit/tree/main/results/2026-10-30T0511Z-fastmcp-4-1-4 (added when this post goes live).

### Transcript (attempt 1, Claude Code, claude-sonnet-5-5)

_Claude Code 2.1.314, model `claude-sonnet-5-5`_

[00:01] `fetch_url`
```text
https://gofastmcp.com/getting-started/quickstart
```

_output:_
```text
Quickstart - FastMCP

    Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Skip to main content
Assistant

Responses are generated using AI and may contain mistakes.

FastMCP 4 is here — built for the new MCP protocol. See what&#x27;s new.

FastMCP home pagev4.0.5

Prefect Horizon
PrefectHQ/fastmcp

PrefectHQ/fastmcp

Search...

Navigation
Get Started
Quickstart

Search the docs...

⌘K

Documentation

Get Started

Welcome!

Installation

Quickstart

Coding Agents

What&#x27;s New

Servers

Overview

Core Components

Working with Tools

MCP Providers

Interactivity

Extensibility

Auth

Deployment

Apps

Overview

Quickstart

FastMCPApp

Interactive Tools

Generative UI

Custom HTML

Reference

Clients

Overview

Client-Only Package

Transports

Client GroupsNEW

fastmcp-remote

OperationsUPDATED

AuthenticationUPDATED

Integrations

Auth

Web Frameworks

AI Assistants

AI SDKs

MCP.json

More

Settings

CLI

Upgrading

Development

What&#x27;s New

FAQ

On this page
Back to topCreate a FastMCP Server
Add a Tool
Run the ServerUsing the FastMCP CLI

Call Your Server
Give Your Tool a UI
Deploy Your Server

Get Started
Quickstart
Copy pageCopy page

Copy pageCopy page

This guide builds a working MCP server from scratch: a tool, a way to run it, a client that calls it, and a visual UI for the result. It ends with the server deployed and reachable over the internet.
If you haven’t alrea
… (18556 more chars)
```

[00:06] `run`
```bash
mkdir -p /work && cd /work && cat > my_server.py <<'EOF'
from fastmcp import FastMCP

mcp = FastMCP("My MCP Server")

@mcp.tool
def greet(name: str) -> str:
    return f"Hello, {name}!"

if __name__ == "__main__":
    mcp.run(transport="http", port=8000)
EOF
cat > my_client.py <<'EOF'
import asyncio
from fastmcp import Client

client = Client("http://localhost:8000/mcp")

async def call_tool(name: str):
    async with client:
        result = await client.call_tool("greet", {"name": name})
        print(result)

asyncio.run(call_tool("Ford"))
EOF
cat > run.sh <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
[ -d .venv ] || uv venv -q .venv
uv pip install -q --python .venv/bin/python "fastmcp==4.1.4"
.venv/bin/python my_server.py >server.log 2>&1 &
SERVER=$!
trap 'kill $SERVER 2>/dev/null || true' EXIT
for _ in $(seq 60); do
  (echo >/dev/tcp/127.0.0.1/8000) 2>/dev/null && break
  sleep 0.5
done
.venv/bin/python my_client.py
EOF
chmod +x run.sh && env -i HOME=$HOME PATH=$PATH bash -lc ./run.sh; echo exit=$?
```

_output:_
```text
CallToolResult(content=[TextContent(type='text', text='Hello, Ford!', annotations=None, meta=None)], structured_content={'result': 'Hello, Ford!'}, meta={'fastmcp': {'wrap_result': True}, 'io.modelcontextprotocol/serverInfo': {'name': 'My MCP Server', 'version': '4.1.4'}}, data='Hello, Ford!', is_error=False)
exit=0

[exit code 0]
```

[00:13] **Agent:** I built the quickstart server with its `greet` tool and called it from a FastMCP client with the name "Ford". `/work/run.sh` ran from a clean shell and exited 0.

The tool returned `Hello, Ford!`. The client prints the whole result object, as the quickstart does, so the output looks like this:

```
CallToolResult(content=[TextContent(type='text', text='Hello, Ford!', ...)], structured_content={'result': 'Hello, Ford!'}, ..., data='Hello, Ford!', is_error=False)
```

The files are all in `/work`:
- **`my_server.py`:** the quickstart server, served over HTTP on port 8000.
- **`my_client.py`:** the quickstart client, pointed at `http://localhost:8000/mcp`.
- **`run.sh`:** creates `.venv` if it doesn't exist and installs `fastmcp==4.1.4`. It then starts the server in the background and waits for port 8000 to open. It runs the client, and stops the server when it finishes.

I skipped the quickstart's optional "Give Your Tool a UI" and deploy sections, since you only asked for the server and the client call.

[00:13] _Stopped: done, 3 turns, $0.06645809999999999_

---

_Written by an agent from the run log. Verdicts are about this agent, this version, on this date. Spot an error? [Request a correction](https://github.com/Simbastack-hq/canagentuseit/issues/new?template=correction.yml)._

_Reviewed by a human on 2026-10-30 before publishing._
