feat: 初始版本 - ttychart-mcp 终端图表 MCP 服务
- 支持三种图表: 折线图、柱状图、散点图 - MCP 协议支持 (stdio + HTTP) - 完整的单元测试和集成测试 - Docker 支持 - Makefile 构建脚本
This commit is contained in:
130
README.md
Normal file
130
README.md
Normal file
@@ -0,0 +1,130 @@
|
||||
# ttychart-mcp
|
||||
|
||||
终端图表 MCP 服务 - 在终端绘制各种 ASCII 图表
|
||||
|
||||
## 功能
|
||||
|
||||
| 工具 | 描述 | 示例 |
|
||||
|------|------|------|
|
||||
| plot_line | 折线图,用于展示数据趋势 | 天气温度、股票走势 |
|
||||
| plot_bar | 柱状图,用于分类数据比较 | Excel 数据、统计 |
|
||||
| plot_scatter | 散点图,用于数据相关性 | 相关性分析 |
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 安装
|
||||
|
||||
```bash
|
||||
# 克隆仓库
|
||||
git clone hub.gaomia.site/titor/ttychart-mcp
|
||||
cd ttychart-mcp
|
||||
|
||||
# 构建
|
||||
make build
|
||||
|
||||
# 或直接运行
|
||||
go run .
|
||||
```
|
||||
|
||||
### 使用 Docker
|
||||
|
||||
```bash
|
||||
# 构建镜像
|
||||
make docker
|
||||
|
||||
# 运行容器
|
||||
make docker-run
|
||||
```
|
||||
|
||||
## MCP 客户端配置
|
||||
|
||||
### picoclaw 配置
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"ttychart": {
|
||||
"command": "docker",
|
||||
"args": ["run", "--rm", "-i", "ttychart-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Claude Code 配置
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"ttychart": {
|
||||
"command": "docker",
|
||||
"args": ["run", "--rm", "-i", "ttychart-mcp"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
|
||||
### 折线图
|
||||
|
||||
```
|
||||
调用 plot_line 工具:
|
||||
- data: [22, 24, 21, 25, 23, 26, 28]
|
||||
- title: "未来7天温度"
|
||||
- color: "red"
|
||||
```
|
||||
|
||||
### 柱状图
|
||||
|
||||
```
|
||||
调用 plot_bar 工具:
|
||||
- data: "苹果:100,香蕉:80,橙子:120"
|
||||
- title: "水果销量"
|
||||
- color: "green"
|
||||
```
|
||||
|
||||
### 散点图
|
||||
|
||||
```
|
||||
调用 plot_scatter 工具:
|
||||
- data: "1,5 2,8 3,3 4,6"
|
||||
- title: "成绩分布"
|
||||
```
|
||||
|
||||
## 环境变量
|
||||
|
||||
| 变量 | 描述 | 默认值 |
|
||||
|------|------|-------|
|
||||
| HTTP_PORT | HTTP 服务端口 | 3100 |
|
||||
|
||||
## 运行模式
|
||||
|
||||
```bash
|
||||
# stdio 模式 (默认)
|
||||
./ttychart-mcp --stdio
|
||||
|
||||
# HTTP 模式
|
||||
./ttychart-mcp --port 3100
|
||||
|
||||
# 使用环境变量
|
||||
HTTP_PORT=3100 ./ttychart-mcp
|
||||
```
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
ttychart-mcp/
|
||||
├── main.go # 入口
|
||||
├── tools/
|
||||
│ ├── provider.go # MCP 工具定义
|
||||
│ └── charts/ # 图表实现
|
||||
├── go.mod
|
||||
├── Makefile
|
||||
├── Dockerfile
|
||||
└── ttychart-mcp # 二进制
|
||||
```
|
||||
|
||||
## license
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user