Initial commit: FunStat MCP Server Go implementation

- Telegram integration for customer statistics
- MCP server implementation with rate limiting
- Cache system for performance optimization
- Multi-language support
- RESTful API endpoints

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
你的用户名
2025-11-04 15:28:06 +08:00
commit 8d1ce4598d
18 changed files with 1940 additions and 0 deletions

124
internal/app/tools.go Normal file
View File

@@ -0,0 +1,124 @@
package app
type ToolDefinition struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema map[string]any `json:"inputSchema"`
}
func ToolDefinitions() []ToolDefinition {
return []ToolDefinition{
{
Name: "funstat_search",
Description: "搜索 Telegram 群组、频道。支持关键词搜索,返回相关的群组列表",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{
"query": map[string]any{
"type": "string",
"description": "搜索关键词,例如: 'python', '区块链', 'AI'",
},
},
"required": []string{"query"},
},
},
{
Name: "funstat_topchat",
Description: "获取热门群组/频道列表,按成员数或活跃度排序",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{
"category": map[string]any{
"type": "string",
"description": "分类筛选(可选),例如: 'tech', 'crypto', 'news'",
},
},
},
},
{
Name: "funstat_text",
Description: "通过消息文本搜索,查找包含特定文本的消息和来源群组",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{
"text": map[string]any{
"type": "string",
"description": "要搜索的文本内容",
},
},
"required": []string{"text"},
},
},
{
Name: "funstat_human",
Description: "通过姓名搜索,查找包含特定用户的群组和消息",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{
"name": map[string]any{
"type": "string",
"description": "用户姓名",
},
},
"required": []string{"name"},
},
},
{
Name: "funstat_user_info",
Description: "查询用户详细信息支持通过用户名、用户ID、联系人等方式查询",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{
"identifier": map[string]any{
"type": "string",
"description": "用户标识: 用户名(@username)、用户ID、或手机号",
},
},
"required": []string{"identifier"},
},
},
{
Name: "funstat_user_messages",
Description: "获取指定用户的历史消息列表,并自动翻页汇总",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{
"identifier": map[string]any{
"type": "string",
"description": "用户标识: 用户名(@username) 或用户ID",
},
"max_pages": map[string]any{
"type": "integer",
"minimum": 1,
"description": "可选,限制抓取的最大页数",
},
},
"required": []string{"identifier"},
},
},
{
Name: "funstat_balance",
Description: "查询当前账号的积分余额和使用统计",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{},
},
},
{
Name: "funstat_menu",
Description: "显示 funstat BOT 的主菜单和所有可用功能",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{},
},
},
{
Name: "funstat_start",
Description: "获取 funstat BOT 的欢迎信息和使用说明",
InputSchema: map[string]any{
"type": "object",
"properties": map[string]any{},
},
},
}
}