返回首页
🤖 AI / LLM
Anthropic MCP 全解读:LLM 工具调用的统一标准
Model Context Protocol 是 LLM 工具调用的事实标准。本文深度解析架构、SDK 和实战。
MCP · Anthropic · LLM · Claude · 协议
📰
今日技术简讯
📰 技术简讯 · 2026-05-17
今日聚合 6 条热门技术内容(周日)。
🤖 AI / LLM
1. Anthropic MCP 全解读
- 链接:https://modelcontextprotocol.io
- 来源:Anthropic 官方
- 摘要:Model Context Protocol 成为 LLM 工具调用事实标准,Claude / GPT / Gemini 全支持。
2. OpenAI Realtime API 实战教程
- 链接:https://platform.openai.com/docs/realtime
- 来源:OpenAI
- 摘要:Realtime API 实战:延迟 < 300ms,支持打断和情感识别。
🎨 前端 / Web
3. Svelte 5.1 GA
- 链接:https://svelte.dev/blog/svelte-5-1
- 来源:Svelte
- 摘要:Svelte 5.1 推出编译器优化,运行时性能提升 30%。
⚙️ 后端 / 架构
4. Traefik 3.1 发布
- 链接:https://traefik.io/blog/3-1
- 来源:Traefik
- 摘要:Traefik 3.1 优化 Dashboard,新增 50+ 中间件。
🚀 独立开发 / OPC
5. Apify 推出 Web Scraper 服务
- 链接:https://apify.com
- 来源:Apify
- 摘要:托管爬虫平台,开发者可发布 / 销售爬虫。
6. Apify Marketplace 推出
- 链接:https://apify.com/marketplace
- 来源:Apify
- 摘要:爬虫 + actor 市场,独立开发者收入分成 80%。
数据来源:掘金 / InfoQ 中文 / HN / GitHub / Dev.to 采集时间:2026-05-17 09:00 (UTC+8)
📝
今日深度文
Anthropic MCP 全解读:LLM 工具调用的统一标准
一句话结论:MCP 让 LLM 与外部工具的通信标准化,类似 AI 时代的"USB 接口"。
4 个核心概念
1. MCP Server
# MCP Server 提供工具 / 资源 / 提示词
from mcp.server import Server
server = Server("my-server")
@server.tool()
def query_database(sql: str) -> str:
"""执行 SQL 查询"""
return execute(sql)
@server.resource("schema://main")
def get_schema() -> str:
"""获取数据库 schema"""
return schema_content
@server.prompt()
def analysis_template() -> str:
"""分析模板"""
return "请分析以下数据..."
2. MCP Client
# Claude Desktop / Cursor 等内置 MCP Client
# 配置 ~/.claude/mcp_servers.json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_xxx"
}
}
}
}
3. Tools(工具)
// MCP 工具定义
{
name: "create_issue",
description: "创建 GitHub issue",
inputSchema: {
type: "object",
properties: {
repo: { type: "string" },
title: { type: "string" },
body: { type: "string" }
},
required: ["repo", "title"]
}
}
4. Resources(资源)
// MCP 资源(数据访问)
{
uri: "file:///path/to/file.md",
name: "API 文档",
mimeType: "text/markdown"
}
实战:写一个 GitHub MCP Server
import { Server } from '@modelcontextprotocol/sdk/server';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio';
import { Octokit } from 'octokit';
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
const server = new Server({ name: 'github-mcp', version: '1.0.0' });
server.setRequestHandler('tools/list', async () => ({
tools: [{
name: 'search_repos',
description: '搜索 GitHub 仓库',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string' },
limit: { type: 'number' }
},
required: ['query']
}
}]
}));
server.setRequestHandler('tools/call', async (request) => {
if (request.params.name === 'search_repos') {
const { query, limit = 10 } = request.params.arguments;
const result = await octokit.search.repos({ q: query, per_page: limit });
return {
content: [{
type: 'text',
text: JSON.stringify(result.data.items, null, 2)
}]
};
}
});
const transport = new StdioServerTransport();
await server.connect(transport);
5 个核心优势
- 标准化:一次开发,所有 LLM 客户端可用
- 可组合:GitHub + Slack + Notion = 强大 Agent
- 可复用:开源生态已有 1000+ MCP Server
- 跨模型:Claude / GPT / Gemini 都支持
- 易调试:协议清晰,便于排错
何时用 MCP
- ✅ LLM 调用多个外部工具
- ✅ 需要跨客户端复用工具
- ✅ 想利用开源 MCP Server 生态
- ❌ 单一 LLM 简单任务(直接用 SDK)
参考
本文基于 MCP 2026.5 规范。
📚 同主题文章
🤖AI / LLM·
LLM 应用工程化实战:从 Prompt 到 Agent 部署的完整指南
LLM 应用从原型到生产有 10 倍差距。本文从 0 到生产级 LLMOps,含 Prompt 管理 / 评估 / 监控 / 成本优化 / Guardrails 完整链路。
LLMLLMOpsPrompt Engineering
🤖AI / LLM·
AutoGen 0.4 实战:微软出品的多 Agent 对话框架
AutoGen 是微软推出的多 Agent 对话框架。本文从 0 演示协作式 Agent,含 5 个真实场景 + 与 LangGraph / CrewAI 对比。
AutoGen多 AgentLLM
🤖AI / LLM·
LangGraph 实战:状态机式 AI Agent 编排框架
LangGraph 是 LangChain 推出的状态机式 Agent 框架。本文从 0 演示复杂 Agent 编排,含 4 个真实场景 + 性能对比。
LangGraphAI AgentLLM