使用说明
MCP活动服务器
Spring Boot MCP(模型上下文协议)服务器,为Claude AI集成提供保险营销活动管理功能。
特性
- 受众定位:基于人工智能的保险营销受众细分建议
- 活动内容:针对不同保险产品和渠道的个性化内容推荐
- Claude Inspector集成:支持Claude Inspector工具查询
- MCP协议:支持WebSocket的完整MCP服务器实现
- REST API:用于直接集成的其他HTTP端点
快速开始
先决条件
- Java 17或更高版本
- Maven 3.6或更高版本
安装
- 克隆存储库:
git clone <repository-url>
cd Mcp_Campaign
- 构建项目:
# If you have corporate Maven repository issues, use the startup script
./start.sh
# Or manually with custom settings
mvn clean compile --settings temp-settings.xml
- 运行应用程序:
mvn spring-boot:run
服务器将在端口8080上启动,WebSocket端点位于 ws://localhost:8080/api/mcp
企业存储库问题
如果您遇到企业Maven存储库连接问题,请创建一个临时设置文件:
# Create temp-settings.xml with Maven Central only
cat > temp-settings.xml << EOF
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<mirrors>
<mirror>
<id>central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
EOF
# Then build with custom settings
mvn clean compile --settings temp-settings.xml
MCP工具
服务器为Claude集成提供了以下MCP工具:
1.受众定位
根据用户需求提供受众定位标准建议。
输入参数:
requirements(必填):目标受众的用户需求insurance_type(可选):保险类型(人寿、健康、汽车、财产等)campaign_objective(可选):活动目标(获取、保留、追加销售等)
示例用法:
{
"name": "audience_targeting",
"arguments": {
"requirements": "Target young professionals aged 25-35 who are interested in life insurance",
"insurance_type": "life_insurance",
"campaign_objective": "acquisition"
}
}
2.活动_意向_表彰
为保险营销推荐个性化的活动内容。
输入参数:
audience_criteria(必填):目标受众标准对象insurance_type(必填):保险产品类型channel(可选):营销渠道(电子邮件、短信、社交媒体等)campaign_goal(可选):活动目标(意识、转化、保留等)
示例用法:
{
"name": "campaign_content_recommendation",
"arguments": {
"audience_criteria": {
"minAge": 25,
"maxAge": 35,
"incomeRange": ["middle_income", "high_income"]
},
"insurance_type": "life_insurance",
"channel": "email",
"campaign_goal": "conversion"
}
}
3.inspector_query
执行Claude Inspector工具集成的查询。
输入参数:
query(必填):查询Claude Inspector工具
示例用法:
{
"name": "inspector_query",
"arguments": {
"query": "Analyze the effectiveness of recent insurance marketing campaigns"
}
}
REST API端点
健康检查
GET /api/campaigns/health
列出可用工具
GET /api/campaigns/tools
观众推荐
POST /api/campaigns/audience/recommend
Content-Type: application/json
{
"requirements": "Target young professionals for life insurance",
"insurance_type": "life_insurance",
"campaign_objective": "acquisition"
}
内容推荐
POST /api/campaigns/content/recommend
Content-Type: application/json
{
"audience_criteria": {
"minAge": 25,
"maxAge": 35,
"incomeRange": ["middle_income"]
},
"insurance_type": "life_insurance",
"channel": "email",
"campaign_goal": "conversion"
}
人工智能集成
Cline(VS代码)集成
快速设置:
./setup_cline.sh
手动配置:
- 在
~/.cline/config.json中添加配置:
{
"mcpServers": {
"insurance-campaign": {
"command": "java",
"args": ["-jar", "/path/to/mcp-campaign-server-1.0.0.jar"],
"env": {"SERVER_PORT": "8080"}
}
}
}
- 重启VS Code
- 在Cline中开始对话并使用工具
使用示例:
请帮我分析一下针对年轻专业人士的人寿保险营销活动的人群定位策略
Claude桌面集成
- 将MCP服务器配置添加到您的Claude Desktop设置中:
{
"mcpServers": {
"insurance-campaign": {
"command": "java",
"args": ["-jar", "path/to/mcp-campaign-server.jar"],
"env": {
"SERVER_PORT": "8080"
}
}
}
}
WebSocket连接
通过WebSocket连接到MCP服务器:
ws://localhost:8080/api/mcp
配置
该应用程序可以通过以下方式配置 application.yml:
server:
port: 8080
mcp:
server:
name: "Insurance Campaign MCP Server"
version: "1.0.0"
protocol-version: "2024-11-05"
websocket:
path: "/mcp"
allowed-origins: "*"
发展
项目结构
src/main/java/com/insurance/mcp/
├── McpCampaignServerApplication.java # Main application class
├── config/
│ └── WebSocketConfig.java # WebSocket configuration
├── controller/
│ └── CampaignController.java # REST endpoints
├── handler/
│ └── McpWebSocketHandler.java # MCP WebSocket handler
├── model/
│ ├── McpRequest.java # MCP request model
│ ├── McpResponse.java # MCP response model
│ ├── McpTool.java # MCP tool model
│ └── campaign/
│ ├── AudienceCriteria.java # Audience targeting model
│ └── CampaignContent.java # Campaign content model
└── service/
├── McpToolService.java # MCP tool service
└── campaign/
├── AudienceTargetingService.java # Audience targeting logic
└── CampaignContentService.java # Content recommendation logic
建造和测试
# Run tests
mvn test
# Build JAR
mvn clean package
# Run with custom profile
mvn spring-boot:run -Dspring-boot.run.profiles=dev
支持的保险类型
- 人寿保险
- 健康保险
- 汽车保险
- 财产保险
- 旅游保险
支持的营销渠道
- 电子邮件
- 短信
- 社交媒体
- 推送通知
- 直邮
许可证
该项目根据MIT许可证获得许可。
