Skip to content

v1.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 27 Feb 14:03

[1.0.0] 馃帀馃帀馃帀

Breaking Changes

Changed

  • McpToolChat constructor no longer accepts model, config, or tool_discovery_config parameters. Use from_config() or pass dependencies directly.
  • McpToolChat.chat() now requires a model parameter (string name or Model instance) at call time.
  • search_tools synthetic tool renamed to search-tools to avoid naming conflicts with FastMCP's underscore-prefixed tool conventions.
  • FastMCP upgraded from v2 to v3 (fastmcp>=3.0.0).
  • FastAPI lifespan wraps McpToolChat in async with so the API server maintains persistent MCP connections for its lifetime.
  • Examples updated to use async with pattern, replacing manual .close() calls.
  • Examples suppress harmless "Event loop is closed" RuntimeError on Python < 3.12 (subprocess transport cleanup after asyncio.run() closes the loop).

Fixed

  • MCP server connection lifecycle -- chat() now wraps its body in async with self.mcp_client:, keeping the connection alive for the entire call. Previously each list_tools() and call_tool() opened and closed a full connection cycle, restarting stdio server subprocesses on every operation.

Added

  • Tool discovery -- defer tool loading and let the LLM search for tools on demand via BM25. Mark servers with defer_loading: true and enable tool_discovery in config. The LLM receives a search-tools meta-tool to find and load deferred tools as needed.
  • SyntheticTool protocol for tools handled internally by casual-mcp (not forwarded to MCP servers). SearchToolsTool is the primary implementation.
  • BM25-based tool search index for relevance-ranked tool discovery across tool names and descriptions.
  • McpToolChat.from_config(config) classmethod that builds all dependencies (MCP client, tool cache, model factory, server names, tool discovery) from a single Config object.
  • McpToolChat async context manager -- async with McpToolChat.from_config(config) as chat: keeps MCP connections alive across multiple chat() calls, avoiding reconnection overhead between turns. Without it, each chat() call still manages its own connection automatically.
  • Call-time model selection -- pass model="gpt-4.1" or a Model instance to chat(). A single McpToolChat instance can serve multiple models.
  • Call-time system prompt override -- pass system="..." to chat() to override the default. Resolution order: explicit param > model template > constructor default.
  • Discovery statistics -- ChatStats.discovery tracks search_calls and tools_discovered when tool discovery is enabled.
  • ToolDiscoveryConfig model (enabled, defer_all, max_search_results).
  • defer_loading field on StdioServerConfig and RemoteServerConfig.
  • CLI tools command shows loaded/deferred status when discovery is enabled.
  • API /chat endpoint supports model and system_prompt fields.
  • manual_construction.py example showing direct constructor usage.

Removed

  • McpToolChat.generate() method and all session management (sessions dict, get_session(), get_session_messages(), add_messages_to_session()). Callers should use chat() directly and manage their own message history.
  • POST /generate and GET /generate/session/{session_id} API endpoints.
  • GenerateRequest API model.
  • generate_weather.py, generate_math.py, generate_session.py examples.