AN

Any Chat Completions MCP Server for Claude

Integrate Claude with any OpenAI SDK-compatible chat completion API using the MCP server for OpenAI, Perplexity, Groq, xAI, PyroPrompts and more.

Quick Install
npx -y @pyroprompts/any-chat-completions-mcp

Overview

Any Chat Completions MCP Server is a TypeScript implementation of a Model Context Protocol (MCP) server that lets Claude (and other MCP-aware clients) forward chat requests to any OpenAI SDK–compatible chat completions API. It acts as a small bridge between Claude Desktop/LibreChat and providers that implement the OpenAI-style chat completions endpoint — for example OpenAI, Perplexity, Groq, xAI, PyroPrompts, and similar services.

You run the MCP server as a stdio service that exposes a single tool which relays a user prompt to the configured AI chat provider. This makes it straightforward to add multiple third‑party chat LLMs to Claude’s tool list, test different models, or use internal OpenAI-compatible endpoints without changing the client.

Features

  • Implements the Model Context Protocol for Claude and other MCP clients
  • Compatible with any OpenAI SDK–style chat completions API via configurable base URL and model name
  • Single, simple tool: chat (for relaying prompts)
  • Lightweight TypeScript codebase — easy to build and run via npx or node
  • Works with Claude Desktop and LibreChat (stdio MCP servers)
  • Development helpers: fast rebuild (watch) and MCP Inspector for debugging

Installation / Configuration

Prerequisites: Node.js and npm.

Install dependencies and build:

npm install
npm run build
# For development with auto-rebuild:
npm run watch

Common environment variables (required to configure each provider):

AI_CHAT_KEY       # API key for the target provider
AI_CHAT_NAME      # Human-friendly provider name shown in Claude
AI_CHAT_MODEL     # Model identifier to use (e.g. "gpt-4o", "ash", "sonar")
AI_CHAT_BASE_URL  # Base URL for the provider's OpenAI-compatible API

Quick examples — add to Claude Desktop config using npx:

{
  "mcpServers": {
    "chat-openai": {
      "command": "npx",
      "args": ["@pyroprompts/any-chat-completions-mcp"],
      "env": {
        "AI_CHAT_KEY": "OPENAI_KEY",
        "AI_CHAT_NAME": "OpenAI",
        "AI_CHAT_MODEL": "gpt-4o",
        "AI_CHAT_BASE_URL": "https://api.openai.com/v1"
      }
    }
  }
}

Or run a cloned and built copy with node:

{
  "mcpServers": {
    "chat-perplexity": {
      "command": "node",
      "args": ["/path/to/any-chat-completions-mcp/build/index.js"],
      "env": {
        "AI_CHAT_KEY": "PERPLEXITY_KEY",
        "AI_CHAT_NAME": "Perplexity",
        "AI_CHAT_MODEL": "sonar",
        "AI_CHAT_BASE_URL": "https://api.perplexity.ai"
      }
    }
  }
}

You can register multiple providers by adding multiple MCP server entries that point to the same binary but set different env values.

LibreChat example (YAML):

chat-perplexity:
  type: stdio
  command: npx
  args:
    - -y
    - @pyroprompts/any-chat-completions-mcp
  env:
    AI_CHAT_KEY: "pplx-012345679"
    AI_CHAT_NAME: Perplexity
    AI_CHAT_MODEL: sonar
    AI_CHAT_BASE_URL: "https://api.perplexity.ai"
    PATH: '/usr/local/bin:/usr/bin:/bin'

Available Tools / Resources

  • Tool: chat
    • Purpose: Relay a single prompt (with optional context) to the configured OpenAI-compatible chat API and return the model’s completion to the MCP client.
    • Behavior: Accepts messages in the standard chat completion format and issues a corresponding request to the provider using AI_CHAT_* configuration.

Environment variables reference:

VariablePurpose
AI_CHAT_KEYAPI key used for Authorization with the target provider
AI_CHAT_NAMEDisplay name for the provider/tool shown in Claude
AI_CHAT_MODELModel identifier to request from the provider
AI_CHAT_BASE_URLBase URL for the provider’s OpenAI-compatible API

Development and debugging resources:

  • npm script: npm run inspector — runs the MCP Inspector for tracing stdio MCP messages
  • npm run watch — auto-rebuilds during development

Use Cases

  • Add OpenAI-compatible LLMs as tools inside Claude Desktop to compare outputs from different vendors without changing your workflow.
  • Route Claude prompts to private or internal LLM endpoints that expose an OpenAI-compatible chat completions API.
  • Rapidly prototype how a given model responds to prompts in a Claude-like UI for evaluation or product demos.
  • Provide fallback model options in Claude workflows (e.g., try an in-house model then fall back to commercial provider).
  • Integrate with chat frontends like LibreChat to surface third-party models in a consistent, MCP-driven way.

Debugging & Tips

  • Because MCP servers communicate over stdio, use the MCP Inspector (npm run inspector) to inspect messages and responses in a browser.
  • When adding multiple providers, ensure each MCP entry has unique keys and names so they appear separately in the client UI.
  • Verify the provider supports the OpenAI-style chat completion format; the server assumes an OpenAI-compatible schema for requests and responses.

Acknowledgements: built to implement the Model Context Protocol (MCP) spec and integrate with Claude Desktop and other MCP clients.