AI

MCP协议的局限性

MCP Limitation

Posted by Zeusro on April 21, 2025
👈🏻 Select language

5年前,我把 AI 比喻为一种智能化的 API 网关,提出一种分治的思想,将一个大问题转换为若干可解的小问题。

1
2
3
4
5
6
7
8
9
func sum(arr []int) int {
    if len(arr) == 1 {
        return arr[0]
    }
    mid := len(arr) / 2
    leftSum := sum(arr[:mid])
    rightSum := sum(arr[mid:])
    return leftSum + rightSum
}

就像上面的递归求和函数——将数组一分为二,分别递归求和。

如今,这种思想正在 MCP 这种协议沿用。

在2025-04那段时间,我使用 cline 搭配 Google gemini 作为底层大模型“内核”,研究了一下大语言模型调用 MCP 这套完整协议。

但目前来看,MCP的实现方式还是有点丑陋的,并且有一些问题。 而且由于大模型自身的问题,会导致多余的 token 消耗。

现状

MCP 协议里面内置了一个服务发现系统,各个 MCP server 把自身的实现和调用方法注册到里面,然后在调用的时候加到提示词,作为参数去请求远程的 AI 服务器,让AI 找到正确的命令然后在本地执行。

比如 Gemini Function Call 大概长这样:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tools": [
      {
        "function_declarations": [
          {
            "name": "get_current_weather",
            "description": "Get the current weather for a given location",
            "parameters": {
              "type": "object",
              "properties": {
                "location": {
                  "type": "string",
                  "description": "The city and country, e.g. Shanghai, China"
                }
              },
              "required": ["location"]
            }
          }
        ]
      }
    ],
    "contents": [
      {
        "parts": [
          {
            "text": "What is the weather in Shanghai right now?"
          }
        ]
      }
    ]
  }'

整个过程可能非常繁复。比如,我们向AI下令“删除桌面上所有截图”的时候,最理想的指令是:

1
find /Users/zeusro/Desktop -type f -name "Screenshot*.png" -delete && find /Users/zeusro/Desktop -type f -name "Screenshot*.jpg" -delete

但实际的执行过程可能是:

  1. 找到这个路径上面所有文件,获取相应路径
  2. 删除截图图片1
  3. 删除截图图片2
  4. 删除截图图片n

image

这个计算过程取决于大模型自身的能力,如果是 gemini-2.0 这种是第一种情况直接一步到位的,而国内其他模型基本不开放免费API,我基本上不用。

1
input --> process --> output -->(评估)influence,考虑是否要执行下一次计算

人类,作为外部观察者,通过评估,观察计算产生的影响,补充提示词,诱导ai继续计算,一直修正,直到获取最终结果。

func 计算(){
    ai.找到合适的工具链调用()
    (可选)用户.评估潜在影响并决定是否要执行相应命令
    ai+mcp client(通常可以在ai客户端里面顺便集成mcp功能,比如vs code cline插件).调用mcp server()
    (可选)用户.评估最终影响()
        if 满足需求(){
            return
            }
        else{
            用户.补充提示词,继续向ai提问()
            计算()
        }
}

以代码项目管理的层面去解读,AI与人的关系像是“开发”和“评审人员”,由评审人员决定是否要“并入”代码。

local function 和 cloud function

在2020年的时候,我以打车作为例子,提出了Cloud Function

Cloud Function 指的是一种依赖云端软硬件资源来完成辅助计算的函数。

而与 Cloud Function 相对应的,是Local Function

Local Function 指的是一种离线计算的函数。 狭义的Local Function 不需要网络就能进行,一般可以理解为操作系统的API;广义的Local Function指的是本地硬件的局部函数。 像是手机端北京时间的获取——虽然手机有内置时钟,但是时间需要周期地从国家授时中心同步。

这就有点像我们家里的闹钟——虽然给它电池就能转,但由于时间的偏移,我们也需要定期人工校准时间。

local function callcloud function call 分离

image

但在我看来, MCP 协议目前这种实现只能算是次选(过渡方案)。 实际上,我觉得现阶段更需要做的事情是“分离函数”,把函数分为 local function callcloud function call ,对于 local function call , 甚至不需要网络都能进行,像是“打开xx应用”,“给我grandma发短信”,像这类需求根本用不到云函数,“离线计算”就能进行。

AI 应该有一个预备的知识库,面对不同的操作系统时内置一些能够支持的api,而不是像现在这样,连删除个文件都要建一个 file-system 来实现。

实际上,目前各大国产系统的AI入口就是这样实现的。通过xx助理解析用户的语音指令,将他们翻译成具体需要执行的子任务。

结论

MCP 协议作为一种过渡设计,作用有点像是制定一种 AI API(面向AI的语言/操作系统无关接口)的 app store标准,完成这个任务之后就可以淘汰。

image

5 years ago, I compared AI to an intelligent API gateway, proposing a divide-and-conquer approach to convert a large problem into several solvable small problems.

