About OpenAI Complete MCP Server
OpenAI Complete MCP Server connects MCP clients to OpenAI-compatible text completion APIs, primarily for base models. It offers a single completion tool, without chat completion support.
Key features
- 01Single `complete` tool
- 02OpenAI-compatible API support
- 03Async request handling
- 04Timeout fallbacks
- 05Request cancellation
Use cases
- 01Generating text with a base model
- 02Setting completion limits and sampling parameters
- 03Cancelling an ongoing completion
MCP support
Exposes a `complete` tool to MCP clients over stdio. The tool accepts a prompt and optional generation parameters.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEOpenAI Complete MCP Server
An MCP (Model Context Protocol) server that provides a clean interface for LLMs to use text completion capabilities through the MCP protocol. This server acts as a bridge between an LLM client and any OpenAI's compatible API. The primary use case is for base models, as the server does not provide support for chat completions.
Features
- Provides a single tool named "complete" for generating text completions
- Properly handles asynchronous processing to avoid blocking
- Implements timeout handling with graceful fallbacks
- Supports cancellation of ongoing requests
Installation
# Clone the repository
git clone <repository-url>
cd mcp-openai-complete
# Install dependencies
pnpm install
# Build the project
pnpm run build
Configuration
The following environment variables are required:
OPENAI_API_KEY=your-hyperbolic-api-key
OPENAI_API_BASE=https://api.hyperbolic.xyz/v1
OPENAI_MODEL=meta-llama/Meta-Llama-3.1-405B
Usage
Start the server:
pnpm start
This will start the server on stdio, making it available for MCP clients to communicate with.
Docker Usage
Building the Docker Image
docker build -t mcp-openai-complete .
Running the Container
# Run with environment variables
docker run -it --rm \
-e OPENAI_API_KEY="your-api-key" \
-e OPENAI_MODEL="gpt-3.5-turbo-instruct" \
mcp-openai-complete
You can also use a .env file:
# Run with .env file
docker run -it --rm \
--env-file .env \
mcp-openai-complete
Parameters for the "complete" tool
prompt(string, required): The text prompt to completemax_tokens(integer, optional): Maximum tokens to generate, default: 150temperature(number, optional): Controls randomness (0-1), default: 0.7top_p(number, optional): Controls diversity via nucleus sampling, default: 1.0frequency_penalty(number, optional): Decreases repetition of token sequences, default: 0.0presence_penalty(number, optional): Increases likelihood of talking about new topics, default: 0.0
Development
For development with auto-reloading:
npm run dev
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.