Skip to main content
Glama

Agent_Exchange_MCP

An MCP server that lets an AI client (Claude Code, Claude Desktop, …) talk to other AI models through their APIs. Supports Anthropic, OpenAI and xAI, with multi-turn conversations saved to disk.

Features

  • Multiple providers — Anthropic (Claude), OpenAI, xAI (Grok). Choose the provider from the client UI, and switch it per call, even mid-conversation.

  • Multi-turn conversations — history is kept per conversation_id.

  • Persistent — each conversation is a JSON file on disk and survives server restarts.

  • Simple config — API keys and models live in a .env file.

Related MCP server: Multi-CLI MCP

Installation

Requires Python 3.11+.

git clone https://github.com/cat-people-82/Agent_Exchange_MCP.git
cd Agent_Exchange_MCP
pip install -e .
cp .env.example .env    # then add your API keys

Configuration

Settings are read from .env in the project root (or the current directory, or the file named by AGENT_EXCHANGE_ENV_FILE). Real environment variables take precedence over .env. .env is git-ignored — never commit it.

Variable

Default

Purpose

AGENT_EXCHANGE_DATA_DIR

~/.local/share/agent-exchange/conversations

Where conversations are saved

ANTHROPIC_API_KEY / ANTHROPIC_MODEL

– / claude-opus-5-5

Anthropic credentials and default model

OPENAI_API_KEY / OPENAI_MODEL / OPENAI_BASE_URL

– / gpt-5 / OpenAI

OpenAI settings

AGENT_EXCHANGE_IGNORE_PROXY

off

Set true to make API calls ignore ALL_PROXY / HTTPS_PROXY / HTTP_PROXY (see Troubleshooting)

XAI_API_KEY / XAI_MODEL / XAI_BASE_URL

– / grok-4 / https://api.x.ai/v1

xAI settings

Provider selection is not configured here — it happens in the client (see below). .env only holds API keys, models and the data directory. You only need keys for the providers you use. Adjust the default OpenAI/xAI model IDs to whatever your account offers.

Register with an MCP client

Claude Code:

claude mcp add agent-exchange -- agent-exchange-mcp

Claude Desktop — edit claude_desktop_config.json (Settings → Developer → Edit Config). command must be an executable (not the path to server.py), so point it at the Python interpreter of the environment where you ran pip install -e . and run the package as a module:

{
  "mcpServers": {
    "agent-exchange": {
      "command": "/absolute/path/to/Agent_Exchange_MCP/.venv/bin/python",
      "args": ["-m", "agent_exchange_mcp"]
    }
  }
}