1
2
3
4
5
6
7
8
9
func sum(arr []int) int {
    if len(arr) == 1 {
        return arr[0]
    }
    mid := len(arr) / 2
    leftSum := sum(arr[:mid])
    rightSum := sum(arr[mid:])
    return leftSum + rightSum
}

Just like the recursive summation function above—divide the array in half and recursively sum each part.

Today, this idea is being continued in the MCP protocol.

During the 2025-04 period, I used cline with Google gemini as the underlying large model “kernel” to study the complete protocol of large language models calling MCP.

But currently, MCP’s implementation is still somewhat ugly and has some problems. And due to the problems of large models themselves, it leads to excessive token consumption.

Current State

The MCP protocol has a built-in service discovery system. Each MCP server registers its implementation and calling methods, then adds them to prompts when calling, as parameters to request remote AI servers, allowing AI to find the correct commands and then execute them locally.

For example, Gemini Function Call looks roughly like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tools": [
      {
        "function_declarations": [
          {
            "name": "get_current_weather",
            "description": "Get the current weather for a given location",
            "parameters": {
              "type": "object",
              "properties": {
                "location": {
                  "type": "string",
                  "description": "The city and country, e.g. Shanghai, China"
                }
              },
              "required": ["location"]
            }
          }
        ]
      }
    ],
    "contents": [
      {
        "parts": [
          {
            "text": "What is the weather in Shanghai right now?"
          }
        ]
      }
    ]
  }'

The entire process can be very complex. For example, when we order AI to “delete all screenshots on the desktop”, the ideal command is:

1
find /Users/zeusro/Desktop -type f -name "Screenshot*.png" -delete && find /Users/zeusro/Desktop -type f -name "Screenshot*.jpg" -delete

But the actual execution process might be:

  1. Find all files on this path, get corresponding paths
  2. Delete screenshot image 1
  3. Delete screenshot image 2
  4. Delete screenshot image n

image

This calculation process depends on the large model’s own capabilities. If it’s something like gemini-2.0, it’s the first case, directly one step. Other domestic models basically don’t offer free APIs, so I basically don’t use them.

1
input --> process --> output --> (evaluate) influence, consider whether to execute the next calculation

Humans, as external observers, evaluate, observe the impact of calculations, supplement prompts, induce AI to continue calculating, constantly correcting until obtaining the final result.

func 计算(){
    ai.找到合适的工具链调用()
    (可选)用户.评估潜在影响并决定是否要执行相应命令
    ai+mcp client(通常可以在ai客户端里面顺便集成mcp功能,比如vs code cline插件).调用mcp server()
    (可选)用户.评估最终影响()
        if 满足需求(){
            return
            }
        else{
            用户.补充提示词,继续向ai提问()
            计算()
        }
}

From the perspective of code project management, the relationship between AI and humans is like “developer” and “reviewer”, with reviewers deciding whether to “merge” the code.

local function and cloud function

In 2020, I used ride-hailing as an example to propose Cloud Function.

Cloud Function refers to a function that relies on cloud software and hardware resources to complete auxiliary calculations.

Corresponding to Cloud Function is Local Function.

Local Function refers to an offline computing function. In the narrow sense, Local Function can be performed without a network, generally understood as operating system APIs; in the broad sense, Local Function refers to local hardware’s local functions. Like getting Beijing time on a mobile phone—although the phone has a built-in clock, the time needs to be periodically synchronized from the National Time Service Center.

This is a bit like the alarm clock at home—although it can run with batteries, due to time drift, we also need to manually calibrate the time regularly.

Separation of local function call and cloud function call

image

But in my opinion, MCP protocol’s current implementation can only be considered a second choice (transitional solution). Actually, I think what’s more needed at this stage is “function separation”, dividing functions into local function call and cloud function call. For local function call, it can even be performed without a network, like “open xx app”, “send a text to grandma”, such needs don’t need cloud functions at all, “offline computing” can handle them.

AI should have a prepared knowledge base, with some supported APIs built-in when facing different operating systems, rather than like now, where even deleting a file requires building a file-system to implement.

Actually, the AI entry points of major domestic systems are implemented this way. Through xx assistant parsing user voice commands, translating them into specific subtasks that need to be executed.

Conclusion

MCP protocol, as a transitional design, acts somewhat like establishing an app store standard for AI APIs (language/OS-agnostic interfaces for AI). After completing this task, it can be phased out.

image

5 лет назад, я сравнил AI с интеллектуальным API-шлюзом, предложив подход “разделяй и властвуй” для преобразования большой проблемы в несколько решаемых маленьких проблем.

1
2
3
4
5
6
7
8
9
func sum(arr []int) int {
    if len(arr) == 1 {
        return arr[0]
    }
    mid := len(arr) / 2
    leftSum := sum(arr[:mid])
    rightSum := sum(arr[mid:])
    return leftSum + rightSum
}

