home / mcp / swiftopenai mcp server

SwiftOpenAI MCP Server

The MCP for SwiftOpenAI

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "jamesrochabrun-swiftopenaimcp": {
      "command": "npx",
      "args": [
        "-y",
        "swiftopenai-mcp"
      ],
      "env": {
        "API_KEY": "YOUR_API_KEY",
        "API_BASE_URL": "https://api.openai.com/v1"
      }
    }
  }
}

This MCP server provides access to OpenAI-compatible APIs through a unified interface, enabling any MCP-capable client to converse with GPT models, generate images, create embeddings, and list available models across multiple providers. It is designed for high performance and reliable operation in production environments.

How to use

Install the MCP server on a system you control and point your MCP client to the local runtime. Use the default OpenAI-compatible endpoint to chat with models, generate images, and create embeddings through a single, centralized server.

Typical usage patterns include setting up a local stdio-based server for rapid development, then configuring your MCP client to connect through the provided command and arguments. You can direct conversations to GPT-family models, trigger image generation via DALL-E-compatible endpoints, and request embeddings for semantic search. The server also exposes a model list endpoint so you can discover available options from your chosen provider.

How to install

npm install -g swiftopenai-mcp

Prerequisites: Node.js 16 or higher must be installed on your system.

Verify installation and run the MCP server: use the provided stdio configuration command and arguments.

Additional setup and configuration

Create an MCP config that uses the swiftopenai-mcp package via the command line. The default OpenAI-compatible server is started using npx to load the swiftopenai-mcp runtime and passes your API key.

{
  "mcpServers": {
    "swiftopenai": {
      "command": "npx",
      "args": ["-y", "swiftopenai-mcp"],
      "env": {
        "API_KEY": "sk-..."
      }
    }
  }
}

Security and best practices

Never expose your API key in public or shared environments. Use environment variables to pass secrets and rotate keys on a regular basis. When running the server locally, ensure that access is restricted to trusted clients and networks.

Troubleshooting

If the server does not start, verify that the API key is correctly set in the configuration and that you have network access to the OpenAI-compatible endpoint. Restart your MCP client after configuring changes.

Review logs from your MCP client to identify issues. For example, check that the command and arguments are being passed correctly and that the environment variable API_KEY is visible to the running process.

Available tools

chat_completion

Send messages to OpenAI-like models and receive responses for conversations.

image_generation

Generate images using AI models with text prompts.

list_models

Retrieve and list available models from the connected provider.

create_embedding

Create embeddings for text inputs to enable semantic search and similarity tasks.