docs: merge MCP_README.md into main README with collapsible sections (#39)
- Consolidate all MCP client integration docs into single README - Replace simple client list with detailed collapsible sections - Add enhanced quick start with service verification steps - Include all tested configurations for Cursor, VSCode, MCP Inspector - Preserve all demo screenshots and configuration examples - Remove duplicate MCP_README.md file to reduce maintenance overhead 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
183
MCP_README.md
183
MCP_README.md
@@ -1,183 +0,0 @@
|
|||||||
# MCP 服务接入指南
|
|
||||||
|
|
||||||
本文档介绍如何在各种 AI 客户端中接入小红书 MCP 服务。
|
|
||||||
|
|
||||||
## 🚀 快速开始
|
|
||||||
|
|
||||||
### 1. 启动 MCP 服务
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 启动服务(默认无头模式)
|
|
||||||
go run .
|
|
||||||
|
|
||||||
# 或者有界面模式
|
|
||||||
go run . -headless=false
|
|
||||||
```
|
|
||||||
|
|
||||||
服务将运行在:`http://localhost:18060/mcp`
|
|
||||||
|
|
||||||
### 2. 验证服务状态
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 测试 MCP 连接
|
|
||||||
curl -X POST http://localhost:18060/mcp \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d '{"jsonrpc":"2.0","method":"initialize","params":{},"id":1}'
|
|
||||||
```
|
|
||||||
|
|
||||||
## 📱 客户端接入
|
|
||||||
|
|
||||||
### Claude Code CLI
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 添加 HTTP MCP 服务器
|
|
||||||
claude mcp add --transport http xiaohongshu-mcp http://localhost:18060/mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cursor
|
|
||||||
|
|
||||||
#### 配置文件的方式
|
|
||||||
|
|
||||||
创建或编辑 MCP 配置文件:
|
|
||||||
|
|
||||||
**项目级配置**(推荐):
|
|
||||||
在项目根目录创建 `.cursor/mcp.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"xiaohongshu-mcp": {
|
|
||||||
"url": "http://localhost:18060/mcp",
|
|
||||||
"description": "小红书内容发布服务 - MCP Streamable HTTP"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**全局配置**:
|
|
||||||
在用户目录创建 `~/.cursor/mcp.json` (同样内容)。
|
|
||||||
|
|
||||||
#### 使用步骤
|
|
||||||
|
|
||||||
1. 确保小红书 MCP 服务正在运行
|
|
||||||
2. 保存配置文件后,重启 Cursor
|
|
||||||
3. 在 Cursor 聊天中,工具应该自动可用
|
|
||||||
4. 可以通过聊天界面的 "Available Tools" 查看已连接的 MCP 工具
|
|
||||||
|
|
||||||
**Demo**
|
|
||||||
|
|
||||||
插件 MCP 接入:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
调用 MCP 工具:(以检查登录状态为例)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### VSCode
|
|
||||||
|
|
||||||
#### 方法一:使用命令面板配置
|
|
||||||
|
|
||||||
1. 按 `Ctrl/Cmd + Shift + P` 打开命令面板
|
|
||||||
2. 运行 `MCP: Add Server` 命令
|
|
||||||
3. 选择 `HTTP` 方式。
|
|
||||||
4. 输入地址: `http://localhost:18060/mcp`,或者修改成对应的 Server 地址。
|
|
||||||
5. 输入 MCP 名字: `xiaohongshu-mcp`。
|
|
||||||
|
|
||||||
#### 方法二:直接编辑配置文件
|
|
||||||
|
|
||||||
**工作区配置**(推荐):
|
|
||||||
在项目根目录创建 `.vscode/mcp.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"servers": {
|
|
||||||
"xiaohongshu-mcp": {
|
|
||||||
"url": "http://localhost:18060/mcp",
|
|
||||||
"type": "http"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"inputs": []
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**查看配置**:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
1. 确认运行状态。
|
|
||||||
2. 查看 `tools` 是否正确检测。
|
|
||||||
|
|
||||||
**Demo**
|
|
||||||
|
|
||||||
以搜索帖子内容为例:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### 通用 MCP Inspector(调试用)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 启动 MCP Inspector
|
|
||||||
npx @modelcontextprotocol/inspector
|
|
||||||
|
|
||||||
# 在浏览器中连接到:http://localhost:18060/mcp
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🛠️ 可用工具
|
|
||||||
|
|
||||||
连接成功后,可使用以下 MCP 工具:
|
|
||||||
|
|
||||||
- `check_login_status` - 检查小红书登录状态(无参数)
|
|
||||||
- `publish_content` - 发布图文内容到小红书(需要:title, content, 可选:images, video)
|
|
||||||
- `list_feeds` - 获取小红书首页推荐列表(无参数)
|
|
||||||
- `search_feeds` - 搜索小红书内容(需要:keyword)
|
|
||||||
|
|
||||||
## 📝 使用示例
|
|
||||||
|
|
||||||
### 检查登录状态
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "check_login_status",
|
|
||||||
"arguments": {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 发布内容
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "publish_content",
|
|
||||||
"arguments": {
|
|
||||||
"title": "标题",
|
|
||||||
"content": "内容描述",
|
|
||||||
"images": ["图片URL或本地路径"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 获取推荐列表
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "list_feeds",
|
|
||||||
"arguments": {}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### 搜索内容
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"name": "search_feeds",
|
|
||||||
"arguments": {
|
|
||||||
"keyword": "搜索关键词"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### MCP Inspector 测试
|
|
||||||
|
|
||||||
- 使用 MCP Inspector 测试连接:`npx @modelcontextprotocol/inspector`
|
|
||||||
- 测试 Ping Server 功能验证连接
|
|
||||||
- 检查 List Tools 是否返回 4 个工具
|
|
||||||
173
README.md
173
README.md
@@ -107,33 +107,180 @@ npx @modelcontextprotocol/inspector
|
|||||||
|
|
||||||
本服务支持标准的 Model Context Protocol (MCP),可以接入各种支持 MCP 的 AI 客户端。
|
本服务支持标准的 Model Context Protocol (MCP),可以接入各种支持 MCP 的 AI 客户端。
|
||||||
|
|
||||||
📖 **详细接入指南**:[MCP_README.md](./MCP_README.md)
|
|
||||||
|
|
||||||
### 2.1. 快速开始
|
### 2.1. 快速开始
|
||||||
|
|
||||||
|
#### 启动 MCP 服务
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 启动 MCP 服务
|
# 启动服务(默认无头模式)
|
||||||
go run .
|
go run .
|
||||||
|
|
||||||
# 使用 Claude Code CLI 接入
|
# 或者有界面模式
|
||||||
|
go run . -headless=false
|
||||||
|
```
|
||||||
|
|
||||||
|
服务将运行在:`http://localhost:18060/mcp`
|
||||||
|
|
||||||
|
#### 验证服务状态
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 测试 MCP 连接
|
||||||
|
curl -X POST http://localhost:18060/mcp \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"jsonrpc":"2.0","method":"initialize","params":{},"id":1}'
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Claude Code CLI 接入
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 添加 HTTP MCP 服务器
|
||||||
claude mcp add --transport http xiaohongshu-mcp http://localhost:18060/mcp
|
claude mcp add --transport http xiaohongshu-mcp http://localhost:18060/mcp
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2.2. 支持的客户端
|
### 2.2. 支持的客户端
|
||||||
|
|
||||||
- ✅ **Claude Code CLI** - 官方命令行工具
|
<details>
|
||||||
- ✅ **Claude Desktop** - 桌面应用
|
<summary><b>Claude Code CLI</b></summary>
|
||||||
- ✅ **Cursor** - AI 代码编辑器
|
|
||||||
- ✅ **VSCode** - 通过 MCP 扩展支持
|
官方命令行工具,已在上面快速开始部分展示:
|
||||||
- ✅ **MCP Inspector** - 调试工具
|
|
||||||
- ✅ 其他支持 HTTP MCP 的客户端
|
```bash
|
||||||
|
# 添加 HTTP MCP 服务器
|
||||||
|
claude mcp add --transport http xiaohongshu-mcp http://localhost:18060/mcp
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>Cursor</b></summary>
|
||||||
|
|
||||||
|
#### 配置文件的方式
|
||||||
|
|
||||||
|
创建或编辑 MCP 配置文件:
|
||||||
|
|
||||||
|
**项目级配置**(推荐):
|
||||||
|
在项目根目录创建 `.cursor/mcp.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"xiaohongshu-mcp": {
|
||||||
|
"url": "http://localhost:18060/mcp",
|
||||||
|
"description": "小红书内容发布服务 - MCP Streamable HTTP"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**全局配置**:
|
||||||
|
在用户目录创建 `~/.cursor/mcp.json` (同样内容)。
|
||||||
|
|
||||||
|
#### 使用步骤
|
||||||
|
|
||||||
|
1. 确保小红书 MCP 服务正在运行
|
||||||
|
2. 保存配置文件后,重启 Cursor
|
||||||
|
3. 在 Cursor 聊天中,工具应该自动可用
|
||||||
|
4. 可以通过聊天界面的 "Available Tools" 查看已连接的 MCP 工具
|
||||||
|
|
||||||
|
**Demo**
|
||||||
|
|
||||||
|
插件 MCP 接入:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
调用 MCP 工具:(以检查登录状态为例)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>VSCode</b></summary>
|
||||||
|
|
||||||
|
#### 方法一:使用命令面板配置
|
||||||
|
|
||||||
|
1. 按 `Ctrl/Cmd + Shift + P` 打开命令面板
|
||||||
|
2. 运行 `MCP: Add Server` 命令
|
||||||
|
3. 选择 `HTTP` 方式。
|
||||||
|
4. 输入地址: `http://localhost:18060/mcp`,或者修改成对应的 Server 地址。
|
||||||
|
5. 输入 MCP 名字: `xiaohongshu-mcp`。
|
||||||
|
|
||||||
|
#### 方法二:直接编辑配置文件
|
||||||
|
|
||||||
|
**工作区配置**(推荐):
|
||||||
|
在项目根目录创建 `.vscode/mcp.json`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"servers": {
|
||||||
|
"xiaohongshu-mcp": {
|
||||||
|
"url": "http://localhost:18060/mcp",
|
||||||
|
"type": "http"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inputs": []
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看配置**:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
1. 确认运行状态。
|
||||||
|
2. 查看 `tools` 是否正确检测。
|
||||||
|
|
||||||
|
**Demo**
|
||||||
|
|
||||||
|
以搜索帖子内容为例:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>MCP Inspector</b></summary>
|
||||||
|
|
||||||
|
调试工具,用于测试 MCP 连接:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 启动 MCP Inspector
|
||||||
|
npx @modelcontextprotocol/inspector
|
||||||
|
|
||||||
|
# 在浏览器中连接到:http://localhost:18060/mcp
|
||||||
|
```
|
||||||
|
|
||||||
|
使用步骤:
|
||||||
|
- 使用 MCP Inspector 测试连接
|
||||||
|
- 测试 Ping Server 功能验证连接
|
||||||
|
- 检查 List Tools 是否返回 4 个工具
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary><b>其他支持 HTTP MCP 的客户端</b></summary>
|
||||||
|
|
||||||
|
任何支持 HTTP MCP 协议的客户端都可以连接到:`http://localhost:18060/mcp`
|
||||||
|
|
||||||
|
基本配置模板:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "xiaohongshu-mcp",
|
||||||
|
"url": "http://localhost:18060/mcp",
|
||||||
|
"type": "http"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
### 2.3. 可用 MCP 工具
|
### 2.3. 可用 MCP 工具
|
||||||
|
|
||||||
- `check_login_status` - 检查登录状态
|
连接成功后,可使用以下 MCP 工具:
|
||||||
- `publish_content` - 发布图文内容
|
|
||||||
- `list_feeds` - 获取推荐列表
|
- `check_login_status` - 检查小红书登录状态(无参数)
|
||||||
- `search_feeds` - 搜索小红书内容(前提:用户已登录)
|
- `publish_content` - 发布图文内容到小红书(需要:title, content, 可选:images, video)
|
||||||
|
- `list_feeds` - 获取小红书首页推荐列表(无参数)
|
||||||
|
- `search_feeds` - 搜索小红书内容(需要:keyword)
|
||||||
|
|
||||||
### 2.4. 使用示例
|
### 2.4. 使用示例
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user