Smart MCP Proxyのロゴ

Smart MCP Proxy

コミュニティ
Dumbris

To use mcpproxy in Cursor IDE, add this configuration to your ~/.cursor/mcp.json:

公開者Dumbris
リポジトリmcpproxy
言語Python
フォーク
11
スター
39
利用可能なツール
0
通信方式stdio
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    Smart MCP Proxyは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには39件のスターと11件のフォークがあります。

Smart MCP Proxy

PyPI version License: MIT Python 3.11+

Smart MCP Proxy Demo

Quick Start

install with pip:

bash
pip install smart-mcp-proxy

Cursor IDE Integration

To use mcpproxy in Cursor IDE, add this configuration to your ~/.cursor/mcp.json:

json
{
  "mcpServers": {
    "mcp-proxy": {
      "command": "mcpproxy",
      "env": {
        "MCPPROXY_CONFIG_PATH": "/Users/user/.cursor/mcp_proxy.json"
      }
    }
  }
}

Then create a separate ~/.cursor/mcp_proxy.json with your actual(!) MCP servers: (just an example of configuration, you can use any MCP servers you want)

json
{
  "mcpServers": {
    "company-mcp": {
      "command": "uvx",
      "args": ["--from", "mcp-company-python@git+https://github.com/company/mcp-company.git", "company-mcp-server"],
      "env": {
        "COMPANY_TOKEN": "${COMPANY_TOKEN}",
        "PORT": "9090"
      }
    },
    "company-docs": {
      "url": "http://localhost:8000/mcp/"
    }
  }
}

Important: The mcp_proxy.json must be a different file than mcp.json to avoid circular proxy connections. The proxy configuration file has the same format as Cursor's MCP configuration but contains the actual MCP servers you want to federate.

Google ADK Integration

To use mcpproxy with Google ADK, you can integrate it using the MCPToolset:

python
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset, StdioServerParameters

proxy_tool = MCPToolset(
    connection_params=StdioServerParameters(
        command="mcpproxy",
        args=[],
        env={"MCPPROXY_CONFIG_PATH": "/Users/user/.cursor/mcp_proxy.json"}
    )
)

Tip for better LLM results (copy-paste into your system/dev prompt):

When you see a tool named `retrieval_tools` in the MCP tool list, call it first.  
It returns the most relevant tools for the user’s request, helping you answer more accurately and concisely.

A federating gateway that sits between AI agents and multiple Model Context Protocol (MCP) servers, providing intelligent tool discovery and dynamic registration.

🌐 Website: mcpproxy.app 📦 PyPI: pypi.org/project/smart-mcp-proxy 🔗 GitHub: github.com/Dumbris/mcpproxy

Features

  • Flexible Routing Strategies: Two modes - DYNAMIC (tools registered on-demand) or CALL_TOOL (proxy-only execution)
  • Dynamic Tool Discovery: Automatically discovers tools from multiple MCP servers
  • Intelligent Search: Uses configurable embedding backends (BM25, HuggingFace, OpenAI) to find relevant tools
  • One-Click Tool Access: Single retrieve_tools function that searches, registers, and exposes the top 5 most relevant tools
  • FastMCP Integration: Built on FastMCP v2 for robust server runtime and client capabilities
  • Persistent Indexing: SQLite + Faiss storage for fast tool lookup and change detection
  • MCP Spec Compliant: Emits proper notifications/tools/list_changed events
  • Flexible Dependencies: Optional dependencies for different backends to minimize install size

Architecture

┌─────────────────┐    ┌─────────────────────────────────┐    ┌─────────────────┐
│   AI Agent      │───▶│     Smart MCP Proxy             │───▶│  MCP Servers    │
│                 │    │                                 │    │                 │
│ retrieve_tools()│    │ ┌─────────────┐ ┌─────────────┐ │    │ • company-prod  │
│                 │    │ │   Indexer   │ │ Persistence │ │    │ • company-docs  │
│ tool_1()        │◀───│ │   (BM25/    │ │  (SQLite +  │ │    │ • oauth-server  │
│ tool_2()        │    │ │ HF/OpenAI)  │ │   Faiss)    │ │    │ • ...           │
│ ...             │    │ └─────────────┘ └─────────────┘ │    │                 │
└─────────────────┘    └─────────────────────────────────┘    └─────────────────┘

Quick Start

1. Installation

