Cover image
Try Now
2025-03-22

MCP服务器用于OpenAI文本完成

3 years

Works with Finder

1

Github Watches

1

Github Forks

0

Github Stars

OpenAI 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 complete
  • max_tokens (integer, optional): Maximum tokens to generate, default: 150
  • temperature (number, optional): Controls randomness (0-1), default: 0.7
  • top_p (number, optional): Controls diversity via nucleus sampling, default: 1.0
  • frequency_penalty (number, optional): Decreases repetition of token sequences, default: 0.0
  • presence_penalty (number, optional): Increases likelihood of talking about new topics, default: 0.0

Development

For development with auto-reloading:

npm run dev

License

MIT

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

    Reviews

    4 (1)
    Avatar
    user_VGmshbtF
    2025-04-17

    I've been using mcp-openai-complete for a while now, and it has significantly enhanced my coding efficiency. The author, aiamblichus, has done a fantastic job in creating a straightforward and powerful tool. The integration with OpenAI is seamless, and the support for multiple languages ensures versatility in projects. Highly recommend checking it out on GitHub!