MCP Chat Adapter

by aiamblichus

336 downloads
Not rated
GitHub

About

MCP server for using OpenAI compatible chat endpoints

Details

Author
aiamblichus
Downloads
336
Categories
AI

- Built with FastMCP for a robust, clean implementation.
- Provides tools for conversation management and chat completion.
- Supports conversation persistence with local file storage.
- Compatible with OpenAI and any OpenAI‑compatible API.
- Configurable model, system prompt, and generation parameters.
- Proper error handling and timeouts.

Install via npm and configure environment variables (OPENAI_API_KEY, OPENAI_API_BASE, CONVERSATION_DIR) in your MCP client’s mcp.json file. The server exposes tools for creating conversations, chatting, listing, getting, and deleting conversations. Conversations are stored locally in the directory specified by CONVERSATION_DIR.

MCP Chat Adapter

An MCP (Model Context Protocol) server that provides a clean interface for LLMs to use chat completion capabilities through the MCP protocol. This server acts as a bridge between an LLM client and any OpenAI-compatible API. The primary use case is for chat models, as the server does not provide support for text completions.

Overview

The OpenAI Chat MCP Server implements the Model Context Protocol (MCP), allowing language models to interact with OpenAI's chat completion API in a standardized way. It enables seamless conversations between users and language models while handling the complexities of API interactions, conversation management, and state persistence.

Features

- Built with FastMCP for robust and clean implementation
- Provides tools for conversation management and chat completion
- Proper error handling and timeouts
- Supports conversation persistence with local storage
- Easy setup with minimal configuration
- Configurable model parameters and defaults
- Compatible with OpenAI and OpenAI-compatible APIs

Typical Workflow

The idea is that you can have Claude spin off and maintain multiple conversations with other models in the background. All conversations are stored in the CONVERSATION_DIR directory, which you should set in the env section of your mcp.json file.

It is possible to tell Claude either to create a new conversation, or to continue an existing one (identified by the integer conversation_id). You can continue with the old conversation even if you are starting fresh in a new context, although in that case you may want to tell Claude to read the old conversation before continuing using the get_conversation tool.

Note that you can also edit the conversations in the CONVERSATION_DIR directory manually. In this case, you may need to restart the server to see the changes.

Configuration

Required Environment Variables

These environment variables must be set for the server to function:

OPENAI_API_KEY=your-api-key  # Your API key for OpenAI or compatible service
OPENAI_API_BASE=https://openrouter.ai/api/v1 # The base URL for the API (can be changed for compatible services)

You should also set the CONVERSATION_DIR environment variable to the directory where you want to store the conversation data. Use an absolute path.

Optional Environment Variables

The following environment variables are optional and have default values:

```sh

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.