跳到主要内容
Supermarket
返回能力市场
MCP Server
programming
MIT

python-sdk

The official Python SDK for Model Context Protocol servers and clients

modelcontextprotocolmodelcontextprotocol
90/ 100

公开评测 · 综合采用结论

证据充分,整体质量与安全表现优秀

查看评测依据 评测我的项目基于公开项目证据,非安全认证或安装推荐
24.4kstars
4.0kforks
最近更新 21小时前
评测生成时间(北京时间)
本报告引擎
v3.9.1
当前引擎
v3.16.0

本报告与当前引擎使用不同规则;原分数不会自动更新,不同版本的分数不宜直接对比。

重新评测此项目

进入后确认来源与额度,提交才会创建任务。

Evaluation report

综合采用结论

90
A
满分 100
值得推荐低风险
决策摘要

证据充分,整体质量与安全表现优秀

84%
高置信度
92
文档
100
安全
82
质量
100
活跃
70
采用
  • 基础评测完成+25/25确定性评分与静态安全扫描已完成
  • README 有效证据+13/255,142 个去重后的有效字符
  • 独立证据来源+16/204 类非重复证据,重复文件不叠加
  • 仓库元数据+10/10已取得仓库状态与采用数据
  • 活跃记录+5/5已取得最近提交时间
  • AI 复核+15/15已完成结构化 AI 证据复核
How it works · 时序图

MCP客户端与服务器交互流程

README展示了客户端通过HTTP调用服务器工具的过程,存在请求和响应关系。

AI 提取 · 证据约束

左右滑动查看完整图示

MCP客户端与服务器交互流程README展示了客户端通过HTTP调用服务器工具的过程,存在请求和响应关系。客户端发起请求服务器处理请求call_tool('add', {a:1,b:2})返回结果 {'result':3}
图示依据
  • • 客户端示例:async with Client("http://localhost:8000/mcp") as client:
  • • 调用:await client.call_tool("add", {"a": 1, "b": 2})
  • • 响应:print(result.structured_content) # {'result': 3}
五维表现
官方Python SDK,解决构建MCP服务器和客户端的明确需求,示例清晰,安装简单,文档完善。最大缺口是错误处理和排障信息缺失。
质量证据
  • 安装命令:uv add "mcp[cli]" 或 pip install "mcp[cli]"
  • 服务器示例:@mcp.tool() 和 @mcp.resource() 定义工具和资源
  • 客户端示例:async with Client("http://localhost:8000/mcp") 调用工具
  • 传输方式:stdio、Streamable HTTP、SSE
  • 文档链接:https://py.sdk.modelcontextprotocol.io/ 包含Get started、API reference等
采用建议
优势
  • 问题与用途描述
  • 有效 README
  • 安装或接入步骤
  • 可执行示例
  • 未发现已知高风险模式
关注点
  • 缺少错误处理或排障
  • 缺少错误处理和排障章节
  • 未明确说明权限和数据边界
  • 未提供安全默认值或安全配置说明
  • 未提及失败处理机制
适合

构建MCP服务器和客户端的Python开发者、需要快速原型验证的开发者、需要标准传输方式(stdio、HTTP)的项目、希望利用类型提示自动生成JSON Schema的场景

不建议直接用于

需要详细错误处理指南的开发者、需要安全配置或权限边界文档的场景

也有自己的公开项目?先看完证据,再用当前规则生成独立报告。

评测我的项目 →
文档证据
92/100
问题与用途描述10 分
有效 README12 分
安装或接入步骤14 分
可执行示例16 分
输入、参数或工具说明11 分
输出或结果说明9 分
限制、权限或边界12 分
错误处理或排障8 分
许可证信息5 分
结构化章节3 分
安全证据
低风险
未发现已知高风险模式

静态扫描不是安全保证,生产接入前仍应人工复核权限和数据边界。

优先改进清单
  1. 01补充错误处理或排障
方法、证据与局限展开
数据来源

GitHub Repository API

扫描范围

4 个文件 · 9,503 字符

评测引擎

v3.9.1 · AI 复核已启用(deepseek-chat)

局限
  • 静态评测不会安装或执行项目代码
  • 安全扫描基于高信号文件与已知模式,不能替代人工审计
  • 流行度只反映采用程度,不代表安全或工程质量

30 天热度趋势

README

MCP Python SDK

Python implementation of the Model Context Protocol (MCP)

PyPI MIT licensed Python Version Documentation Protocol Specification

[!NOTE] This is v2 of the MCP Python SDK, the current stable release line. It is a major rework of the SDK, both to support the 2026-07-28 MCP specification (and every earlier revision) and to fix long-standing architectural issues. Coming from v1? See What's new in v2 for the tour of what changed and the migration guide for every breaking change.

Not ready to migrate? v1.x lives on the v1.x branch, continues to receive critical bug fixes and security patches, and is documented at https://py.sdk.modelcontextprotocol.io/v1/. Since pip install mcp now installs 2.x, keep a <2 upper bound on your requirement (for example mcp>=1.28,<2) until you've migrated.

Something rough, confusing, or broken? Open an issue or find us in #python-sdk-dev on the MCP Contributors Discord.

Documentation

The documentation lives at https://py.sdk.modelcontextprotocol.io/.

It has a Get started guide, What's new in v2, the API reference, and the migration guide.

What is MCP?

The Model Context Protocol lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. Think of it like a web API, but designed for LLM interactions. With this SDK you can:

  • Build MCP servers that expose tools, resources, and prompts to any MCP host
  • Build MCP clients that connect to any MCP server
  • Speak every standard transport: stdio, Streamable HTTP, and SSE

Requirements

Python 3.10+.

Installation

uv add "mcp[cli]"      # or: pip install "mcp[cli]"

The cli extra adds the mcp command-line tool (mcp dev, mcp run, mcp install) on top of the SDK; install plain mcp if you don't need it. For one-off commands, uv run --with "mcp[cli]" mcp ... works without a project.

A server in 15 lines

Create a server.py:

from mcp.server import MCPServer

mcp = MCPServer("Demo")


@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b


@mcp.resource("greeting://{name}")
def greeting(name: str) -> str:
    """Greet someone by name."""
    return f"Hello, {name}!"

Full example: docs_src/index/tutorial001.py

That's a complete MCP server: one tool, one templated resource. Open it in the MCP Inspector:

uv run mcp dev server.py

Call add with a=1, b=2 and you get 3 back.

Notice what you did not write: no JSON Schema (a: int, b: int is the schema), no request parsing, no validation code, no protocol handling. Two type-hinted Python functions and a docstring.

Get started takes it from here.

A client in 10 lines

The same package is a full MCP client. Serve server.py over HTTP:

uv run mcp run server.py --transport streamable-http

then point a Client at it:

import asyncio

from mcp import Client


async def main() -> None:
    async with Client("http://localhost:8000/mcp") as client:
        result = await client.call_tool("add", {"a": 1, "b": 2})
        print(result.structured_content)  # {'result': 3}


asyncio.run(main())

A URL means Streamable HTTP, the transport you deploy. Client can also launch a local server as a stdio subprocess or take any custom transport; Clients has the rest.

Contributing

We are passionate about supporting contributors of all levels of experience and would love to see you get involved in the project. See the contributing guide to get started.

License

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