Fastchat Mcp — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited Fastchat Mcp (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
alt text
<div align = center>
</div>
Python chat client, based on [mcp[cli]](https://github.com/modelcontextprotocol/python-sdk), for connecting to MCP servers through multiple protocols, specifically designed to work with integrated language models. Fastchat-mcp is a very simple way to interact with MCP servers using custom chats through natural language.
This package provides a Python interface to connect to MCP servers in an easy, intuitive, and configurable way. It features a modular architecture that allows for the seamless addition of new transfer protocols and language models (LLM) providers. Currently, it supports the HTTPStream and Stdio transport protocols and uses LiteLLM as the LLM gateway, enabling model usage across multiple providers.
To install the MCP client, you can use pip:
pip install fastchat-mcpThe client currently supports the following language model gateway:
| Provider | Status | Technical Description |
|---|---|---|
| LiteLLM | Implemented | LiteLLM provides a unified interface for multiple LLM providers, allowing you to use models from OpenAI, Anthropic, Google, Azure, Bedrock, Groq, and others through a common API. |
>🚨 CONFIGURATION NOTE The runtime provider is LiteLLM, and model/provider selection is controlled by the model identifier and environment variables.
Default Provider (`LiteLLM`): LiteLLM acts as a unified adapter to route requests to many LLM vendors while preserving a consistent interface in Fastchat.
This project can use any model supported by LiteLLM, providing flexibility to choose the model that best fits your specific needs. To explore providers and model naming conventions, consult the official LiteLLM provider documentation.
To select a model, you should create a chat instance like this:
from fastchat import Fastchat
chat = Fastchat(model="my-model-id", ...)#### Supported Model Examples
The following table contains examples of model identifiers that can be passed to the core. Each model must be prefixed with its provider identifier:
| Provider | Model Examples | Use Case |
|---|---|---|
| OpenAI | gpt-4o, gpt-4-turbo, gpt-5-nano | General purpose, advanced reasoning |
| Anthropic | anthropic/claude-3-7-sonnet, anthropic/claude-3-opus | Enterprise, complex reasoning |
gemini/gemini-2.5-pro, gemini/gemini-2-flash-preview, gemini/gemini-3-flash-preview | Multimodal, versatile | |
| Groq | groq/llama-3.1-8b-instant, groq/llama-3.1-70b-versatile, groq/meta-llama/llama-4-scout-17b-16e-instruct | Fast inference, cost-effective |
| Mistral | mistral/mistral-large, mistral/mistral-tiny | Efficient, multilingual |
| Meta (Llama) | ollama/llama2, ollama/mistral | Self-hosted, local inference |
| Azure | azure/gpt-4-deployment, azure/<your-deployment-name> | Enterprise, Azure integration |
| AWS Bedrock | bedrock/anthropic.claude-3-sonnet, bedrock/meta.llama2-13b | AWS ecosystem |
Usage Examples:
from fastchat import Fastchat
# OpenAI models (requires OPENAI_API_KEY)
chat = Fastchat(model="gpt-4o", ...)
# Groq models (requires GROQ_API_KEY)
chat = Fastchat(model="groq/llama-3.1-70b-versatile", ...)
# Google Gemini models (requires GEMINI_API_KEY)
chat = Fastchat(model="gemini/gemini-2-flash-preview", ...)
# Anthropic Claude models (requires ANTHROPIC_API_KEY)
chat = Fastchat(model="anthropic/claude-3-7-sonnet", ...)
# Mistral models (requires MISTRAL_API_KEY)
chat = Fastchat(model="mistral/mistral-large", ...)Default Model (`"groq/openai/gpt-oss-120b"`): The 120B open-source model is a powerful, cost-effective option that provides excellent performance and reasoning capabilities. Served through Groq's fast inference platform, it delivers low-latency responses ideal for production applications. This model combines the strength of a large parameter count with competitive pricing and speed, making it suitable for complex tasks, code generation, and detailed analysis while maintaining cost efficiency.
Protocols for communication with MCP servers:
| Protocol | Status | Technical Characteristics |
|---|---|---|
| stdio | Implemented | Standard input/output interface that facilitates direct communication between processes. |
| HTTPStream | Implemented | Asynchronous HTTP-based protocol that enables continuous data streaming. |
| SSE (Server-Sent Events) | Not Implemented | Unidirectional protocol that allows the server to send multiple updated events through a single HTTP connection. |
>🚨 CRITICAL CONFIGURATION NOTE Currently, this project don't work with SSE (Server-Sent Events) protocol.
.env file contains the authentication credentials necessary for integration with external services. This file must be created in the project root directory with the following format:#### Basic Configuration
# .env
# Cryptography key for token data storage (OAuth2)
CRIPTOGRAFY_KEY=<any-cryptography-key>#### LLM Provider API Keys
The following environment variables configure authentication with different LLM providers. Add only the keys for the providers you plan to use:
# OpenAI
OPENAI_API_KEY=<your-openai-api-key>
# Anthropic (Claude)
ANTHROPIC_API_KEY=<your-anthropic-api-key>
# Google (Gemini)
GEMINI_API_KEY=<your-google-api-key>
# Groq
GROQ_API_KEY=<your-groq-api-key>
# Mistral
MISTRAL_API_KEY=<your-mistral-api-key>
# Azure OpenAI
AZURE_API_KEY=<your-azure-api-key>
AZURE_API_BASE=<your-azure-endpoint>
AZURE_API_VERSION=<your-azure-api-version>
# AWS Bedrock (requires AWS credentials)
AWS_ACCESS_KEY_ID=<your-aws-access-key>
AWS_SECRET_ACCESS_KEY=<your-aws-secret-key>
AWS_REGION_NAME=<your-aws-region>
# Local/Ollama models (if using local inference)
OLLAMA_BASE_URL=http://localhost:11434#### LiteLLM Configuration (Optional)
# Set a default routing API key (optional)
LITELLM_API_KEY=<your-default-provider-key>
# Set a custom base URL (for OpenAI-compatible APIs)
LITELLM_BASE_URL=<optional-openai-compatible-base-url>#### How to Add API Keys
.env file in the project root directory (same level as fastchat.config.json): touch .env # Example: Using Groq
GROQ_API_KEY=gsk_your_actual_groq_api_key_here
# Example: Using Google Gemini
GEMINI_API_KEY=your_actual_gemini_api_key_here from fastchat import Fastchat
# This will use the GROQ_API_KEY from .env
chat = Fastchat(model="groq/llama-3.1-70b-versatile", ...).env file to version control. Add it to your .gitignore: echo ".env" >> .gitignorefastchat.config.json file defines the configuration of available MCP servers. It must be created in the project root directory with this structurePython = ">=3.11"litellmmcp[cli]mcp-oauthfastchat.config.jsonThis file defines the configuration of available MCP servers (Model Context Protocol) in the project. It must be placed in the root directory of the repository. Its main purpose is to inform the application which servers can be used and how to connect to them.
The file is JSON formatted and follows this main structure:
{
"app_name": "fastchat-mcp",
"mcp_servers": {
"..."
}
}Each MCP server inside "mcp_servers" has a custom configuration with these common properties:
"example_public_server", "github", etc.): internal name identifying this server."httpstream": Communication via HTTP streaming."stdio": Communication based on standard input/output (local command execution).#### 1. Public HTTP Stream Server
"example_public_server": {
"protocol": "httpstream",
"httpstream-url": "http://127.0.0.1:8000/public-example-server/mcp",
"name": "example-public-server",
"description": "Example public server."
}"name" and "description" provide descriptive labels for users.#### 2. Private HTTP Stream Server with Authentication
"example_private_mcp": {
"protocol": "httpstream",
"httpstream-url": "http://127.0.0.1:8000/private-example-server/mcp",
"name": "example-private-server",
"description": "Example private server with oauth required.",
"auth": {
"required": true,
"post_body": {
"username": "user",
"password": "password"
}
}
}"auth" object on top of basic config:true indicates authentication is needed.#### 3. GitHub Server with Authentication Headers
"github": {
"protocol": "httpstream",
"httpstream-url": "https://api.githubcopilot.com/mcp",
"name": "github",
"description": "This server specializes in github operations.",
"headers": {
"Authorization": "Bearer {your-github-access-token}"
}
}"Authorization" for token-based authentication.#### 4. Local Server using STDIO protocol
"my-stdio-server": {
"protocol": "stdio",
"name": "my-stdio-server",
"config": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/example-stdio-server"
]
}
}"config" specifies the command and arguments to run the MCP server. This key value(or body) has the same Claude Desktop sintaxis.Database connection settings are defined in the fastchat.config.file. If the connection is established successfully, the conversation flow will automatically handle sending and retrieving data from the specified endpoints.
{
"...": "...",
"db_conection": {
"root_path": "http://127.0.0.1:6543/fastchatdb",
"headers": {
"example_autorization_token": "<your_token_here>",
"other_header": "value",
"...": "..."
},
"base_body": {
"company_id": "<your_company_id>",
"example_body_param": "<your_value_here>",
"other_body_param": "value",
"...": "..."
},
"base_query": {
"company_id": "<your_company_id>",
"example_query_param": "<your_value_here>",
"other_query_param": "value",
"...": "..."
},
"endpoints": {
"save_message": {
"path": "/message/save"
},
"load_history": {
"path": "/history/load"
}
}
}
}⚠️ Place this file in the project root so the application can detect it automatically.
> >💡 If you need an httpstream MCP server to test the code, you can use simple-mcp-server. >
✍️ If you need help configuring a specific server or using this configuration in your code, feel free to open discussion for help!
As an advanced configuration, system prompts can be supplied to modify the behavior of responses. Prompts should be provided as lists; multiple system prompts can be supplied.
#### Args
extra_reponse_system_prompts: List of string prompts used as additional system prompts in the final responses.extra_selection_system_prompts: List of string prompts used as additional system prompts for the resource/service selection step exposed by connected MCP servers.Example:
chat = Fastchat(
extra_reponse_system_prompts=[
"You are an NPC street vendor for an RPG game. You must behave as such and respond according to your character. You specialize in selling medieval weaponry, such as swords, armor, shields, and more. Address anyone who speaks to you as if they were an adventurer in a medieval fantasy world."
]
)In addition to the servers defined in the configuration file, you can pass extra MCP servers via parameters. These are provided as a dictionary with the same structure as the configuration file, under the key "mcp-servers".
#### Args
additional_servers: Additional servers to be supplied to the Fastchat component, following the same format as the configuration file, for example:my_servers = {
"github": {
"protocol": "httpstream",
"httpstream-url": "https://api.githubcopilot.com/mcp",
"name": "github",
"description": "This server specializes in github operations.",
"headers": {
"Authorization": "Bearer {your-github-token}"
}
},
"other_server": {"...": "..."}
}
chat = Fastchat(additional_servers=my_servers)Note: Servers defined in the .config file are concatenated with those passed as parameters; it is compatible to use both methods to add MCP servers.API: The websocket exposed by the API supports additional servers passed through the additional_servers parameter.Some browser WebSocket clients do not allow custom headers. For this scenario, the API now supports sending additional servers in the first WebSocket message.
How it works:
aditional_servers from headers (if available).Supported payload formats for the first message:
__fastchat_additional_servers__:{"my_server":{"protocol":"httpstream","httpstream-url":"http://127.0.0.1:9000/mcp","name":"my_server","description":"My browser-injected server"}}{
"type": "additional_servers",
"data": {
"my_server": {
"protocol": "httpstream",
"httpstream-url": "http://127.0.0.1:9000/mcp",
"name": "my_server",
"description": "My browser-injected server"
}
}
}Typical browser flow:
/chat/user or /chat/admin) with URL query params.--eof.Fastchat MCP provides an API extension with support for WebSocket connections secured via JWT token-based authentication. It offers two primary real-time messaging endpoints: one for users authenticated by an ACCESS TOKEN, and another for administrators requiring a MASTER TOKEN.
This system ensures continuous token validation on every connection, enabling a message flow that combines plain text with segmented JSON streams to efficiently and securely handle fragmented responses.
Configuration centralizes sensitive keys and external service endpoints through JSON configuration files or environment variables, seamlessly integrating with the FastAPI architecture and facilitating token persistence via a configurable REST backend.
{
"...": "...",
"auth_middleware": {
"database_api_path": "http://127.0.0.1:6789/mydb/data",
"headers": {
"header_key": "header_value",
"other_header": "header_value",
"...": "..."
}
}
}#example1.py
from fastchat import TerminalChat
chat = TerminalChat()
chat.open()<https://github.com/user-attachments/assets/1fcb0db8-5798-4745-8711-4b93198e36cc>
#example2.py
from fastchat import Fastchat
import asyncio
async def chating():
chat: Fastchat = Fastchat()
await chat.initialize()
while True:
query = input("> ")
if query == "":
break
async for step in chat(query):
print(f"<< {step.json}")
asyncio.run(chating()) <!-- Alternatively, you may test this service using the following template available on GitHub:
# clone repo
git clone https://github.com/rb58853/template-fastchat-mcp.git
# change to project dir
cd template-fastchat-mcp
# install dependencies
pip install -r requirements.txt
# open in vscode
code .Fastchat.Tools, Resources, and Prompts from MCP servers, achieving a well-integrated client workflow with each of these services. Check flowTerminalChat().open(); see example1 for the use case.fastchat.config.json. see more> >⚠️ Important Notice: This project is currently in active development phase. As a result, errors or unexpected behaviors may occur during usage. >
Future versions are expected to include additional features such as voice systems, quick integrations with databases, built-in websocket support for frontend connections, among other useful functionalities. We invite you to follow this repository (watch) to stay updated on the latest news and improvements implemented.
MIT License. See license
<div align = center>
#### If you find this project helpful, please don’t forget to ⭐ star the repository
</div>
<!-- or buy me a ☕ coffee.** -->
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.