cnks 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,148 @@
1
+ # Cursor中连接知网搜索MCP服务器指南
2
+
3
+ 本指南提供在Cursor中成功连接到知网搜索MCP服务器的详细步骤。
4
+
5
+ ## 准备工作
6
+
7
+ 1. 确保已正确安装Python 3.13或更高版本
8
+ 2. 安装最新版本的MCP:
9
+ ```bash
10
+ uv add "mcp[cli]" --upgrade
11
+ ```
12
+ 3. 确保Chrome浏览器已安装
13
+ 4. 安装Playwright(推荐):
14
+ ```bash
15
+ # 安装playwright库
16
+ uv add playwright
17
+
18
+ # 安装playwright浏览器
19
+ playwright install
20
+ ```
21
+
22
+ ## 启动服务器
23
+
24
+ 在终端中运行以下命令启动服务器:
25
+
26
+ ```bash
27
+ # 进入项目目录
28
+ cd 你的项目路径/kwds2rslt/cnks
29
+
30
+ # 启动服务器
31
+ python -m cnks
32
+ ```
33
+
34
+ 如果一切正常,你应该看到:
35
+ ```
36
+ 启动知网搜索FastMCP服务器...
37
+ ```
38
+
39
+ 保持此终端窗口开启。
40
+
41
+ ## 在Cursor中连接
42
+
43
+ 1. 打开Cursor
44
+ 2. 点击右下角的"Claude"图标
45
+ 3. 选择"Connect to MCP Server"
46
+ 4. 选择"Subprocess (stdio)"连接方式
47
+ 5. 在命令输入框中输入:
48
+ ```
49
+ python -m cnks
50
+ ```
51
+ 6. 点击"Connect"
52
+
53
+ 成功连接后,你会看到Claude提示已连接到知网搜索服务器。
54
+
55
+ ## 测试连接
56
+
57
+ 连接成功后,尝试以下指令测试服务器功能:
58
+
59
+ ```
60
+ 请打开中国知网搜索页面
61
+ ```
62
+
63
+ 如果Chrome浏览器成功打开中国知网页面,则表示连接成功。
64
+
65
+ 然后测试搜索功能:
66
+
67
+ ```
68
+ 请在知网搜索"预印本"相关论文
69
+ ```
70
+
71
+ 如果安装了Playwright,应该会看到浏览器自动在搜索框中输入"预印本"并执行搜索。
72
+ 如果没有安装Playwright,只会打开知网页面而不会自动输入搜索词。
73
+
74
+ ## 故障排除
75
+
76
+ 如果无法连接,请尝试以下步骤:
77
+
78
+ ### 1. 检查服务器状态
79
+
80
+ 确保服务器正在运行且没有错误消息。尝试重启服务器:
81
+
82
+ ```bash
83
+ # 按Ctrl+C终止当前服务器
84
+ # 然后重新启动
85
+ python -m cnks
86
+ ```
87
+
88
+ ### 2. 使用开发模式测试
89
+
90
+ 使用MCP开发模式直接测试服务器是否正常工作:
91
+
92
+ ```bash
93
+ mcp dev src/cnks/server.py
94
+ ```
95
+
96
+ 如果开发模式可以正常工作但Cursor无法连接,则问题可能在连接配置上。
97
+
98
+ ### 3. 检查Chrome路径
99
+
100
+ 如果服务器报告找不到Chrome,设置环境变量指定Chrome路径:
101
+
102
+ ```bash
103
+ # Windows
104
+ set CHROME_PATH="C:\你的Chrome路径\chrome.exe"
105
+
106
+ # macOS/Linux
107
+ export CHROME_PATH="/path/to/chrome"
108
+ ```
109
+
110
+ ### 4. Playwright问题
111
+
112
+ 如果使用Playwright时遇到问题:
113
+
114
+ ```bash
115
+ # 验证playwright是否已安装
116
+ uv pip show playwright
117
+
118
+ # 重新安装
119
+ uv add playwright --upgrade
120
+
121
+ # 安装浏览器
122
+ playwright install
123
+ ```
124
+
125
+ 如果安装浏览器时遇到权限问题,可能需要以管理员身份运行命令。
126
+
127
+ ### 5. 使用直接路径
128
+
129
+ 如果连接依然失败,尝试在Cursor中提供服务器脚本的完整路径:
130
+
131
+ ```
132
+ python C:/你的项目完整路径/kwds2rslt/cnks/src/cnks/server.py
133
+ ```
134
+
135
+ ### 6. 检查防火墙和安全软件
136
+
137
+ 确保没有防火墙或安全软件阻止进程间通信。
138
+
139
+ ### 7. 更新MCP和Cursor
140
+
141
+ 确保使用最新版本的MCP库和Cursor应用。
142
+
143
+ ## 获取更多帮助
144
+
145
+ 如果以上方法都无法解决问题,请:
146
+
147
+ 1. 查看完整的错误消息和服务器日志
148
+ 2. 在GitHub上提交问题,附上完整的错误信息和环境详情