fastchat-mcp is a Python chat client, based on mcp[cli], used to connect to MCP servers through multiple protocols, designed for integrating language models. It provides a simple, intuitive, and configurable way to interact with MCP servers and use natural language for custom chats.
Purpose
This tool is designed to simplify the process of interacting with MCP (Model Context Protocol) servers, allowing users to use the tools, resources, and prompts provided by MCP servers through natural language conversation. It is suitable for developers and application scenarios that need to integrate multiple MCP servers into a chat workflow.
Main Capabilities
- Fully streaming chat: implement streaming responses by passing queries.
- MCP integration: integrate with MCP server tools, resources, and prompts to form a complete client workflow.
- Authentication system: use mcp-oauth and environment configuration to support simple authentication, and also support header authorization.
- LLM gateway: use LiteLLM as the integrated LLM gateway, supporting any model identifier supported by LiteLLM.
- Transport protocols: support httpstream and stdio transport protocols. Note: SSE (Server-Sent Events) protocol is currently not supported.
- Console usage: easily use the console through TerminalChat().open().
- Response management: control responses and MCP service selection through system prompts.
- Data persistence: establish database connections through the API defined in fastchat.config.json and integrate them into the workflow.
Usage
Installation: the MCP client can be installed using pip.
Configuration:
- You need to create a .env file in the project root directory, containing authentication credentials, such as CRIPTOGRAFY_KEY and the API keys of various LLM providers (such as OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY, etc.).
- You need to create a fastchat.config.json file in the project root directory, defining the available MCP servers and their connection methods (protocol, url, auth, etc.).
- Optional configuration: additional system prompts can be provided to modify response behavior.
Usage example:
- Create a chat instance:chat = Fastchat(model="groq/llama-3.1-70b-versatile", ...)
- The default model is "groq/openai/gpt-oss-120b".
- Model identifiers need a provider prefix, for example groq/llama-3.1-70b-versatile.
API and WebSocket integration:
- Provides API extensions, supporting WebSocket connections authenticated via JWT tokens.
- Two main endpoints: user (ACCESS TOKEN) and administrator (MASTER TOKEN).
- Supports passing additional MCP servers through the additional_servers parameter.
- Browser-compatible additional server injection: additional_servers can be sent via the first WebSocket message.
Applicable Scenarios
- Developers who need to integrate multiple MCP servers into chat applications.
- Users who want to interact with MCP servers through natural language.
- Scenarios that need to flexibly switch between different LLM providers (such as OpenAI, Anthropic, Google, Groq, etc.).
- Applications that need real-time WebSocket communication and authentication.
Limitations
- The project is under active development and may have bugs or unexpected behavior.
- The SSE protocol is currently not supported.
- The system requires Python >= 3.11.
- Future versions are planned to include a voice system, quick database integration, built-in WebSocket support, etc.
Other Information
- License: MIT License.
- LiteLLM is used by default as the runtime provider; model/provider selection is controlled by the model identifier and environment variables.
- Database connection settings are defined in fastchat.config.json.
- If you need to test an httpstream MCP server, you can use simple-mcp-server.