Unichat MCP Server is a server based on the MCP (Model Context Protocol) protocol that supports sending requests to multiple AI providers through tools or preset prompts. This project provides a Python version, and a TypeScript version is also available.
Purpose
This server is used to uniformly connect to the conversational capabilities of multiple AI providers in clients that support the MCP protocol, such as Claude Desktop. It targets OpenAI, Anthropic, and OpenAI-compatible providers. For OpenAI-compatible providers such as MistralAI, xAI, Google AI, DeepSeek, Alibaba, or Inception, you need to set the UNICHAT_BASE_URL environment variable to point to their compatible API endpoint. Before use, you need to configure the corresponding provider's API key.
Main capabilities
The server implements one tool:
- unichat: sends a request to unichat. It accepts "messages" as a required string parameter and returns a response.
In addition, the project also provides several preset prompts, including:
- code_review: reviews code for best practices, potential issues, and improvement points. Parameters: code (string, required), the code to review.
- document_code: generates documentation for code, including docstrings and comments. Parameters: code (string, required), the code to annotate.
- explain_code: explains in detail how a piece of code works. Parameters: code (string, required), the code to explain.
- code_rework: applies the requested changes to the provided code. Parameters: changes (string, optional), the changes to apply; code (string, required), the code to modify.
Usage
Configure environment variables
The server reads environment variables and does not load a .env file itself. For Claude Desktop, these values need to be kept in the server env configuration shown above.
The list of supported models can be found in the project documentation and used as "SELECTED_UNICHAT_MODEL". Make sure to add the relevant provider API key as "YOUR_UNICHAT_API_KEY".
When UNICHAT_BASE_URL, the server accepts the configured UNICHAT_MODEL without checking it against Unichat's built-in model list.
Configuration file locations
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
- Windows: %APPDATA%/Claude/claude_desktop_config.json
Installing via Smithery
Smithery can automatically install Unichat for Claude Desktop.
Clean install from source
Prerequisites: Git, Python 3.11 or newer (as declared in pyproject.toml), and uv available in PATH. Node.js/npm is only needed for the optional MCP Inspector scenario. Examples use Bash/Zsh syntax.
Clone the repository and restore the locked dependencies:
uv sync --locked creates a project-local .venv/, installs the project in editable mode, and restores dependencies from uv.lock. If the lock file needs updating, it will fail rather than silently change it. When using uv run, there is no need to activate a virtual environment or globally install Python dependencies.
Set the same environment variables as in the Claude Desktop example, replacing the placeholders with the corresponding values for your provider.
Run the local server:
This is a stdio MCP server: it needs to be connected and interacted with through Claude Desktop or the Inspector below. It will not start a web page or an interactive chat prompt. An editable install is sufficient to run it; if you also want to create source and wheel distribution packages using the configured Hatchling backend, you can run uv build.
Normal development
After editing files under src/, restart the server or reconnect in the MCP client. The editable install uses the current source. Ordinary source changes do not require deleting .venv/, reinstalling dependencies, or rebuilding distribution packages. Only run uv build again when you need updated package artifacts. After pulling changes to the dependency manifest and lock file, run uv sync --locked to make the environment match them.
ThisThe repository does not have an automated test suite or watch command configured. You can use the Inspector manual testing tools and tips below, then restart the server after changes.
Clean rebuild of an existing checkout
Stop the running server and run the relevant commands from the repository root (the directory containing pyproject.toml and uv.lock). These paths assume uv's default project-local environment: .venv/ contains the installed dependencies and the editable project, and dist/ contains the generated source/wheel archives.
This rebuilds the environment and the distribution packages. It preserves uv.lock, the source code, configuration, .env files, and user data. Other ignored names (such as build/ and wheels/) are not established outputs of this project's build workflow, nor are they cleanup targets. The global uv cache and Python installations can be reused. To run it again, keep or reapply the environment variables above and use uv run --locked unichat-mcp-server.
Intentional dependency updates
Dependency updates and restoration are separate. When intentionally changing requirements in pyproject.toml, run uv lock and review the resulting uv.lock changes, then run uv sync --locked. To intentionally upgrade existing dependencies within the declared constraints, you can, for example, run the relevant command.
Before accepting updates, review the lock file changes and check server behavior. Routine installation and rebuilds should use the existing lock file.
Releasing is a separate maintainer operation and is not part of local installation or rebuilds. Use the clean rebuild workflow above to prepare a new distribution package, and confirm that dist/ contains only the intended release contents before uploading to PyPI.
The repository also has a release workflow at .github/workflows/publish.yml, triggered by changes to pyproject.toml on the main branch or by manual dispatch.
Debugging
Because the MCP server runs over stdio, debugging can be challenging. For the best debugging experience, the MCP Inspector is strongly recommended. The MCP Inspector can be started with an npm command. Once started, the Inspector displays a URL that can be visited in a browser to begin debugging.
Hosted deployment
A hosted deployment is available on Fronteir AI.