🐍/📇 ☁️ - Send requests to OpenAI, Mistral AI, Anthropic, xAI, Google AI or DeepSeek via a tool or predefined…
Unichat MCP Server in Python
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Also available in TypeScript
--
Send requests to OpenAI, Anthropic, and OpenAI-compatible providers using MCP protocol via tool or predefined prompts. For OpenAI-compatible providers such as MistralAI, xAI, Google AI, DeepSeek, Alibaba, or Inception, set UNICHAT_BASE_URL to the provider's compatible API endpoint.
Vendor API key required
Tools
The server implements one tool:
- unichat: Send a request to unichat
- Takes "messages" as required string arguments
- Returns a response
Prompts
- code_review
- Review code for best practices, potential issues, and improvements
- Arguments:
- code (string, required): The code to review"
- document_code
- Generate documentation for code including docstrings and comments
- Arguments:
- code (string, required): The code to comment"
- explain_code
- Explain how a piece of code works in detail
- Arguments:
- code (string, required): The code to explain"
- code_rework
- Apply requested changes to the provided code
- Arguments:
- changes (string, optional): The changes to apply"
- code (string, required): The code to rework"
Quickstart
Install
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
**Supported Models:**
> A list of currently supported models to be used as "SELECTED_UNICHAT_MODEL" may be found here. Please make sure to add the relevant vendor API key as "YOUR_UNICHAT_API_KEY"
**Example:**
For OpenAI-compatible providers with custom endpoints:
When UNICHAT_BASE_URL is set, the server accepts the configured UNICHAT_MODEL without checking it against Unichat's built-in model list.
Development/Unpublished Servers Configuration
Published Servers Configuration
Installing via Smithery
To install Unichat for Claude Desktop automatically via Smithery:
Development
Clean installation from source
Prerequisites: Git, Python 3.11 or newer (as declared in pyproject.toml), and uv available on your PATH. Node.js/npm is only needed for the optional MCP Inspector below. The shell examples use Bash/Zsh syntax.
Clone the repository and restore its locked dependencies:
uv sync --locked creates the project-local .venv/, installs the project in editable mode and restores dependencies from uv.lock. It fails if the lockfile needs updating instead of silently changing it. No virtual-environment activation or global Python dependency installation is required when using uv run.
Set the same environment variables used in the Claude Desktop examples, replacing the placeholders with your provider's values:
The server reads environment variables; it does not load .env files itself. For Claude Desktop, keep these values in the server's env configuration shown above.
Run the local server:
This is a stdio MCP server: connect through Claude Desktop or the Inspector below to interact with it. It does not start a web page or an interactive chat prompt. The editable installation is sufficient to run it; to also create source and wheel distributions using the configured Hatchling backend:
Packages are written to dist/. uv build supplies the build backend in an isolated environment; a globally installed build frontend is unnecessary. Runtime dependencies are locked by uv.lock, but the hatchling build requirement is not version-pinned in pyproject.toml.