AI代理构建服务器

Strands Agents MCP Server 是一个模型驱动的方法,用于通过简单的代码构建AI代理,提供智能文档搜索和检索功能。

作者 By strands-agents
本地部署 AI代理 文档搜索
GitHub

Strands Agents

Strands Agents MCP Server

A model-driven approach to building AI agents in just a few lines of code.

[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/strands-agents/mcp-server)](https://github.com/strands-agents/mcp-server/graphs/commit-activity)
[![GitHub open issues](https://img.shields.io/github/issues/strands-agents/mcp-server)](https://github.com/strands-agents/mcp-server/issues)
[![GitHub open pull requests](https://img.shields.io/github/issues-pr/strands-agents/mcp-server)](https://github.com/strands-agents/mcp-server/pulls)
[![License](https://img.shields.io/github/license/strands-agents/mcp-server)](https://github.com/strands-agents/mcp-server/blob/main/LICENSE)
[![PyPI version](https://img.shields.io/pypi/v/strands-agents-mcp-server)](https://pypi.org/project/strands-agents-mcp-server/)
[![Python versions](https://img.shields.io/pypi/pyversions/strands-agents-mcp-server)](https://python.org)

DocumentationSamplesPython SDKToolsAgent BuilderMCP Server

此MCP服务器通过llms.txt文件为您的GenAI工具提供精心策划的文档访问,使AI编码助手能够通过智能排名搜索和检索相关文档。

特性

  • 智能文档搜索:基于TF-IDF的搜索,具有Markdown感知评分,优先考虑标题、标题和代码块
  • 基于章节的浏览:通过目录浏览文档结构,然后只获取所需的部分-比检索完整页面更具令牌效率
  • 精心策划的内容:对llms.txt文件中的文档进行索引,标题清晰易读
  • 按需获取:Lazy仅在需要最佳性能时加载完整文档内容
  • 代码段生成:提供带有相关性评分的上下文片段,以便快速概述
  • 真实URL支持:使用实际的HTTPS URL,同时保持向后兼容性

先决条件

以下使用方法需要 紫外线 安装在您的系统上。您可以按照以下步骤进行安装 官方安装说明.

安装

您可以使用Strands代理MCP服务器 40+支持MCP服务器的应用程序, 包括Amazon Q Developer CLI、Anthropic Claude Code、Cline和Cursor。

快速开始使用流行MCP客户端的一键安装按钮。单击下面的按钮直接在IDE中安装服务器:

Kiro示例

请参阅 Kiro文件 有关管理MCP配置的说明。

~/.kiro/settings/mcp.json:

JSON``` 1 2 3 4 5 6 7 8 9 10 11 12 13{ “mcpServers”: { “strands-agents”: { “command”: “uvx”, “args”: [“strands-agents-mcp-server”], “env”: { “FASTMCP_LOG_LEVEL”: “INFO” }, “disabled”: false, “autoApprove”: [“search_docs”, “fetch_doc”] } } }


### Q开发人员CLI示例


请参阅 [Q开发人员CLI文档](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html)
有关管理MCP配置的说明。


在 `~/.aws/amazonq/mcp.json`:


JSON```
1
2
3
4
5
6
7
8
9
10
11
12
13{
  "mcpServers": {
    "strands-agents": {
      "command": "uvx",
      "args": ["strands-agents-mcp-server"],
      "env": {
        "FASTMCP_LOG_LEVEL": "INFO"
      },
      "disabled": false,
      "autoApprove": ["search_docs", "fetch_doc"]
    }
  }
}

Claude代码示例

请参阅 Claude代码文档 有关管理MCP服务器的说明。

BASH``` 1claude mcp add strands uvx strands-agents-mcp-server


### 临床实例


请参阅 [临床文件](https://docs.cline.bot/mcp-servers/configuring-mcp-servers#editing-mcp-settings-files)
有关管理MCP配置的说明。


向Cline提供以下信息:

1 2 3I want to add the MCP server for Strands Agents. Here’s the GitHub link: @https://github.com/strands-agents/mcp-server Can you add it?”


### 光标示例


请参阅 [光标文档](https://docs.cursor.com/context/model-context-protocol#configuring-mcp-servers)
有关管理MCP配置的说明。


在 `~/.cursor/mcp.json`:


JSON```
1
2
3
4
5
6
7
8
9
10
11
12
13{
  "mcpServers": {
    "strands-agents": {
      "command": "uvx",
      "args": ["strands-agents-mcp-server"],
      "env": {
        "FASTMCP_LOG_LEVEL": "INFO"
      },
      "disabled": false,
      "autoApprove": ["search_docs", "fetch_doc"]
    }
  }
}

VS代码示例

请参阅 VS代码文档 有关管理MCP配置的说明。

在你的 mcp.json 文件:

JSON``` 1 2 3 4 5 6 7 8{ “servers”: { “strands-agents”: { “command”: “uvx”, “args”: [“strands-agents-mcp-server”] } } }


## 快速测试


您可以使用MCP检查器快速测试MCP服务器:


BASH```
1
2
3
4# For published package
npx @modelcontextprotocol/inspector uvx strands-agents-mcp-server
# For local development
npx @modelcontextprotocol/inspector python -m strands_mcp_server

注意:这需要 npx 安装在您的系统上。它捆绑在一起 Node.js.

检查器对于解决MCP服务器问题也很有用,因为它提供了详细的连接和协议信息。有关详细指南,请参阅 MCP检查员文件.

入门指南

  1. 安装必备组件:
  1. 配置您的MCP客户端:
  • 从上面的安装示例中选择您喜欢的MCP客户端
  • 将Strands Agent MCP服务器配置添加到您的客户端
  1. 测试连接:

BASH``` 1 2 3 4# For published package npx @modelcontextprotocol/inspector uvx strands-agents-mcp-server

For local development

npx @modelcontextprotocol/inspector python -m strands_mcp_server

4. **开始使用文档工具**:


- `search_docs` -通过智能排名查找相关文档
- `fetch_doc` -浏览页面的结构和前言,然后阅读各个部分
- 服务器自动为llms.txt文件中的精选内容建立索引


## 服务器开发


BASH```
1
2
3
4
5
6git clone https://github.com/strands-agents/mcp-server.git
cd mcp-server
python3 -m venv venv
source venv/bin/activate
pip3 install -e ".[dev]"
npx @modelcontextprotocol/inspector python -m strands_mcp_server

运行测试

BASH``` 1 2 3 4 5 6# Unit tests (fast, no network access required) pytest tests/

Integration tests (requires network access to strandsagents.com)

pytest tests_integ/ -v

All tests

pytest tests/ tests_integ/ -v


要跳过集成测试(例如,在没有网络访问权限的CI环境中):


BASH```
1SKIP_INTEG_TESTS=1 pytest tests_integ/

贡献❤️

我们欢迎捐款!查看我们的 贡献指南 有关以下内容的详细信息:

  • 报告错误和功能
  • 开发设置
  • 通过Pull请求进行贡献
  • 行为准则
  • 安全问题报告

许可证

此项目根据Apache许可证2.0获得许可-请参阅 许可证 文件以获取详细信息。

安全

看 贡献 了解更多信息。