Cursor
Cursor 是一个 AI 驱动的代码编辑器。Protocol Launcher 允许您生成深度链接,以便在 Cursor 中自动配置 MCP 服务器。
使用
提供两种使用方式:
- 按需加载(通过子路径导入),支持 Tree Shaking,体积更小。
- 全量导入(从根包导入),使用简单,但会包含所有应用模块。
生产环境建议使用按需加载以减小体积;快速脚本或演示可选择全量导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
安装 STDIO MCP 服务
ts
import { installMCP } from 'protocol-launcher/cursor'
const url = installMCP({
name: 'server-everything',
type: 'stdio',
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-everything'],
})安装 Streamable HTTP MCP 服务
ts
import { installMCP } from 'protocol-launcher/cursor'
const url = installMCP({
name: '企查查企业信息 MCP',
type: 'streamable_http',
url: 'https://mcp.qcc.com/basic/stream',
headers: {
Authorization: 'MjMmbGnP0gwLcbYe7MCr4FCuIA9dHQ9277zoO409EGZOdL3K',
},
})安装 SSE MCP 服务
ts
import { installMCP } from 'protocol-launcher/cursor'
const url = installMCP({
name: '企查查风险信息 MCP',
type: 'sse',
url: 'https://mcp.qcc.com/basic/sse',
headers: {
Authorization: 'MjMmbGnP0gwLcbYe7MCr4FCuIA9dHQ9277zoO409EGZOdL3K',
},
})打开文件
ts
import { openFile } from 'protocol-launcher/cursor'
const url = openFile({
path: '/etc/hosts',
line: 1,
column: 2,
openInNewWindow: true,
})打开文件夹
ts
import { openFolder } from 'protocol-launcher/cursor'
const url = openFolder({
path: '/etc',
openInNewWindow: true,
})打开设置
ts
import { openSettings } from 'protocol-launcher/cursor'
const url = openSettings()