使用说明
MCP模板服务器
一个模板服务器,实现了具有OpenAI、Anthropic和EnrichB2B集成的模型上下文协议(MCP)。
设置
- 创建虚拟环境:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- 安装依赖项:
pip install -r requirements.txt
- 设置环境变量:
cp .env.example .env
# Edit .env with your API keys and configuration
运行服务器
开发模式:
python server.py
或使用MCP CLI:
mcp dev server.py
特性
- OpenAI GPT-4集成
- 人与克劳德的融合
- 丰富B2B领英数据集成
- FastAPI和Uvicorn服务器
- 环境配置
- 示例资源和工具
- 结构化项目布局
项目结构
.
├── .env.example # Template for environment variables
├── .gitignore # Git ignore rules
├── README.md # This file
├── requirements.txt # Python dependencies
├── enrichb2b.py # EnrichB2B API client
└── server.py # MCP server implementation
用法
- 启动服务器
- 使用任何MCP客户端连接
- 使用提供的工具和资源:
config://app-获取服务器配置get_profile_details-获取LinkedIn个人资料信息get_contact_activities-获取LinkedIn用户最近的活动和帖子gpt4_completion-使用GPT-4生成文本claude_completion-使用Claude生成文本analysis_prompt-文本分析模板
丰富B2B工具
get_file_details
获取有关LinkedIn个人资料的详细信息:
result = await get_profile_details(
linkedin_url="https://www.linkedin.com/in/username",
include_company_details=True,
include_followers_count=True
)
get_contact_activities
从LinkedIn个人资料中获取最近的活动和帖子:
result = await get_contact_activities(
linkedin_url="https://www.linkedin.com/in/username",
pages=1, # Number of pages (1-50)
comments_per_post=1, # Comments per post (0-50)
likes_per_post=None # Likes per post (0-50)
)
发展
要添加新功能,请执行以下操作:
- 使用添加新工具
@mcp.tool()装饰器 - 使用添加新资源
@mcp.resource()装饰器 - 使用添加新提示
@mcp.prompt()装饰器
许可证
麻省理工学院