0Pricing
MCP Academy · 课时

为什么远程服务器需要身份验证

了解开放公共 MCP 端点的风险。

为什么远程服务器需要身份验证 是 CoddyKit 上的免费 MCP Academy 课时。 这是第 1 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 MCP Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 MCP Academy 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

From Local to Remote

When your MCP server ran over stdio, only your own machine could reach it. Move it to HTTP and suddenly the whole internet can knock on the door. 🌐

No Door, No Lock

A fresh HTTP server has no authentication by default. Anyone who learns the URL can list and call every tool you exposed.

Tools Can Do Real Work

MCP tools read files, hit databases, and call APIs. An open endpoint hands those powers to strangers, not just your trusted client.

Anonymous Calls Are the Risk

The core problem is that the server cannot tell who is calling. Without identity, every request looks equally trustworthy.

Authentication vs Authorization

Authentication asks "who are you?" Authorization asks "what may you do?" You need to answer the first before the second makes sense.

A Public URL Is Not a Secret

People assume an unguessable URL is safe, but logs, proxies, and link sharing leak it fast. A long URL is not real protection.

Costs of an Open Endpoint

An unprotected server invites data theft, abuse of paid APIs, and runaway bills. Access control is what keeps those costs in check.

Tokens: The Usual Answer

The common fix is to require a secret on every request. A valid token proves the caller is allowed; a missing one gets rejected.

Reject Early, Reject Clearly

A good server checks the token before doing any work and returns 401 Unauthorized when it is missing or wrong.

from fastapi import Header, HTTPException

def require_token(authorization: str = Header(None)):
    if not authorization:
        raise HTTPException(status_code=401)

Always Use HTTPS

Tokens travel in request headers, so the connection itself must be encrypted. HTTPS stops attackers from reading secrets in transit.

Auth Is Not Optional Remotely

For anything reachable beyond your laptop, treat auth as required, not a nice-to-have you will add later.

Quick Check

Quick gut check on remote risk.

Recap: Locks for the Open Door

Remote means reachable, and reachable means it needs a lock. Require a token, reject anonymous calls, and keep it all over HTTPS. 🔐

常见问题解答

「为什么远程服务器需要身份验证」课时是免费的吗?

是的 — 「为什么远程服务器需要身份验证」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 MCP Academy 课程的其余内容,请升级到 CoddyKit PRO。 MCP Academy 课程共包含 4 节课。

「为什么远程服务器需要身份验证」这节课中我会学到什么?

了解开放公共 MCP 端点的风险。 你通过在浏览器中直接运行的动手代码来练习 MCP Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 MCP Academy 需要有经验吗?

无需任何先前经验。CoddyKit 上的 MCP Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 1 节课,共 4 节。

「为什么远程服务器需要身份验证」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 MCP Academy 课中编写并运行代码吗?

能。每节 MCP Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 为什么远程服务器需要身份验证
  2. Bearer 令牌与请求头
  3. MCP 中的 OAuth 流程
  4. 限定令牌的权限范围
← 返回 MCP Academy