Как рекурсивная функция суммирования выше — разделить массив пополам и рекурсивно суммировать каждую часть.

Сегодня эта идея продолжается в протоколе MCP.

В период 2025-04 я использовал cline с Google gemini в качестве базовой большой модели “ядро” для изучения полного протокола вызова MCP большими языковыми моделями.

Но в настоящее время реализация MCP всё ещё несколько уродлива и имеет некоторые проблемы. И из-за проблем самих больших моделей это приводит к избыточному потреблению токенов.

Текущее состояние

Протокол MCP имеет встроенную систему обнаружения сервисов. Каждый MCP-сервер регистрирует свою реализацию и методы вызова, затем добавляет их в подсказки при вызове, как параметры для запроса удалённых AI-серверов, позволяя AI найти правильные команды и затем выполнить их локально.

Например, Gemini Function Call выглядит примерно так:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tools": [
      {
        "function_declarations": [
          {
            "name": "get_current_weather",
            "description": "Get the current weather for a given location",
            "parameters": {
              "type": "object",
              "properties": {
                "location": {
                  "type": "string",
                  "description": "The city and country, e.g. Shanghai, China"
                }
              },
              "required": ["location"]
            }
          }
        ]
      }
    ],
    "contents": [
      {
        "parts": [
          {
            "text": "What is the weather in Shanghai right now?"
          }
        ]
      }
    ]
  }'

Весь процесс может быть очень сложным. Например, когда мы приказываем AI “удалить все скриншоты на рабочем столе”, идеальная команда:

1
find /Users/zeusro/Desktop -type f -name "Screenshot*.png" -delete && find /Users/zeusro/Desktop -type f -name "Screenshot*.jpg" -delete

Но фактический процесс выполнения может быть:

  1. Найти все файлы на этом пути, получить соответствующие пути
  2. Удалить скриншот изображение 1
  3. Удалить скриншот изображение 2
  4. Удалить скриншот изображение n

image

Этот процесс вычисления зависит от собственных возможностей большой модели. Если это что-то вроде gemini-2.0, это первый случай, напрямую одним шагом. Другие отечественные модели в основном не предлагают бесплатные API, поэтому я в основном не использую их.

1
input --> process --> output --> (оценить) влияние, рассмотреть, выполнять ли следующее вычисление

Люди, как внешние наблюдатели, оценивают, наблюдают влияние вычислений, дополняют подсказки, побуждают AI продолжать вычисления, постоянно исправляя, пока не получится окончательный результат.

func 计算(){
    ai.找到合适的工具链调用()
    (可选)用户.评估潜在影响并决定是否要执行相应命令
    ai+mcp client(通常可以在ai客户端里面顺便集成mcp功能,比如vs code cline插件).调用mcp server()
    (可选)用户.评估最终影响()
        if 满足需求(){
            return
            }
        else{
            用户.补充提示词,继续向ai提问()
            计算()
        }
}

С точки зрения управления проектами кода, отношения между AI и людьми похожи на “разработчик” и “рецензент”, где рецензенты решают, “сливать” ли код.

local function и cloud function

В 2020 году я использовал вызов такси в качестве примера, чтобы предложить Cloud Function.

Cloud Function относится к функции, которая полагается на облачные программные и аппаратные ресурсы для выполнения вспомогательных вычислений.

Соответствующей Cloud Function является Local Function.

Local Function относится к функции офлайн-вычислений. В узком смысле Local Function может выполняться без сети, обычно понимается как API операционной системы; в широком смысле Local Function относится к локальным функциям локального оборудования. Как получение пекинского времени на мобильном телефоне — хотя телефон имеет встроенные часы, время нужно периодически синхронизировать из Национального центра времени.

Это немного похоже на будильник дома — хотя он может работать с батареями, из-за дрейфа времени нам также нужно регулярно вручную калибровать время.

Разделение local function call и cloud function call

image

Но, на мой взгляд, текущая реализация протокола MCP может считаться только вторым выбором (переходным решением). На самом деле, я думаю, что на данном этапе более необходимо “разделение функций”, разделение функций на local function call и cloud function call. Для local function call, это может даже выполняться без сети, как “открыть xx приложение”, “отправить текст бабушке”, такие потребности вообще не нуждаются в облачных функциях, “офлайн-вычисления” могут с ними справиться.

AI должен иметь подготовленную базу знаний, со встроенными поддерживаемыми API при работе с разными операционными системами, а не как сейчас, где даже удаление файла требует создания file-system для реализации.

На самом деле, точки входа AI крупных отечественных систем реализованы именно так. Через xx-ассистент, анализируя голосовые команды пользователя, переводя их в конкретные подзадачи, которые нужно выполнить.

Заключение

Протокол MCP, как переходный дизайн, действует несколько как установление стандарта app store для AI API (язык/OS-независимые интерфейсы для AI). После завершения этой задачи его можно вывести из эксплуатации.

image