sale-agent-cli
sale-agent 平台开放接口的 CLI + MCP Server 客户端。同一个包,两种用法:
- CLI:直接在终端里用
sale-agent <command>。 - MCP Server:
sale-agent mcp serve以 stdio 方式启动,配置进 Claude Code / Codex 等支持 MCP 的 AI Agent 客户端里,让它调用平台的客户/待办/知识库/问答能力。
两者背后走同一套 /open/v1/* 网关接口、同一份凭证。
安装
发布到 PyPI 后(见文末「发布」),终端用户直接:
pipx install sale-agent-cli
# 或不装到全局环境、临时跑一次:
uvx sale-agent-cli --help
推荐 pipx(每个 CLI 独立虚拟环境,不污染系统 Python,装完 sale-agent 命令自动进 PATH)。
开发这个仓库本身则用可编辑安装:
pip install -e .
Windows 终端如果看到中文输出乱码(不影响 MCP 客户端使用,只影响人眼直接看终端), 设置
set PYTHONUTF8=1或chcp 65001后再运行即可。
登录
Phase 1 暂不支持浏览器登录,需要先拿到一个开放平台 Token(sk- 开头),然后:
sale-agent auth login --api-key sk-xxxxxxxx
sale-agent auth whoami
也可以不落盘,直接用环境变量(适合 CI / 被其他 Agent 当子进程拉起的场景):
export SALE_AGENT_API_KEY=sk-xxxxxxxx
export SALE_AGENT_BASE_URL=http://127.0.0.1:8787/open/v1 # 默认值,按需覆盖
CLI 用法
sale-agent customer list --keyword 张三
sale-agent customer get 123
sale-agent customer create --name "某某公司" --phone 138xxxx
sale-agent todo list --pending
sale-agent todo add "跟进某某客户" --due "2026-09-05 18:00:00"
sale-agent todo done 456
sale-agent knowledge search "退保流程"
sale-agent ask "帮我看看本周有哪些待办逾期了"
所有命令都支持 --json 输出机器可读结构,供脚本/其他 Agent 解析。
作为 MCP Server 使用
{
"mcpServers": {
"sale-agent": {
"command": "sale-agent",
"args": ["mcp", "serve"],
"env": {
"SALE_AGENT_API_KEY": "sk-xxxxxxxx",
"SALE_AGENT_BASE_URL": "http://127.0.0.1:8787/open/v1"
}
}
}
}
启动时会先用 Token 调用一次 /open/v1/me/info 自检,Token 无效会直接报错退出,不会注册工具。
Phase 1 固定注册 7 个工具(search_customers / get_customer / create_customer / list_todos /
create_todo / complete_todo / search_knowledge),不按 Token 的 scope 动态过滤——
如果 Token 缺少对应权限,调用对应工具时网关会返回 403,工具的返回文本里会带上缺失的 scope 名。
(ask_ivy 之前有过,Phase1 后期按需求下掉了;sale-agent ask 这条 CLI 命令还在,只是不走 MCP 了。)
发布(维护者)
python -m pip install --upgrade build twine
python -m build # 产出 dist/*.whl + dist/*.tar.gz
python -m twine check dist/* # 校验元数据/README能否被PyPI正常渲染
python -m twine upload dist/* # 需要 PyPI 账号 + API token(https://pypi.org/manage/account/token/)
发新版本前记得改 pyproject.toml 里的 version(PyPI 不允许覆盖已发布过的版本号)。
Metadata
Release files for sale-agent-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sale_agent_cli-0.1.0.tar.gz | 10.8 kB | Without provenance | Details for sale_agent_cli-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sale_agent_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sale_agent_cli-0.1.0-py3-none-any.whl |
Total release size: 22.9 kB
Release files / sale_agent_cli-0.1.0.tar.gz
| Download URL | sale_agent_cli-0.1.0.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7f52345581a83111cecdba17aa66bfa4689a87e8c7c63f7bb98cac5448539654
|
|
BLAKE2b-256 checksum How to use checksums |
a25b387bb27d54b1f1805139e181fb6d1588d0ca5e9ede4b51a952c84c584667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / sale_agent_cli-0.1.0-py3-none-any.whl
| Download URL | sale_agent_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
364989d7d3a380b6a9da766932b25bf2b6ab06a57f8991002a03fd6736fe53ab
|
|
BLAKE2b-256 checksum How to use checksums |
b3750b16fd1064310783a9ec1524c7ca428e241745906b7c4e1961cdc64155dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for sale-agent-cli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.