珍珠MCP服务器是一个模型上下文协议(MCP)服务器实现,它通过标准化接口公开珍珠(Pearl)的人工智能和专家服务。该服务器允许像Claude Desktop、Cursor等MCP客户端以及其他兼容MCP的应用程序与珍珠的高级人工智能助手和人类专家进行交互。
git clone https://github.com/Pearl-com/pearl_mcp_server.git
cd pearl_mcp_server
python -m venv .venv
source .venv/bin/activate # 在Windows上:.venv\Scripts\activate
pip install -e .
在src目录下创建一个.env
文件:
PEARL_API_KEY=your-api-key-here
可以使用标准输入输出(默认)或SSE传输方式启动服务器:
# 使用标准输入输出传输(默认)
pearl-mcp-server --api-key your-api-key
# 使用SSE传输并指定自定义端口
pearl-mcp-server --api-key your-api-key --transport sse --port 8000
珍珠在以下地址提供了一个托管的MCP服务器:
https://mcp.pearl.com/mcp
任何MCP客户端都可以直接使用该服务器,而无需在本地安装Python应用程序。
服务器提供以下工具:
ask_pearl_ai
question
:用户的查询内容。chat_history
(可选):之前的对话上下文。session_id
(可选):用于继续对话。ask_pearl_expert
ask_pearl_ai
相同。ask_expert
ask_pearl_ai
相同。get_conversation_status
session_id
。get_conversation_history
session_id
。珍珠的MCP服务器提供了广泛的专家类别。珍珠的API会根据您的查询上下文自动确定合适的专家类别,确保您能与最相关的专家取得联系。以下是主要的专家类别:
每个专家类别都可以通过ask_expert
或ask_pearl_expert
工具访问。您无需指定类别,只需描述您的问题,珍珠的人工智能将根据上下文自动将您的请求路由到最合适的专家类型。
要使用标准输入输出传输方式连接到本地MCP服务器,请在您的MCP客户端中添加以下配置:
{
"pearl-mcp-server": {
"type": "stdio",
"command": "pearl-mcp-server",
"args": ["--api-key", "your-api-key"],
"env": {
"PEARL_API_KEY": "Your Pearl Api Key"
}
}
}
有些MCP客户端不支持直接连接到远程MCP服务器。对于这些客户端,您可以使用mcp-remote
包作为桥梁:
{
"mcpServers": {
"pearl-remote": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.pearl.com/sse"
]
}
}
}
%APPDATA%\Claude\claude_desktop_config.json
~/Library/Application Support/Claude/claude_desktop_config.json
~/.cursor/mcp.json
~/.codeium/windsurf/mcp_config.json
@latest
"args": ["mcp-remote@latest", "https://mcp.pearl.com/sse"]
rm -rf ~/.mcp-auth
Get-Content "$env:APPDATA\Claude\Logs\mcp.log" -Wait -Tail 20
tail -n 20 -F ~/Library/Logs/Claude/mcp*.log
npx mcp-remote-client https://mcp.pearl.com/sse
import asyncio
from mcp.client.session import ClientSession
from mcp.client.stdio import StdioServerParameters, stdio_client
async def main():
# 对于标准输入输出传输
async with stdio_client(
StdioServerParameters(command="pearl-mcp-server", args=["--api-key", "your-api-key"])
) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
# 列出可用工具
tools = await session.list_tools()
print(tools)
# 调用珍珠人工智能
result = await session.call_tool(
"ask_pearl_ai",
{
"question": "What is MCP?",
"session_id": "optional-session-id"
}
)
print(result)
asyncio.run(main())
要获取使用此服务器的珍珠API密钥,请按以下步骤操作:
请妥善保管您的API密钥,切勿将其提交到版本控制系统。
本项目采用Apache License 2.0许可 - 详情请参阅LICENSE文件。