universal-ai-connector-typescript
A TypeScript-based server implementing the Model Context Protocol (MCP) to interface uniformly with diverse large language models, including offerings from OpenAI, MistralAI, Anthropic, xAI, Google AI, and DeepSeek, facilitating broad AI interaction capabilities.
Author

amidabuddha
Quick Info
Actions
Tags
TypeScript Implementation of the Unichat MCP Endpoint
See the equivalent implementation in Python for comparison.
Access major AI providers—OpenAI, MistralAI, Anthropic, xAI, Google AI, and DeepSeek—through a unified interface utilizing the MCP specification via tool calls or structured prompts. Authorization via vendor-specific API credentials is mandatory.
Supports both Standard I/O (STDIO) and Server-Sent Events (SSE) transport modes, selectable via execution arguments.
Available Tools
This service exposes a single utility:
- unichat: Submits a query to the unified AI backend.
- Accepts a single mandatory argument: messages (string format).
- Produces a resultant response string.
Predefined Prompt Templates
code_review- Function: Analyzes supplied source code for adherence to best practices, potential flaws, and suggestions for refinement.
- Parameters:
code(string, mandatory): The source code segment under scrutiny.
document_code- Function: Automatically generates comprehensive documentation, including requisite docstrings and inline commentary, for given code.
- Parameters:
code(string, mandatory): The source code segment slated for annotation.
explain_code- Function: Provides a granular, detailed elucidation of the functionality embodied in the input code block.
- Parameters:
code(string, mandatory): The source code segment requiring explanation.
code_rework- Function: Modifies the provided codebase according to specified modification requests.
- Parameters:
changes(string, optional): Description of the desired alterations.code(string, mandatory): The initial source code to be transformed.
Development Workflow
To initialize dependencies: bash npm install
To compile the TypeScript source: bash npm run build
For continuous integration during active development (enabling auto-recompilation): bash npm run watch
Executing Evaluation Suites
The evaluation package employs an embedded MCP client to test the system by executing index.ts. Consequently, recompilation between test runs is unnecessary. Environment variables can be loaded by prefixing the execution command. Comprehensive documentation for evaluations is located here.
bash OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/server.ts
Acquisition Methods
Deployment via Smithery
Automate the integration of the Unichat MCP Server into Claude Desktop through Smithery:
bash npx -y @smithery/cli install unichat-ts-mcp-server --client claude
Manual Configuration
For direct integration with Claude Desktop, incorporate the following server configuration into the appropriate local file:
On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Local Execution Setup:
{ "mcpServers": { "unichat-ts-mcp-server": { "command": "node", "args": [ "{{/path/to}}/unichat-ts-mcp-server/build/index.js" ], "env": { "UNICHAT_MODEL": "YOUR_PREFERRED_MODEL_NAME", "UNICHAT_API_KEY": "YOUR_VENDOR_API_KEY" } } } }
Published Package Setup:
{ "mcpServers": { "unichat-ts-mcp-server": { "command": "npx", "args": [ "-y", "unichat-ts-mcp-server" ], "env": { "UNICHAT_MODEL": "YOUR_PREFERRED_MODEL_NAME", "UNICHAT_API_KEY": "YOUR_VENDOR_API_KEY" } } } }
The default operational mode is STDIO, or when the
--stdioflag is present. To activate the SSE transport mechanism, specify the--sseargument: bash npx -y unichat-ts-mcp-server --sse
Supported AI Endpoints:
Consult this reference for the complete catalog of model identifiers to substitute for
"YOUR_PREFERRED_MODEL_NAME". Ensure that the corresponding API credential is provided as"YOUR_VENDOR_API_KEY".
Configuration Example:
"env": { "UNICHAT_MODEL": "gpt-4o-mini", "UNICHAT_API_KEY": "YOUR_OPENAI_API_KEY" }
Diagnostic Assistance
Debugging communication over stdio channels in MCP servers can present difficulties. We advise utilizing the [MCP Inspector], accessible via a package script:
bash npm run inspector
The Inspector utility will furnish a browser URL to access interactive debugging instrumentation.
If connection timeouts occur specifically when using SSE mode for testing, adjust the request URL within the Inspector interface to include an extended timeout, like this: http://localhost:3001/sse?timeout=600000
WIKIPEDIA: Cloud computing, as defined by ISO, represents "a model for enabling ubiquitous, convenient, on-demand network access to a shared pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that can be rapidly provisioned and released with minimal management effort or service provider interaction." This concept is commonly shortened to "the cloud".
== Key Attributes == In 2011, the United States National Institute of Standards and Technology (NIST) delineated five core defining traits for cloud-based systems. These are quoted below from the NIST specification:
On-demand self-service: "A client entity can unilaterally procure computing capabilities, such as processing cycles and network persistence, as required automatically, without requiring intervention from the service operator." Broad network access: "The capabilities are accessible over the network, utilizing standardized protocols that facilitate usage across a wide array of client devices (e.g., mobile handsets, tablets, personal computers, and fixed workstations)." Resource pooling: " The supplier's computational assets are aggregated to service numerous clients via a multi-tenancy architecture, where underlying physical and virtual assets are dynamically allocated and reallocated based on client consumption patterns." Rapid elasticity: "Functionality can be quickly scaled up or down, sometimes autonomously, to meet sudden increases or decreases in demand. From the consumer's perspective, the available capacity often appears limitless and instantly accessible in any volume." Measured service: "Cloud platforms automatically manage and optimize resource consumption by implementing metering functions at a suitable layer of abstraction relative to the service type (e.g., data transfer volume, compute time, storage allocation, and active user accounts). This usage data allows for transparent monitoring, control, and reporting for both the service proprietor and the consuming client. By 2023, the International Organization for Standardization (ISO) had subsequently extended and refined this catalog of attributes.

