微信扫码
添加专属顾问
我要投稿
AI技术的新突破,Claude 3.7 Sonnet模型引领未来。核心内容:1. AI技术进步与Claude 3.7 Sonnet模型的卓越表现2. Claude 3.7 Sonnet模型的技术亮点与应用场景3. Claude Code工具与AI技术的未来展望
阿里妹导读
本文主要围绕AI技术的进步,特别是Anthropic的Claude 3.7 Sonnet模型在逻辑推理、代码生成和复杂任务执行方面的能力提升及其应用场景。
一、引言
Cursor 报告称其在实际编码任务中“再次成为最佳”,特别是在处理复杂代码库和高级工具使用方面。
Cognition 发现它在规划代码更改和处理全栈更新方面远超其他模型。
Vercel 强调其在复杂代理工作流中的“卓越精度”。
Replit 成功使用它从头构建复杂的网络应用程序和仪表板,而其他模型则停滞不前。
二、Claude 3.7:技术突破与能力提升
模型概述
各种安全评估
案例
绘制一个笛卡尔坐标系,x轴和y轴用白色标注。
用不同颜色的点标记并用白色文本标注以下位置:
点 A (0, 0):原点,用黄色点标记。
点 B (0, 1):y轴上,用红色点标记。
点 C (1, 1):右上角,用紫色点标记。
在青色阴影区域内,用白色文本清晰显示面积计算公式:
1.从黑色背景开始,绘制并标注坐标系(x轴和y轴)。
2.逐一绘制并标注点 A、B、C、D,使用各自的颜色。
3.用浅蓝色线条连接四点,绘制矩形正方形。
4.缓慢绘制黄色半圆形曲线,强调其为参数曲线。
5.用青色填充曲线下的区域,突出显示待计算的面积。
6.在阴影区域内显示公式
采用数学插图常见的简洁精确风格。
使用黑色背景,搭配白色文本和彩色元素(点、线、阴影),增强视觉对比度。
动画过渡需平滑,节奏适中,避免观众感到仓促。
小结
模型能力持续提升,效果都比以往更好,准确度更高;
我们还没有完全发挥这些模型的潜力,主要是缺乏想象力;
只要善用模型配置和写代码的能力,AI就能在日常工作中带来巨大的帮助。
数据分析
生成报告
日常自动化任务
三、MCP:模型与现实世界的连接
什么是 MCP?
1.获取数据:比如从数据库里查东西、从文件里读内容。
2.执行操作:比如调用API发个消息、管理代码仓库。
1.标准化:就像USB-C成了通用接口,MCP让AI跟外部世界的连接有了统一标准,省去了重复开发的麻烦。
2.安全性:服务器管着访问权限,不用担心数据被乱用。
3.灵活性:不管是数据库、文件还是API,MCP都能支持,而且还能根据需要扩展。
数据分析:AI可以直接查数据库,拿到最新数据帮你分析。
自动化任务:比如让AI调用API,在GitHub上创建issue,或者在Slack上发消息。
如何开发MCP Server?
开发一个MCP Server需要使用Anthropic的Model Context Protocol(MCP),它是一个开源标准协议,帮助AI模型与外部数据源和工具无缝连接。
推荐使用Python SDK,通过uv或pip安装,创建简单的服务器文件,并使用mcp dev命令本地运行。
资源(Resources)资源是AI可以读取的数据,比如文件内容、数据库查询结果或API的响应。 例如,AI可能通过资源获取你的日历事件列表。
工具(Tools)工具是AI可以调用的函数,用于执行特定操作,比如添加新任务或发送邮件,使用工具时,通常需要用户先批准,以确保安全。
curl -LsSf https://astral.sh/uv/install.sh | sh
uv add "mcp[cli]"
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("Simple Server")
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add两个数字"""
return a + b
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
"""获取个性化问候"""
return f"Hello, {name}!"
mcp dev server.py
import sqlite3
from fastapi import HTTPException
from mcp.server.fastmcp import FastMCP
import atexit
db_conn = None
def init_db():
global db_conn
db_conn = sqlite3.connect("todo.db")
cursor = db_conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS tasks (id INTEGER PRIMARY KEY, description TEXT NOT NULL, completed INTEGER DEFAULT 0);")
db_conn.commit()
init_db()
def close_db():
if db_conn:
db_conn.close()
atexit.register(close_db)
mcp = FastMCP("To-Do List Server")
@mcp.tool()
def add_task(description: str) -> int:
if not description.strip():
raise ValueError("Task description cannot be empty")
cursor = db_conn.cursor()
cursor.execute("INSERT INTO tasks (description) VALUES (?);", (description,))
task_id = cursor.lastrowid
db_conn.commit()
return task_id
@mcp.tool()
def mark_task_completed(task_id: int) -> bool:
cursor = db_conn.cursor()
cursor.execute("UPDATE tasks SET completed=1 WHERE id=?;", (task_id,))
rows_affected = cursor.rowcount
db_conn.commit()
return rows_affected > 0
@mcp.tool()
def delete_task(task_id: int) -> bool:
cursor = db_conn.cursor()
cursor.execute("DELETE FROM tasks WHERE id=?;", (task_id,))
rows_affected = cursor.rowcount
db_conn.commit()
return rows_affected > 0
@mcp.tool()
def update_task_description(task_id: int, new_description: str) -> bool:
if not new_description.strip():
raise ValueError("Task description cannot be empty")
cursor = db_conn.cursor()
cursor.execute("UPDATE tasks SET description=? WHERE id=?;", (new_description, task_id))
rows_affected = cursor.rowcount
db_conn.commit()
return rows_affected > 0
@mcp.resource("tasks://all")
def get_all_tasks() -> list[dict]:
cursor = db_conn.cursor()
cursor.execute("SELECT id, description, completed FROM tasks;")
tasks = []
for row in cursor.fetchall():
tasks.append({"id": row[0], "description": row[1], "completed": bool(row[2])})
return tasks
@mcp.resource("task_status://{task_id}")
def get_task_status(task_id: int) -> dict:
cursor = db_conn.cursor()
cursor.execute("SELECT description, completed FROM tasks WHERE id=?;", (task_id,))
row = cursor.fetchone()
if row is None:
raise HTTPException(status_code=404, detail="Task not found")
return {"description": row[0], "completed": bool(row[1])}
@mcp.resource("task_counts://{dummy}")
def get_task_counts(dummy: str = "all") -> dict:
cursor = db_conn.cursor()
cursor.execute("SELECT COUNT(*) FROM tasks WHERE completed=0;")
incomplete_count = cursor.fetchone()[0]
cursor.execute("SELECT COUNT(*) FROM tasks WHERE completed=1;")
completed_count = cursor.fetchone()[0]
return {"incomplete": incomplete_count, "completed": completed_count}
@mcp.prompt()
def todo_list_prompt() -> str:
return """
You have access to a to-do list server. You can use the following tools and resources:
- Tool: add_task(description) -> int
- Adds a new task with the given description and returns the task ID.
- Tool: mark_task_completed(task_id) -> bool
- Marks the task with the given ID as completed and returns True if successful, False otherwise.
- Tool: delete_task(task_id) -> bool
- Deletes the task with the given ID and returns True if successful, False otherwise.
- Tool: update_task_description(task_id, new_description) -> bool
- Updates the description of the task with the given ID and returns True if successful, False otherwise.
- Resource: tasks://all
- Returns a list of all tasks, each with their ID, description, and completion status.
- Resource: task_status://{task_id}
- Returns the status of the task with the given ID, including its description and completion status.
- Resource: task_counts://{dummy}
- Returns a dictionary with the count of incomplete and completed tasks.
You can use these to manage your to-do list.
"""
部署MCP服务器可以选择本地运行、VPS或云平台,具体取决于使用场景。
确保服务器稳定、安全,并支持JSON-RPC和SSE协议。
使用mcp install server.py可为Claude Desktop安装服务器;对于通用部署,可用Uvicorn或Docker运行。
sudo mcp install server.py
2025-03-01T13:15:43.231Z [To-Do List Server] [info] Initializing server...
2025-03-01T13:15:43.246Z [To-Do List Server] [error] spawn uv ENOENT {"context":"connection","stack":"Error: spawn uv ENOENT\n at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n at onErrorNT (node:internal/child_process:483:16)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}
2025-03-01T13:15:43.246Z [To-Do List Server] [error] spawn uv ENOENT {"stack":"Error: spawn uv ENOENT\n at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n at onErrorNT (node:internal/child_process:483:16)\n at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"}
2025-03-01T13:15:43.248Z [To-Do List Server] [info] Server transport closed
2025-03-01T13:15:43.248Z [To-Do List Server] [info] Client transport closed
brew install uv
mcp install server2.py --with fastapi
mcp install server2.py --with fastapi,uvicorn
from fastmcp import FastMCP
mcp = FastMCP("To-Do List Server", dependencies=["fastapi", "uvicorn"])
如何集成MCP Server?
sudo mcp install server.py
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["-y", "@executeautomation/playwright-mcp-server"]
}
}
}
#!/usr/bin/env python3
"""
简单的 MCP 客户端示例
连接到 server2.py 并演示 MCP 的基本功能
"""
import asyncio
import os
import json
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
from typing import Optional, List, Dict, Any
# 创建连接到 server2.py 的参数
server_params = StdioServerParameters(
command="python",
args=[os.path.join(os.path.dirname(os.path.abspath(__file__)), "server2.py")],
env=None # 使用当前环境变量
)
async def run():
"""演示 MCP 客户端功能的主函数"""
print("正在连接到 MCP 服务器...")
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
# 1. 初始化连接
await session.initialize()
print("✓ 已成功初始化连接")
# 2. 获取可用的提示词
try:
prompts = await session.list_prompts()
print(f"可用的提示词: {prompts}")
if prompts and prompts.prompts:
# 3. 获取提示词内容
try:
prompt = await session.get_prompt(prompts.prompts[0].name)
print(f"\n服务器提示词:\n{prompt}\n")
except Exception as e:
print(f"获取提示词内容时出错: {e}")
except Exception as e:
print(f"获取提示词列表时出错: {e}")
# 4. 列出可用资源
try:
resources = await session.list_resources()
print(f"可用的资源: {resources}")
except Exception as e:
print(f"获取资源列表时出错: {e}")
resources = []
# 5. 列出可用工具
try:
tools = await session.list_tools()
print(f"可用的工具: {tools}")
except Exception as e:
print(f"获取工具列表时出错: {e}")
tools = []
if __name__ == "__main__":
try:
asyncio.run(run())
except KeyboardInterrupt:
print("\n程序已被用户中断")
except Exception as e:
print(f"\n发生错误: {e}")
finally:
print("演示完成")
四、MCP 的未来畅想
五、总结
Spark AI 官网:https://aispark.alibaba-inc.com/
https://www.anthropic.com/news/claude-3-7-sonnet
https://www.anthropic.com/claude/sonnet#customer-stories
https://assets.anthropic.com/m/785e231869ea8b3b/original/claude-3-7-sonnet-system-card.pdf
https://modelcontextprotocol.io/clients
https://github.com/modelcontextprotocol/python-sdk
mcp.so:社区驱动的平台,包含 1584 个服务器,适合发现和分享。
glama.ai/mcp/servers:列出 872 个开源 MCP 服务器,提供详细信息。
portkey.ai/mcp-servers:列出 42 个 MCP 服务器,专注于开源领域。
构建高性能秒杀系统
秒杀活动因其高流量和用户参与度,已成为电商平台的重要营销方式。本方案详细介绍如何利用阿里云产品构建高性能秒杀系统,以实现高并发处理,确保系统稳定和快速响应,从而为用户提供流畅的抢购体验。
点击阅读原文查看详情。
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费场景POC验证,效果验证后签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2025-03-23
一文读懂MCP:助力大模型接入合规“四肢”
2025-03-23
如何利用MCP工具,打造自己的专属Manus
2025-03-23
欧洲新秀 vs. 谷歌出品:Mistral Small 3.1 与 Gemma 3 深度对比
2025-03-23
Anthropic引爆AI革命!MCP协议史诗级更新全解析
2025-03-23
马斯克 xAI 10 万 H100 超级集群 Colossus 浅析
2025-03-23
实测AI大模型:腾讯混元T1 vs DeepSeek 哪家强?
2025-03-23
a16z 洞察:MCP 重塑下一代 AI 应用的“通用接口”
2025-03-23
简单聊聊MCP、Computer Use,了解就好
2024-08-13
2024-06-13
2024-08-21
2024-09-23
2024-07-31
2024-05-28
2024-08-04
2024-04-26
2024-07-09
2024-09-17
2025-03-23
2025-03-22
2025-03-22
2025-03-22
2025-03-22
2025-03-22
2025-03-21
2025-03-21