[BUG] The fatal message: Interrupted · What should Claude do instead?
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When sent a promt to claude code to create a MCP server and client with a function to connect to a SQL DB service to check where some clients spend more than X euros in an order. The session suddenly after try to fetch some info from Web stop with this message:
Interrupted · What should Claude do instead?
Then I send another promt like:
Continue with the loop, and the session finalixed correctly with my code created in my codebase
Version Claude Code: 2.1.227 (Claude Code)
What Should Happen?
Start and finalize the session without any message like: Interrupted · What should Claude do instead?
Error Messages/Logs
Interrupted · What should Claude do instead?
Steps to Reproduce
This is my prompt:
Build an MCP (Model Context Protocol) server and a matching test client using
FastMCP (Python, https://github.com/jlowin/fastmcp), with a tool that
connects
to a PostgreSQL database and retrieves a customer's orders above a given
amount
in euros.
PROJECT STRUCTURE:
- mcp_server.py — FastMCP server exposing the tool
- mcp_client.py — simple test client that connects to the server and calls
the tool
- .env.example — template for DB connection env vars (no real credentials)
- requirements.txt — fastmcp, asyncpg (or psycopg2-binary), python-dotenv
- README.md — setup and run instructions
DATABASE SCHEMA (assume this structure, adjust if I provide a real one
later):
- customers table: id (PK), name, email
- orders table: id (PK), customer_id (FK -> customers.id), order_date,
total_amount (numeric, in euros), status
MCP SERVER REQUIREMENTS:
- Use FastMCP's decorator-based tool definition (@mcp.tool()).
- Tool name: get_customer_orders_above_amount
- Parameters: customer_id (int) OR customer_email (str, optional
alternative
lookup), min_amount (float, euros)
- Returns: list of orders (order_id, order_date, total_amount, status)
matching customer_id/email AND total_amount >= min_amount, ordered by
order_date descending
- Use an async PostgreSQL driver (asyncpg preferred) with a connection pool
created once at server startup, not per-request.
- Read DB connection params (host, port, dbname, user, password) from
environment variables via python-dotenv — never hardcode credentials.
- Use parameterized queries only (no string formatting into SQL) to prevent
SQL injection.
- Handle and return clear errors for: customer not found, invalid amount,
DB connection failure — do not let raw exceptions/stack traces leak to
the client.
- Add a docstring to the tool function describing its purpose, parameters,
and return format, since FastMCP uses docstrings for tool discovery/schema.
- Run the server using stdio transport by default (standard for local MCP
servers), but structure the code so switching to HTTP/SSE transport later
is straightforward.
MCP CLIENT REQUIREMENTS:
- Use FastMCP's client library to connect to the server via stdio.
- Demonstrate calling get_customer_orders_above_amount with example
parameters (a sample customer_id and min_amount, e.g. 100.0).
- Print the results in a readable format (table or formatted list).
- Include basic error handling for connection failures.
ADDITIONAL NOTES:
- Follow FastMCP's current API (fastmcp v2.x) — check import paths carefully,
since fastmcp.server.FastMCP is the current pattern, not older mcp.server
patterns.
- Include type hints throughout.
- Keep the connection pool lifecycle tied to the server's lifespan/startup-
shutdown hooks if FastMCP supports that pattern, rather than opening
connections ad-hoc.
- Add a short section in README.md on how to test the tool manually via
MCP Inspector (npx @modelcontextprotocol/inspector) as well as via the
provided mcp_client.py.
Do not fabricate a database — assume it already exists with the schema above,
and just provide connection code. If you need me to run any SQL to create
sample tables/data for local testing, provide that as a separate
schema.sql / seed.sql file.
Thought for 39s (ctrl+o to expand)
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.227
Platform
Other
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_