使用cline集成aws的mcp服务和搜索功能

参考资料

在vscode中安装cline后,为了避免高额模型费用和兼容性问题,通过litellm封装了自部署模型,并配置在cline中

复制代码
http://litellm.example.com:4000

TLDR

日常万能配置如下

json 复制代码
{
  "mcpServers": {
    "awslabs.aws-api-mcp-server": {
      "disabled": true,
      "timeout": 60,
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--interactive",
        "--env",
        "AWS_REGION=cn-north-1",
        "--volume",
        "/home/ec2-user/.aws:/app/.aws",
        "public.ecr.aws/awslabs-mcp/awslabs/aws-api-mcp-server:latest"
      ],
      "env": {}
    },
    "awslabs.aws-documentation-mcp-server": {
      "autoApprove": [
        "read_documentation",
        "search_documentation",
        "recommend",
        "get_available_services"
      ],
      "disabled": true,
      "timeout": 60,
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--interactive",
        "--env",
        "FASTMCP_LOG_LEVEL=ERROR",
        "--env",
        "AWS_DOCUMENTATION_PARTITION=aws-cn",
        "mcp/aws-documentation:latest"
      ],
      "env": {}
    },
    "aws-knowledge-mcp-server": {
      "autoApprove": [
        "aws___search_documentation",
        "aws___read_documentation",
        "aws___recommend"
      ],
      "disabled": true,
      "timeout": 60,
      "type": "stdio",
      "command": "uvx",
      "args": [
        "fastmcp",
        "run",
        "https://knowledge-mcp.global.api.aws"
      ]
    },
    "github.com/tavily-ai/tavily-mcp": {
      "autoApprove": [],
      "disabled": true,
      "timeout": 60,
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "tavily-mcp@latest"
      ],
      "env": {
        "TAVILY_API_KEY": "tvly-dev-ecexxxxxxxxxxK"
      }
    },
    "web-search": {
      "timeout": 60,
      "type": "streamableHttp",
      "url": "http://localhost:3000/mcp",
      "autoApprove": [
        "search"
      ]
    },
    "web-search-sse": {
      "timeout": 60,
      "type": "sse",
      "url": "http://localhost:3000/sse",
      "autoApprove": [
        "search"
      ]
    }
  }
}

在线文档助手

使用如下mcp server配置,kb文档查询,document文档查询的功能,可以满足服务特性的答疑和总结功能。

json 复制代码
{
  "mcpServers": {
    "awslabs.aws-documentation-mcp-server": {
      "autoApprove": [
        "read_documentation",
        "search_documentation",
        "recommend",
        "get_available_services"
      ],
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--interactive",
        "--env",
        "FASTMCP_LOG_LEVEL=ERROR",
        "--env",
        "AWS_DOCUMENTATION_PARTITION=aws-cn",
        "mcp/aws-documentation:latest"
      ],
      "env": {}
    },
    "aws-knowledge-mcp-server": {
      "autoApprove": [
        "aws___search_documentation",
        "aws___read_documentation",
        "aws___recommend"
      ],
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "uvx",
      "args": [
        "fastmcp",
        "run",
        "https://knowledge-mcp.global.api.aws"
      ]
    }
  }
}

资源检索工具

如果需要查询账户资源,可以集成api mcp,cline会使用awscli工具查询具体的资源

json 复制代码
{
  "mcpServers": {
    "awslabs.aws-api-mcp-server": {
      "timeout": 60,
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--interactive",
        "--env",
        "AWS_REGION=cn-north-1",
        "--volume",
        "/home/ec2-user/.aws:/app/.aws",
        "public.ecr.aws/awslabs-mcp/awslabs/aws-api-mcp-server:latest"
      ],
      "env": {},
      "disabled": true
    }
}

成本和定价助手

比较常用的是查看账户中钱花在哪了

json 复制代码
{
  "mcpServers": {
    "awslabs.billing-cost-management-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "--interactive",
        "--env",
        "FASTMCP_LOG_LEVEL=ERROR",
        "awslabs/billing-cost-management-mcp-server:latest"
      ],
      "env": {},
      "disabled": false,
      "autoApprove": []
    }
  }
}

特定领域工具

个人习惯还是倾向于手动维护资源,类似cdk等mcp操作过于繁琐不容易理解具体的内容,后续的trouble shooting反而费事。

对于一些重复性的但是比较简单的服务,可以考虑类似如下的iam-mcp-server,用来分析现有用户策略,进行安全性测试很方便

json 复制代码
{
  "mcpServers": {
    "awslabs.iam-mcp-server": {
      "command": "uvx",
      "args": ["awslabs.iam-mcp-server@latest","--readonly"],
      "env": {
        "AWS_PROFILE": "default",
        "AWS_REGION": "cn-north-1",
        "FASTMCP_LOG_LEVEL": "ERROR"
      }
    }
  }
}

使用support_mcp_server来更方便获取支持

json 复制代码
{
   "mcpServers": {
      "awslabs_support_mcp_server": {
         "command": "uvx",
         "args": [
            "-m", "awslabs.aws-support-mcp-server@latest",
            "--debug",
            "--log-file",
            "./logs/mcp_support_server.log"
         ],
         "env": {
            "AWS_PROFILE": "default"
         }
      }
   }
}

搜索功能

tavily需要申请apikey,一个月1000次免费额度

复制代码
"github.com/tavily-ai/tavily-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "tavily-mcp@latest"
      ],
      "env": {
        "TAVILY_API_KEY": "tvly-xxxxxxxxxxx"
      },
      "disabled": false,
      "autoApprove": []
    }

自行部署open-web-search

复制代码
docker run -d --name web-search -p 3000:3000 \
  -e ENABLE_CORS=true \
  -e CORS_ORIGIN=* \
  ghcr.io/aas-ee/open-web-search:latest

mcp配置如下

json 复制代码
"web-search": {
  "timeout": 60,
  "type": "streamableHttp",
  "url": "http://localhost:3000/mcp",
  "autoApprove": [
    "search"
  ]
},
"web-search-sse": {
  "timeout": 60,
  "type": "sse",
  "url": "http://localhost:3000/sse",
  "autoApprove": [
    "search"
  ]
}
相关推荐
Johny_Zhao2 天前
Keepalived与Nginx架构选型
linux·nginx·信息安全·云计算·apache·shell·yum源·keepalive·系统运维
66IT6611 天前
Veeam ONE v13.1 发布:全新 HTML5 Web 客户端与 PostgreSQL 报告库
云计算·虚拟化·监控·数据保护·veeam
2601_9679801112 天前
Python 与云计算:AWS、GCP、Azure 实践
python·云计算·azure·aws·gcp
cc57250265313 天前
云计算技术应用专业大学期间考证怎么安排?
云计算
xbzb14 天前
镜像推上云:华为云 SWR 与阿里云 ACR 的建组织、加速器、上传与公开
阿里云·华为云·云计算·镜像·acr·swr
humcomm15 天前
设计与架构 · 01 sidecar 会消失吗:从 Istio ambient GA 到 AWS App Mesh 关停,一次服务网格数据面的重新洗牌
架构·istio·aws
牛奶咖啡1318 天前
云计算平台应用实践——云计算与云平台
云计算·云平台·云平台的三大服务模式·云计算与云平台的关系·laas paas saas·云平台的主流架构·国内外的主流云平台对比与选型
逐流人19 天前
手工建集群到全自动发布:k8s集群部署与DevOps流水线整合实战
ci/cd·云原生·kubernetes·云计算·devops
wz975419 天前
走进云计算:从硬件到云平台,读懂数字化底层基石
云计算