Choose your installation based on the embedding backend you want to use:

bash
# Basic installation with BM25 (lexical search, no ML dependencies)
pip install smart-mcp-proxy

# Or with specific backends:
pip install smart-mcp-proxy[bm25]         # Explicit BM25 (same as basic)
pip install smart-mcp-proxy[huggingface]  # HuggingFace + vector search
pip install smart-mcp-proxy[openai]       # OpenAI embeddings + vector search
pip install smart-mcp-proxy[all]          # All backends available

# Development install
git clone https://github.com/Dumbris/mcpproxy.git
cd mcpproxy
pip install -e .[all]

The proxy will automatically check for required dependencies and provide helpful error messages if you try to use a backend without the required packages installed.

2. Start the Proxy

bash
# Using the installed script
MCPPROXY_CONFIG_PATH=mcp_config.json mcpproxy

The proxy will:

  1. Discover tools from all configured MCP servers
  2. Index them using the chosen embedding backend
  3. Start MCP server, by default transport is stdio, you can use MCPPROXY_TRANSPORT to change it to streamable-http or sse

Routing Strategies

Smart MCP Proxy supports two routing strategies:

DYNAMIC Mode

  • Behavior: AI agent calls retrieve_tools, which searches and dynamically registers the most relevant tools as MCP tools
  • Tool Registration: Tools become available in the MCP protocol after retrieve_tools call
  • Client View: Sees both retrieve_tools and the registered tools (e.g., company_create_user, storage_upload_file)
  • Use Case: Best for clients that can handle dynamic tool registration and notifications

CALL_TOOL Mode (Default)

  • Behavior: AI agent calls retrieve_tools to discover tools, then uses call_tool to execute them
  • Tool Registration: No dynamic registration - tools are executed through the proxy
  • Client View: Only sees retrieve_tools and call_tool tools
  • Use Case: Better for clients with tool registration limits or simpler tool management
bash
# Set routing strategy
export MCPPROXY_ROUTING_TYPE=DYNAMIC    # or CALL_TOOL (default)

Output Truncation

To prevent context bloating from large tool outputs, you can configure output truncation:

bash
# Truncate tool outputs to 2000 characters (disabled by default)
export MCPPROXY_TRUNCATE_OUTPUT_LEN=2000

When enabled, outputs exceeding the limit are truncated showing:

  • First portion of the output
  • <truncated by smart mcp proxy> marker
  • Last 50 characters of the output

This helps manage token usage while preserving both the beginning and end of outputs.

Usage

Cursor IDE

See example on the top of the README.md file.

For AI Agents

DYNAMIC Mode Usage:

  1. Call retrieve_tools("user management")
  2. Use the returned tools directly (e.g., company_create_user)

CALL_TOOL Mode Usage:

  1. Call retrieve_tools("user management")
  2. Call call_tool("company_create_user", {"name": "john", "email": "john@example.com"})

Programmatic Usage

python
from mcpproxy import SmartMCPProxyServer

proxy = SmartMCPProxyServer("config.json")
await proxy.start()

# Use the indexer directly
results = await proxy.indexer.search_tools("delete volume", k=3)
for result in results:
    print(f"{result.tool.name}: {result.score}")

Project Structure

mcpproxy/
├── models/
│   └── schemas.py           # Pydantic models and schemas
├── persistence/
│   ├── db.py               # SQLite operations
│   ├── faiss_store.py      # Faiss vector storage
│   └── facade.py           # Unified persistence interface
├── indexer/
│   ├── base.py             # Base embedder interface
│   ├── bm25.py             # BM25 implementation
│   ├── huggingface.py      # HuggingFace embeddings
│   ├── openai.py           # OpenAI embeddings
│   └── facade.py           # Search and indexing interface
├── server/
│   ├── config.py           # Configuration management
│   └── mcp_server.py       # FastMCP server implementation
└── utils/
    └── hashing.py          # SHA-256 utilities for change detection

Environment Variables