Tips:

  • Create the environment first: python3 -m venv .venv && .venv/bin/pip install -e . (find an existing interpreter's path with which python while its environment is active).

  • Claude Desktop doesn't inherit your shell environment; keys are read from the project's .env, or pass them via an "env": { "ANTHROPIC_API_KEY": "..." } entry.

  • Fully quit and reopen Claude Desktop after editing the config. Logs are in ~/Library/Logs/Claude/mcp-server-agent-exchange.log.

Tools

Tool

Description

chat(message, conversation_id?, provider?, model?, system?, max_tokens?, effort?)

Send a message and get the reply. Omit conversation_id to start a new conversation; pass the returned id to continue it. system applies only when starting a conversation. effort (low…max) applies to Anthropic only.

list_providers()

Configured providers, default models, and whether a key is set.

server_info()

Diagnose config: which .env files were checked/found, data dir, and which providers have a key.

list_conversations()

Saved conversations (id, turns, system prompt).

reset_conversation(conversation_id)

Delete a conversation.

chat returns {conversation_id, provider, model, reply}.

Example flow: ask Claude a question, then continue the same conversation with provider: "xai" to get Grok's take with the full history.

Choosing a provider

The provider is picked in your MCP client, not in config:

  • chat has a provider parameter (anthropic | openai | xai), which clients show as a choice list and which the calling model or you can set.

  • If it is omitted when starting a conversation and more than one provider has an API key, the server asks you to choose through the client's prompt (MCP elicitation, supported by clients such as Claude Code).

  • If the client doesn't support elicitation, or only one provider has a key, the first provider with a key is used.

  • A continued conversation keeps its last provider unless you pass a different one.

Storage

Conversations are stored as <conversation_id>.json (system prompt + message list) in the data directory. Files are plain text and contain your prompts and replies, so protect the directory accordingly. Delete a conversation with reset_conversation or by removing its file.

Troubleshooting

  • has_api_key: false — call server_info to see which .env files were checked. Sandboxed clients may not let the server read the project folder; set the keys in the client's environment-variable settings instead. Config is read at startup, so reconnect after changes.

  • Could not reach the <provider> API: Connection error — the client app may export proxy variables (ALL_PROXY, HTTPS_PROXY) that point at a proxy this process can't reach. server_info shows them under proxy_env. If the machine can reach the API directly, set AGENT_EXCHANGE_IGNORE_PROXY=true.

  • Using SOCKS proxy, but 'socksio' is not installed — reinstall (pip install -e .); socksio is a dependency.

  • SSLCertVerificationError: ('OSStatus -26276',) (macOS) — the SDK default client verifies through the OS trust store (httpx 2.x uses truststore, which calls the Security framework) and that can fail even for a valid public certificate. Both client factories therefore verify against certifi; override with AGENT_EXCHANGE_CA_BUNDLE if you sit behind a TLS-terminating proxy whose CA is not in certifi.

  • A sandboxed client may offer no direct egress. If AGENT_EXCHANGE_IGNORE_PROXY=true produces nodename nor servname provided, the proxy is the only route out — leave the flag off. Where ALL_PROXY is SOCKS but only the HTTP proxy serves, the server rewrites the catch-all to the HTTP proxy at startup and reports it as socks_fallback in server_info; disable with AGENT_EXCHANGE_SOCKS_FALLBACK=false.

Notes

  • If a provider call fails, the turn is not saved, so history stays consistent.

  • Anthropic calls use adaptive thinking and streaming; OpenAI and xAI use the Chat Completions API.

Available Tools

4 tools
chatA

Send a message to another AI model and get its reply.

Omit conversation_id to start a new conversation; pass the returned conversation_id to continue it (history is saved to disk, and you may switch provider between turns).

Args: message: The user message. conversation_id: Continue an existing conversation. provider: Provider to use. If omitted: a continued conversation keeps its last provider; a new one asks the user to choose (via the client UI when supported). model: Model ID override for this turn. system: System prompt (only applied when starting a conversation). max_tokens: Maximum tokens in the reply. effort: Thinking effort (Anthropic only; ignored by other providers).

Inputs: message (required), model, effort, system, +3 more.

list_conversationsA

List active conversations (id, turn count, system prompt).

Inputs: no named parameters. Returns: result

list_providersA

List configured providers, their default models, and whether an API key is set.

Inputs: no named parameters. Returns: result

reset_conversationC

Delete a conversation and its history.

Inputs: conversation_id (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 4 tools

    Disambiguation5/5

    chat is the sole action tool, while list_providers, list_conversations, and reset_conversation are clearly scoped to different resources. There is no meaningful overlap between messaging and conversation/provider management.

    Naming Consistency4/5

    Three tools follow a clear verb_noun pattern (list_providers, list_conversations, reset_conversation), but chat is a single-word noun/verb that breaks the pattern slightly. The set remains readable and predictable overall.

    Tool Count5/5

    Four tools cleanly cover the server's narrow scope: sending messages, discovering providers, inspecting conversations, and deleting a conversation. No tool feels redundant, and the set is not bloated.

    Completeness4/5

    Core conversation lifecycle is covered (start/continue/delete/list) and providers can be listed. However, there is no get_conversation or history-retrieval tool, and provider/model management is read-only, leaving minor gaps.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      An MCP server that functions as an intelligent gateway for multiple LLM backends including OpenAI, Claude, and Ollama. It supports automatic provider fallback, streaming responses via Server-Sent Events, and real-time monitoring for robust AI integration.
      MIT
    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      An MCP server that enables multiple AI models (Claude, ChatGPT, Gemini) to share and persist context via a local-first vault of markdown files and SQLite index, allowing seamless cross-AI memory.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A production-ready MCP server for persistent AI memory across LLMs like Claude and ChatGPT. Provides automatic conversation backup, multi-user support, and multi-storage (PostgreSQL, Redis, Qdrant).
      11 npm
      14
      MIT