ai-mcp-server

ai-mcp-server

A local MCP bridge that registers multiple AI API endpoints, enabling agents to automatically discover and route to models based on capabilities like chat, vision, reasoning, embedding, image generation, TTS, STT, and rerank.

Category
访问服务器

README

ai-mcp-server

Languages: English | 繁體中文 | 简体中文

Local MCP bridge: register multiple (api_key, base_url) pairs once, and let your Agent automatically discover and route to any model with the right capability (chat, vision, reasoning, embedding, image_gen, tts, stt, rerank).

Three entry points:

  • ai-mcp — CLI (manage endpoints, query models, trigger probes, init wizard)
  • ai-mcp-server — MCP stdio server, launched by Claude Desktop / Cursor / Cline / Trae
  • ai-mcp ui — local Web management dashboard (FastAPI + Jinja2, bound to 127.0.0.1)

Install

Option 1: uv (recommended)

uv tool install ai-mcp-server

Option 2: Homebrew

brew install brianMacao/tap/ai-mcp-server

Option 3: npm / npx

npx ai-mcp-server      # auto-installs uv + Python package

Option 4: pip

pip install ai-mcp-server

Quickstart

# Interactive first-run wizard
ai-mcp init

# Or step by step:
ai-mcp endpoint add --name openrouter --base-url https://openrouter.ai/api/v1 --key sk-...
ai-mcp endpoint probe openrouter
ai-mcp model list --capability vision

# Start the Web UI
ai-mcp ui
# → http://127.0.0.1:8765/

# Start the MCP server (for Claude Desktop, Cursor, etc.)
ai-mcp-server

MCP Tools

ai-mcp-server exposes 6 MCP tools:

  • usage_guide — dynamic inventory, capability distribution, and routing guidance.
  • list_models — filter models by capability, context length, endpoint, and probe state.
  • invoke_model — pass through chat / embedding / image_gen / tts / stt / rerank calls; TTS audio is returned as audio_base64 inside the JSON body.
  • model_performance — inspect recent per-model call counts, success rate, and latency.
  • refresh_endpoint — refresh model lists and enqueue asynchronous capability probes.
  • add_models — manually register models for endpoints without /v1/models, or let an Agent register user-confirmed model features.

Model Feature Registration

Capabilities use canonical names such as text_chat, vision, audio_tts, audio_stt, embedding, and rerank. Common aliases including tts, stt, and asr are accepted by manual registration flows and normalized internally.

Static recognition includes these known model ids:

  • seed-tts-2.0audio_tts
  • volc.seedasr.sauc.durationaudio_stt

Register model features from the CLI:

ai-mcp model add --endpoint volc seed-tts-2.0 --capability audio_tts
ai-mcp model add --endpoint volc volc.seedasr.sauc.duration --features asr=true
ai-mcp model add --endpoint volc custom-model --features text_chat=true,context_length=32000
ai-mcp model override volc custom-model --capability vision=false

Register features from the Web UI:

ai-mcp ui
# Open http://127.0.0.1:8765/
# Use Models -> manual add, or Overrides -> add/update feature override.

Register features from an MCP client / Agent:

  1. Call usage_guide.
  2. Use add_models with capabilities for true capability flags.
  3. Use feature_overrides for explicit boolean or context-length overrides.

Example MCP arguments:

{
  "endpoint": "volc",
  "model_ids": ["seed-tts-2.0"],
  "feature_overrides": {
    "audio_tts": true,
    "context_length": 32000
  }
}

Claude Desktop / Trae / Codex Configuration

ai-mcp init will auto-detect installed MCP clients and configure them.

Manual configuration

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "ai-mcp": {
      "command": "uv",
      "args": ["run", "--from", "ai-mcp-server", "ai-mcp-server"]
    }
  }
}

Trae / Trae CN (project root .mcp.json):

{
  "mcpServers": {
    "ai-mcp": {
      "command": "uv",
      "args": ["run", "--from", "ai-mcp-server", "ai-mcp-server"],
      "transport": "stdio"
    }
  }
}

Codex Desktop (~/.codex/config.toml):

[mcp_servers.ai-mcp]
command = "uv"
args = ["run", "--from", "ai-mcp-server", "ai-mcp-server"]

Environment Variables

Variable Purpose Default
AI_MCP_CONFIG_DIR Override data/config directory ~/.ai-mcp-server
AI_MCP_DB_PATH SQLite database path $AI_MCP_CONFIG_DIR/db.sqlite3
AI_MCP_MASTER_KEY Fernet master key for api_key encryption auto-generated → system keyring
AI_MCP_UI_TOKEN Access token for Web UI when exposed (--expose) none

Development

# Clone and set up
git clone https://github.com/brianMacao/ai-mcp-server
cd ai-mcp-server
uv sync

# Run tests
uv run pytest -q

# Verify against real endpoint
cp .keys.example .keys   # edit with your keys
source .keys
export AI_MCP_CONFIG_DIR="$(pwd)/.data"
export AI_MCP_MASTER_KEY="$(cat .data/.master_key)"  # first run generates this
uv run ai-mcp endpoint add --name test --base-url "$EXAMPLE_URL" --key "$EXAMPLE_API_KEY"
uv run ai-mcp endpoint probe test --capability text_chat -y

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选