VariableValuesDefaultDescription
MCPPROXY_ROUTING_TYPEDYNAMIC, CALL_TOOLCALL_TOOLTool routing strategy
MCPPROXY_EMBEDDERBM25, HF, OPENAIBM25Embedding backend
MCPPROXY_HF_MODELHuggingFace model namesentence-transformers/all-MiniLM-L6-v2HF model
MCPPROXY_TOP_KInteger5Number of tools to register
MCPPROXY_TOOLS_LIMITInteger15Maximum number of tools in active pool
MCPPROXY_TOOL_NAME_LIMITInteger60Maximum tool name length
MCPPROXY_TRUNCATE_OUTPUT_LENInteger-Truncate tool output to prevent context bloating (disabled by default)
MCPPROXY_LIST_CHANGED_EXECShell command-External command to execute after tool changes (see Client Compatibility)
MCPPROXY_DATA_DIRDirectory path~/.mcpproxyDirectory for database and index files
MCPPROXY_CONFIG_PATHPath to config filemcp_config.jsonConfig file location
MCPPROXY_HOSTHost to bind127.0.0.1Server host
MCPPROXY_PORTPort to bind8000Server port
MCPPROXY_TRANSPORTTransport to usestdioTransport to use
MCPPROXY_LOG_LEVELLog levelINFOLogging level (DEBUG, INFO, WARNING, ERROR)
MCPPROXY_LOG_FILEFile path-Optional log file path
MCPPROXY_RESET_DATABooleanfalseReset all data (useful when dimensions change)

Client Compatibility

MCP Tool List Refresh Workaround

This is only needed for DYNAMIC routing mode. The default CALL_TOOL routing mode doesn't require MCPPROXY_LIST_CHANGED_EXEC since tools are not dynamically registered.

Some MCP clients (like Cursor IDE) don't properly handle the standard tools/list_changed notification when new tools are registered in DYNAMIC mode. As a temporary workaround, you can configure the proxy to execute an external command after tool changes to trigger client refresh.

For Cursor IDE

Set the MCPPROXY_LIST_CHANGED_EXEC environment variable to touch the MCP configuration file:

bash
# For macOS/Linux
export MCPPROXY_LIST_CHANGED_EXEC="touch $HOME/.cursor/mcp.json"

# For Windows (PowerShell)
$env:MCPPROXY_LIST_CHANGED_EXEC = "cmd /c copy `"$HOME\.cursor\mcp.json`" +,,"

This causes Cursor to detect the config file change and refresh its tool list.

How it Works

  1. When you call retrieve_tools, the proxy registers new tools
  2. Standard tools/list_changed notification is sent (proper MCP way)
  3. If MCPPROXY_LIST_CHANGED_EXEC is set, the command is executed asynchronously
  4. The command triggers the MCP client to refresh its tool list

Security Note

⚠️ Important: The command in MCPPROXY_LIST_CHANGED_EXEC is executed with shell privileges. Only use trusted commands and never set this variable to user-provided input.

When Not to Use

  • Your MCP client properly handles tools/list_changed notifications
  • You're using the proxy programmatically (not through an MCP client)
  • Security policies prohibit executing external commands

This feature is disabled by default and only executes when explicitly configured.

Contributing

We welcome contributions! Please see our GitHub repository for:

Development Setup

bash
git clone https://github.com/Dumbris/mcpproxy.git
cd mcpproxy
pip install -e .[dev,all]
pytest tests/

License

This project is licensed under the MIT License - see the LICENSE file for details.

インストール

TypingMind
前提条件:

Node.js 18+

{
  "mcpServers": {
    "dumbris-mcpproxy": {
      "command": "uvx",
      "args": [
        "smart-mcp-proxy"
      ]
    }
  }
}

Smart MCP ProxyのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度Smart MCP Proxyに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

Smart MCP Proxyをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. Smart MCP ProxyのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "dumbris-mcpproxy": {
      "command": "npx",
      "args": [
        "-y",
        "smart-mcp-proxy"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてSmart MCP ProxyのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. Smart MCP ProxyのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Smart MCP Proxyを使ってこのタスクを手伝ってもらえますか?
Smart MCP Proxy
はい、読みました。
Smart MCP Proxyで調べた結果をお伝えします。

よくある質問

Smart MCP Proxy MCPサーバーは何に使いますか?

Smart MCP Proxyは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでSmart MCP Proxy MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでSmart MCP Proxyを利用できます。

TypingMindでSmart MCP Proxy MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。Smart MCP Proxyを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

Smart MCP Proxy MCPをTypingMindに接続するにはどうすればよいですか?

Smart MCP ProxyはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでSmart MCP Proxy MCPのどのようなツールを利用できますか?

Smart MCP ProxyはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

Smart MCP Proxy MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。Smart MCP Proxyで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