├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ ├── pr-and-push.yml │ ├── pypi-publish-on-release.yml │ └── test-lint.yml ├── .gitignore ├── .pre-commit-config.yaml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── NOTICE ├── README.md ├── pyproject.toml └── src └── strands_mcp_server ├── __init__.py ├── __main__.py ├── content ├── model_providers.md ├── quickstart.md └── tools.md └── server.py /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. Unless a later match takes precedence, 3 | # @strands-agents/contributors will be requested for 4 | # review when someone opens a pull request. 5 | * @strands-agents/maintainers -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "pip" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | open-pull-requests-limit: 100 8 | commit-message: 9 | prefix: ci 10 | - package-ecosystem: "github-actions" 11 | directory: "/" 12 | schedule: 13 | interval: "daily" 14 | open-pull-requests-limit: 100 15 | commit-message: 16 | prefix: ci 17 | -------------------------------------------------------------------------------- /.github/workflows/pr-and-push.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request and Push Action 2 | 3 | on: 4 | pull_request: # Safer than pull_request_target for untrusted code 5 | branches: [ main ] 6 | types: [opened, synchronize, reopened, ready_for_review, review_requested, review_request_removed] 7 | push: 8 | branches: [ main ] # Also run on direct pushes to main 9 | concurrency: 10 | group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | call-test-lint: 15 | uses: ./.github/workflows/test-lint.yml 16 | permissions: 17 | contents: read 18 | with: 19 | ref: ${{ github.event.pull_request.head.sha || github.sha }} 20 | -------------------------------------------------------------------------------- /.github/workflows/pypi-publish-on-release.yml: -------------------------------------------------------------------------------- 1 | name: Publish Python Package 2 | 3 | on: 4 | release: 5 | types: 6 | - published 7 | 8 | jobs: 9 | call-test-lint: 10 | uses: ./.github/workflows/test-lint.yml 11 | permissions: 12 | contents: read 13 | with: 14 | ref: ${{ github.event.release.target_commitish }} 15 | 16 | build: 17 | name: Build distribution 📦 18 | permissions: 19 | contents: read 20 | needs: 21 | - call-test-lint 22 | runs-on: ubuntu-latest 23 | 24 | steps: 25 | - uses: actions/checkout@v4 26 | with: 27 | persist-credentials: false 28 | 29 | - name: Set up Python 30 | uses: actions/setup-python@v5 31 | with: 32 | python-version: '3.10' 33 | 34 | - name: Install dependencies 35 | run: | 36 | python -m pip install --upgrade pip 37 | pip install hatch twine 38 | - name: Validate version 39 | run: | 40 | version=$(hatch version) 41 | if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then 42 | echo "Valid version format" 43 | exit 0 44 | else 45 | echo "Invalid version format" 46 | exit 1 47 | fi 48 | - name: Build 49 | run: | 50 | hatch build 51 | - name: Store the distribution packages 52 | uses: actions/upload-artifact@v4 53 | with: 54 | name: python-package-distributions 55 | path: dist/ 56 | 57 | deploy: 58 | name: Upload release to PyPI 59 | needs: 60 | - build 61 | runs-on: ubuntu-latest 62 | 63 | # environment is used by PyPI Trusted Publisher and is strongly encouraged 64 | # https://docs.pypi.org/trusted-publishers/adding-a-publisher/ 65 | environment: 66 | name: pypi 67 | url: https://pypi.org/p/strands-agents-mcp-server 68 | permissions: 69 | # IMPORTANT: this permission is mandatory for Trusted Publishing 70 | id-token: write 71 | 72 | steps: 73 | - name: Download all the dists 74 | uses: actions/download-artifact@v4 75 | with: 76 | name: python-package-distributions 77 | path: dist/ 78 | - name: Publish distribution 📦 to PyPI 79 | uses: pypa/gh-action-pypi-publish@release/v1 80 | -------------------------------------------------------------------------------- /.github/workflows/test-lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | ref: 7 | required: true 8 | type: string 9 | 10 | jobs: 11 | lint: 12 | name: Lint 13 | runs-on: ubuntu-latest 14 | permissions: 15 | contents: read 16 | steps: 17 | - name: Checkout code 18 | uses: actions/checkout@v4 19 | with: 20 | ref: ${{ inputs.ref }} 21 | persist-credentials: false 22 | 23 | - name: Set up Python 24 | uses: actions/setup-python@v5 25 | with: 26 | python-version: '3.10' 27 | cache: 'pip' 28 | 29 | - name: Install dependencies 30 | run: | 31 | pip install --no-cache-dir hatch 32 | 33 | - name: Run lint 34 | id: lint 35 | run: hatch run lint 36 | continue-on-error: false 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | __pycache__* 3 | .coverage* 4 | .env 5 | .venv 6 | .mypy_cache 7 | .pytest_cache 8 | .ruff_cache 9 | *.bak 10 | .vscode 11 | dist 12 | venv/ 13 | *.egg-info 14 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: local 3 | hooks: 4 | - id: hatch-format 5 | name: Format code 6 | entry: hatch fmt --formatter 7 | language: system 8 | pass_filenames: false 9 | types: [python] 10 | stages: [pre-commit] 11 | - id: hatch-lint 12 | name: Lint code 13 | entry: hatch fmt --linter 14 | language: system 15 | pass_filenames: false 16 | types: [python] 17 | stages: [pre-commit] 18 | - id: commitizen-check 19 | name: Check commit message 20 | entry: hatch run cz check --commit-msg-file 21 | language: system 22 | stages: [commit-msg] -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *main* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 50 | opensource-codeofconduct@amazon.com with any additional questions or comments. 51 | 52 | 53 | ## Security issue notifications 54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 55 | 56 | 57 | ## Licensing 58 | 59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | Strands Agents 5 | 6 |
7 | 8 |

9 | Strands Agents MCP Server 10 |

11 | 12 |

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

15 | 16 |
17 | GitHub commit activity 18 | GitHub open issues 19 | GitHub open pull requests 20 | License 21 | PyPI version 22 | Python versions 23 |
24 | 25 |

26 | Documentation 27 | ◆ Samples 28 | ◆ Python SDK 29 | ◆ Tools 30 | ◆ Agent Builder 31 | ◆ MCP Server 32 |

33 |
34 | 35 | This MCP server provides documentation about Strands Agents to your GenAI tools, so you can use your favorite AI coding assistant to vibe-code Strands Agents. 36 | 37 | ## Prerequisites 38 | 39 | The usage methods below require [uv](https://github.com/astral-sh/uv) to be installed on your system. You can install it by following the [official installation instructions](https://github.com/astral-sh/uv#installation). 40 | 41 | ## Installation 42 | 43 | You can use the Strands Agents MCP server with 44 | [40+ applications that support MCP servers](https://modelcontextprotocol.io/clients), 45 | including Amazon Q Developer CLI, Anthropic Claude Code, Cline, and Cursor. 46 | 47 | ### Q Developer CLI example 48 | 49 | See the [Q Developer CLI documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html) 50 | for instructions on managing MCP configuration. 51 | 52 | In `~/.aws/amazonq/mcp.json`: 53 | 54 | ```json 55 | { 56 | "mcpServers": { 57 | "strands": { 58 | "command": "uvx", 59 | "args": ["strands-agents-mcp-server"] 60 | } 61 | } 62 | } 63 | ``` 64 | 65 | ### Claude Code example 66 | 67 | See the [Claude Code documentation](https://docs.anthropic.com/en/docs/claude-code/tutorials#configure-mcp-servers) 68 | for instructions on managing MCP servers. 69 | 70 | ```bash 71 | claude mcp add strands uvx strands-agents-mcp-server 72 | ``` 73 | 74 | ### Cline example 75 | 76 | See the [Cline documentation](https://docs.cline.bot/mcp-servers/configuring-mcp-servers#editing-mcp-settings-files) 77 | for instructions on managing MCP configuration. 78 | 79 | Provide Cline with the following information: 80 | 81 | ``` 82 | I want to add the MCP server for Strands Agents. 83 | Here's the GitHub link: @https://github.com/strands-agents/mcp-server 84 | Can you add it?" 85 | ``` 86 | 87 | ### Cursor example 88 | 89 | See the [Cursor documentation](https://docs.cursor.com/context/model-context-protocol#configuring-mcp-servers) 90 | for instructions on managing MCP configuration. 91 | 92 | In `~/.cursor/mcp.json`: 93 | 94 | ```json 95 | { 96 | "mcpServers": { 97 | "strands": { 98 | "command": "uvx", 99 | "args": ["strands-agents-mcp-server"] 100 | } 101 | } 102 | } 103 | ``` 104 | 105 | ## Quick Testing 106 | 107 | You can quickly test the MCP server using the MCP Inspector: 108 | 109 | ```bash 110 | npx @modelcontextprotocol/inspector uvx strands-agents-mcp-server 111 | ``` 112 | 113 | Note: This requires [npx](https://docs.npmjs.com/cli/v11/commands/npx) to be installed on your system. It comes bundled with [Node.js](https://nodejs.org/). 114 | 115 | The Inspector is also useful for troubleshooting MCP server issues as it provides detailed connection and protocol information. For an in-depth guide, have a look at the [MCP Inspector documentation](https://modelcontextprotocol.io/docs/tools/inspector). 116 | 117 | ## Server development 118 | 119 | ```bash 120 | git clone https://github.com/strands-agents/mcp-server.git 121 | cd mcp-server 122 | python3 -m venv venv 123 | source venv/bin/activate 124 | pip3 install -e . 125 | 126 | npx @modelcontextprotocol/inspector python -m strands_mcp_server 127 | ``` 128 | 129 | ## Contributing ❤️ 130 | 131 | We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for details on: 132 | - Reporting bugs & features 133 | - Development setup 134 | - Contributing via Pull Requests 135 | - Code of Conduct 136 | - Reporting of security issues 137 | 138 | ## License 139 | 140 | This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details. 141 | 142 | ## Security 143 | 144 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. 145 | 146 | ## ⚠️ Preview Status 147 | 148 | Strands Agents is currently in public preview. During this period: 149 | - APIs may change as we refine the SDK 150 | - We welcome feedback and contributions 151 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "strands-agents-mcp-server" 3 | dynamic = ["version"] 4 | description = "A Model Context Protocol server that provides knowledge about building AI agents with Strands Agents" 5 | readme = "README.md" 6 | requires-python = ">=3.10" 7 | license = {text = "Apache-2.0"} 8 | authors = [ 9 | {name = "AWS", email = "opensource@amazon.com"}, 10 | ] 11 | classifiers = [ 12 | "Development Status :: 3 - Alpha", 13 | "Intended Audience :: Developers", 14 | "License :: OSI Approved :: Apache Software License", 15 | "Operating System :: OS Independent", 16 | "Programming Language :: Python :: 3", 17 | "Programming Language :: Python :: 3.10", 18 | "Programming Language :: Python :: 3.11", 19 | "Programming Language :: Python :: 3.12", 20 | "Programming Language :: Python :: 3.13", 21 | "Topic :: Scientific/Engineering :: Artificial Intelligence", 22 | "Topic :: Software Development :: Libraries :: Python Modules", 23 | ] 24 | dependencies = [ 25 | "mcp>=1.1.3", 26 | "pydantic>=2.0.0", 27 | ] 28 | 29 | [project.scripts] 30 | strands-agents-mcp-server = "strands_mcp_server.server:main" 31 | 32 | [build-system] 33 | requires = ["hatchling", "hatch-vcs"] 34 | build-backend = "hatchling.build" 35 | 36 | [tool.hatch.metadata] 37 | allow-direct-references = true 38 | 39 | [tool.hatch.version] 40 | # Tells Hatch to use your version control system (git) to determine the version. 41 | source = "vcs" 42 | 43 | [project.urls] 44 | Homepage = "https://github.com/strands-agents/mcp-server" 45 | "Bug Tracker" = "https://github.com/strands-agents/mcp-server" 46 | Documentation = "https://strandsagents.com" 47 | 48 | [project.optional-dependencies] 49 | dev = [ 50 | "commitizen>=4.4.0", 51 | "hatch>=1.0.0", 52 | "pre-commit>=2.20.0", 53 | "ruff>=0.4.4", 54 | ] 55 | 56 | [tool.hatch.build] 57 | packages = ["src/strands_mcp_server"] 58 | 59 | [tool.hatch.envs.hatch-static-analysis] 60 | dependencies = [ 61 | "mcp>=1.1.3", 62 | "pydantic>=2.0.0", 63 | "ruff>=0.4.4", 64 | ] 65 | 66 | [tool.hatch.envs.hatch-static-analysis.scripts] 67 | format-check = [ 68 | "ruff format --check" 69 | ] 70 | format-fix = [ 71 | "ruff format" 72 | ] 73 | lint-check = [ 74 | "ruff check" 75 | ] 76 | lint-fix = [ 77 | "ruff check --fix" 78 | ] 79 | 80 | [tool.hatch.envs.default.scripts] 81 | list = [ 82 | "echo 'Scripts commands available for default env:'; hatch env show --json | jq --raw-output '.default.scripts | keys[]'" 83 | ] 84 | format = [ 85 | "hatch fmt --formatter", 86 | ] 87 | lint = [ 88 | "hatch fmt --linter" 89 | ] 90 | 91 | [tool.ruff] 92 | line-length = 120 93 | include = ["src/**/*.py"] 94 | 95 | [tool.ruff.lint] 96 | select = [ 97 | "E", # pycodestyle 98 | "F", # pyflakes 99 | "I", # isort 100 | "B", # flake8-bugbear 101 | ] 102 | 103 | [tool.commitizen] 104 | name = "cz_conventional_commits" 105 | tag_format = "v$version" 106 | bump_message = "chore(release): bump version $current_version -> $new_version" 107 | version_files = [ 108 | "pyproject.toml:version", 109 | ] 110 | update_changelog_on_bump = true 111 | -------------------------------------------------------------------------------- /src/strands_mcp_server/__init__.py: -------------------------------------------------------------------------------- 1 | from . import server 2 | 3 | 4 | def main(): 5 | """Strands Agents MCP Server""" 6 | server.main() 7 | 8 | 9 | if __name__ == "__main__": 10 | main() 11 | -------------------------------------------------------------------------------- /src/strands_mcp_server/__main__.py: -------------------------------------------------------------------------------- 1 | from strands_mcp_server import main 2 | 3 | main() 4 | -------------------------------------------------------------------------------- /src/strands_mcp_server/content/model_providers.md: -------------------------------------------------------------------------------- 1 | Strands Agents supports many different model providers. By default, agents use the Amazon Bedrock model provider with the Claude 3.7 model. 2 | 3 | You can specify a different model in two ways: 4 | 5 | 1. By passing a string model ID directly to the Agent constructor 6 | 2. By creating a model provider instance with specific configurations 7 | 8 | ### Using a String Model ID 9 | 10 | The simplest way to specify a model is to pass the model ID string directly: 11 | 12 | ```python 13 | from strands import Agent 14 | 15 | # Create an agent with a specific model by passing the model ID string 16 | agent = Agent(model="us.anthropic.claude-3-7-sonnet-20250219-v1:0") 17 | ``` 18 | 19 | Models passed as string IDs will use the Bedrock model provider. 20 | 21 | ### Amazon Bedrock (Default) 22 | 23 | For more control over model configuration, you can create a model provider instance: 24 | 25 | ```python 26 | import boto3 27 | from strands import Agent 28 | from strands.models import BedrockModel 29 | 30 | # Create a BedrockModel 31 | bedrock_model = BedrockModel( 32 | model_id="us.anthropic.claude-3-7-sonnet-20250219-v1:0", 33 | region_name='us-west-2', 34 | temperature=0.3, 35 | ) 36 | 37 | agent = Agent(model=bedrock_model) 38 | ``` 39 | 40 | You will also need to enable model access in Amazon Bedrock for the models that you choose to use with your agents, following the [AWS documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html) to enable access. 41 | 42 | ### Anthropic 43 | 44 | First install the `anthropic` python client: 45 | 46 | ```bash 47 | pip install strands-agents[anthropic] 48 | ``` 49 | 50 | Next, import and initialize the `AnthropicModel` provider: 51 | 52 | ```python 53 | from strands import Agent 54 | from strands.models.anthropic import AnthropicModel 55 | 56 | anthropic_model = AnthropicModel( 57 | client_args={ 58 | "api_key": "", 59 | }, 60 | max_tokens=1028, 61 | model_id="claude-3-7-sonnet-20250219", 62 | params={ 63 | "temperature": 0.7, 64 | } 65 | ) 66 | 67 | agent = Agent(model=anthropic_model) 68 | ``` 69 | 70 | ### LiteLLM 71 | 72 | LiteLLM is a unified interface for various LLM providers that allows you to interact with models from OpenAI and many others. 73 | 74 | First install the `litellm` python client: 75 | 76 | ```bash 77 | pip install strands-agents[litellm] 78 | ``` 79 | 80 | Next, import and initialize the `LiteLLMModel` provider: 81 | 82 | ```python 83 | from strands import Agent 84 | from strands.models.litellm import LiteLLMModel 85 | 86 | litellm_model = LiteLLMModel( 87 | client_args={ 88 | "api_key": "", 89 | }, 90 | model_id="gpt-4o" 91 | ) 92 | 93 | agent = Agent(model=litellm_model) 94 | ``` 95 | 96 | ### Llama API 97 | 98 | Llama API is a Meta-hosted API service that helps you integrate Llama models into your applications quickly and efficiently. 99 | 100 | First install the `llamaapi` python client: 101 | ```bash 102 | pip install strands-agents[llamaapi] 103 | ``` 104 | 105 | Next, import and initialize the `LlamaAPIModel` provider: 106 | 107 | ```python 108 | from strands import Agent 109 | from strands.models.llamaapi import LLamaAPIModel 110 | 111 | model = LlamaAPIModel( 112 | client_args={ 113 | "api_key": "", 114 | }, 115 | # **model_config 116 | model_id="Llama-4-Maverick-17B-128E-Instruct-FP8", 117 | ) 118 | 119 | agent = Agent(models=LLamaAPIModel) 120 | ``` 121 | 122 | ### Ollama (Local Models) 123 | 124 | First install the `ollama` python client: 125 | 126 | ```bash 127 | pip install strands-agents[ollama] 128 | ``` 129 | 130 | Next, import and initialize the `OllamaModel` provider: 131 | 132 | ```python 133 | from strands import Agent 134 | from strands.models.ollama import OllamaModel 135 | 136 | ollama_model = OllamaModel( 137 | host="http://localhost:11434" # Ollama server address 138 | model_id="llama3", # Specify which model to use 139 | temperature=0.3, 140 | ) 141 | 142 | agent = Agent(model=ollama_model) 143 | ``` 144 | 145 | ### Custom Model Providers 146 | 147 | We can even connect our agents to custom model providers to use any model from anywhere! 148 | 149 | ```python 150 | from strands import Agent 151 | from your_company.models.custom_model import CustomModel 152 | 153 | custom_model = CustomModel( 154 | model_id="your-model-id 155 | temperature=0.3, 156 | ) 157 | 158 | agent = Agent(model=custom_model) 159 | ``` 160 | -------------------------------------------------------------------------------- /src/strands_mcp_server/content/quickstart.md: -------------------------------------------------------------------------------- 1 | This quickstart guide describes the core concepts of Strands Agents and shows you how to create your first AI agent with Strands Agents. 2 | 3 | The full documentation can be found at https://strandsagents.com. 4 | 5 | ## Concepts 6 | 7 | Strands Agents is a Python SDK for building AI agents. It may also be referred to as simply 'Strands'. 8 | 9 | - Agent: Agents are defined using the Strands SDK. They are primarily defined by specifying 1) a model, 2) tools, and 3) prompts. 10 | - Model: Agents can use any model that supports reasoning and tool use, including models in Amazon Bedrock, Anthropic, and many more through LiteLLM. 11 | The default model in Strands is Anthropic Claude Sonnet 3.7 in Amazon Bedrock in region us-west-2. 12 | - Tools: Tools are the primary mechanism for extending agent capabilities, enabling them to perform actions beyond simple text generation. 13 | Tools allow agents to interact with external systems, access data, and manipulate their environment. 14 | The agent automatically determines when to use tools based on the input query and context. 15 | Strands provides some example tools, supports Model Context Protocol (MCP) servers, and can use any Python function decorated with @tool. 16 | - Prompts: A system prompt and user messages are the primary way to communicate with AI models in an agent using Strands. 17 | 18 | ## Main Python Packages 19 | 20 | The main Strands Agents SDK Python package is `strands-agents`. The SDK package provides the `strands` Python module. 21 | 22 | The Strands Agents SDK additionally offers the `strands-agents-tools` package with many example tools. 23 | The tools package provides the `strands-tools` Python module. 24 | 25 | Your requirements.txt file may look like: 26 | 27 | ``` 28 | strands-agents>=0.1.0 29 | strands-agents-tools>=0.1.0 30 | ``` 31 | 32 | ## Example Agent 33 | 34 | We'll create an example agent Python project, with this directory structure: 35 | 36 | ``` 37 | my_agent/ 38 | ├── __init__.py 39 | ├── agent.py 40 | └── requirements.txt 41 | ``` 42 | 43 | The `my_agent/__init__.py` file contains: 44 | 45 | ```python 46 | from . import agent 47 | ``` 48 | 49 | The `agent.py` file contains: 50 | 51 | ```python 52 | from strands import Agent, tool 53 | from strands_tools import calculator, current_time, python_repl 54 | 55 | # Define a custom tool for the agent as a Python function using the @tool decorator 56 | @tool 57 | def letter_counter(word: str, letter: str) -> int: 58 | """ 59 | Count occurrences of a specific letter in a word. 60 | 61 | Args: 62 | word (str): The input word to search in 63 | letter (str): The specific letter to count 64 | 65 | Returns: 66 | int: The number of occurrences of the letter in the word 67 | """ 68 | if not isinstance(word, str) or not isinstance(letter, str): 69 | return 0 70 | 71 | if len(letter) != 1: 72 | raise ValueError("The 'letter' parameter must be a single character") 73 | 74 | return word.lower().count(letter.lower()) 75 | 76 | # Define the agent 77 | agent = Agent( 78 | # If you provide the model ID as a string, Bedrock is the 79 | # default model provider. 80 | # Remember to ensure you have model access in Bedrock or request it: 81 | # https://docs.aws.amazon.com/bedrock/latest/userguide/model-access-modify.html 82 | model="us.anthropic.claude-3-7-sonnet-20250219-v1:0", 83 | # Use tools from the strands-tools example tools package 84 | # as well as our custom letter_counter tool 85 | tools=[calculator, current_time, python_repl, letter_counter], 86 | # System prompt for the agent 87 | system_prompt="You are a helpful assistant" 88 | ) 89 | 90 | # Ask the agent a question that uses the available tools 91 | message = """ 92 | I have 4 requests: 93 | 94 | 1. What is the time right now? 95 | 2. Calculate 3111696 / 74088 96 | 3. Tell me how many letter R's are in the word "strawberry" 🍓 97 | 4. Output a script that does what we just spoke about! 98 | Use your python tools to confirm that the script works before outputting it 99 | """ 100 | agent(message) 101 | ``` 102 | 103 | ## Running Agents 104 | 105 | Our agent is just Python, so we can run it using any mechanism for running Python! 106 | 107 | To test our agent we can simply run: 108 | 109 | ```bash 110 | python -u my_agent/agent.py 111 | ``` 112 | 113 | And that's it! We now have a running agent with powerful tools and abilities in just a few lines of code 🥳. 114 | 115 | ## Debug Logs 116 | 117 | To enable debug logs in our agent, configure the `strands` logger: 118 | 119 | ```python 120 | import logging 121 | from strands import Agent 122 | 123 | # Enables Strands Agents debug log level 124 | logging.getLogger("strands").setLevel(logging.DEBUG) 125 | 126 | # Sets the logging format and streams logs to stderr 127 | logging.basicConfig( 128 | format="%(levelname)s | %(name)s | %(message)s", 129 | handlers=[logging.StreamHandler()] 130 | ) 131 | 132 | agent = Agent() 133 | 134 | agent("Hello!") 135 | ``` 136 | 137 | ## Capturing Streamed Data & Events 138 | 139 | Strands Agents provides two main approaches to capture streaming events from an agent: async iterators and callback functions. 140 | 141 | ### Async Iterators 142 | 143 | For asynchronous applications (like web servers or APIs), Strands Agents provides an async iterator approach using `stream_async()`. This is particularly useful with async frameworks like FastAPI or Django Channels. 144 | 145 | ```python 146 | import asyncio 147 | from strands import Agent 148 | from strands_tools import calculator 149 | 150 | # Initialize our agent without a callback handler 151 | agent = Agent( 152 | tools=[calculator], 153 | callback_handler=None # Disable default callback handler 154 | ) 155 | 156 | # Async function that iterates over streamed agent events 157 | async def process_streaming_response(): 158 | query = "What is 25 * 48 and explain the calculation" 159 | 160 | # Get an async iterator for the agent's response stream 161 | agent_stream = agent.stream_async(query) 162 | 163 | # Process events as they arrive 164 | async for event in agent_stream: 165 | if "data" in event: 166 | # Print text chunks as they're generated 167 | print(event["data"], end="", flush=True) 168 | elif "current_tool_use" in event and event["current_tool_use"].get("name"): 169 | # Print tool usage information 170 | print(f"\n[Tool use delta for: {event['current_tool_use']['name']}]") 171 | 172 | # Run the agent with the async event processing 173 | asyncio.run(process_streaming_response()) 174 | ``` 175 | 176 | The async iterator yields the same event types as the callback handler callbacks, including text generation events, tool events, and lifecycle events. This approach is ideal for integrating Strands Agents agents with async web frameworks. 177 | 178 | See the [Async Iterators](concepts/streaming/async-iterators.md) documentation for full details. 179 | 180 | ### Callback Handlers (Callbacks) 181 | 182 | We can create a custom callback function (named a [callback handler](concepts/streaming/callback-handlers.md)) that is invoked at various points throughout an agent's lifecycle. 183 | 184 | Here is an example that captures streamed data from the agent and logs it instead of printing: 185 | 186 | ```python 187 | import logging 188 | from strands import Agent 189 | from strands_tools import shell 190 | 191 | logger = logging.getLogger("my_agent") 192 | 193 | # Define a simple callback handler that logs instead of printing 194 | tool_use_ids = [] 195 | def callback_handler(**kwargs): 196 | if "data" in kwargs: 197 | # Log the streamed data chunks 198 | logger.info(kwargs["data"], end="") 199 | elif "current_tool_use" in kwargs: 200 | tool = kwargs["current_tool_use"] 201 | if tool["toolUseId"] not in tool_use_ids: 202 | # Log the tool use 203 | logger.info(f"\n[Using tool: {tool.get('name')}]") 204 | tool_use_ids.append(tool["toolUseId"]) 205 | 206 | # Create an agent with the callback handler 207 | agent = Agent( 208 | tools=[shell], 209 | callback_handler=callback_handler 210 | ) 211 | 212 | # Ask the agent a question 213 | result = agent("What operating system am I using?") 214 | 215 | # Print only the last response 216 | print(result.message) 217 | ``` 218 | 219 | The callback handler is called in real-time as the agent thinks, uses tools, and responds. 220 | 221 | See the [Callback Handlers](concepts/streaming/callback-handlers.md) documentation for full details. 222 | -------------------------------------------------------------------------------- /src/strands_mcp_server/content/tools.md: -------------------------------------------------------------------------------- 1 | Tools are the primary mechanism for extending agent capabilities, enabling them to perform actions beyond simple text generation. Tools allow agents to interact with external systems, access data, and manipulate their environment. 2 | 3 | ## Adding Tools to Agents 4 | 5 | Tools are passed to agents during initialization or at runtime, making them available for use throughout the agent's lifecycle. Once loaded, the agent can use these tools in response to user requests: 6 | 7 | ```python 8 | from strands import Agent 9 | from strands_tools import calculator, file_read, shell 10 | 11 | # Add tools to our agent 12 | agent = Agent( 13 | tools=[calculator, file_read, shell] 14 | ) 15 | 16 | # Agent will automatically determine when to use the calculator tool 17 | agent("What is 42 ^ 9") 18 | 19 | # Agent will use the shell and file reader tool when appropriate 20 | agent("Show me the contents of a single file in this directory") 21 | ``` 22 | 23 | ## Building & Loading Tools 24 | 25 | ### 1. Python Tools 26 | 27 | Build your own Python tools using the Strands SDK's tool interfaces. 28 | 29 | Function decorated tools can be placed anywhere in your codebase and imported in to your agent's list of tools. Define any Python function as a tool by using the [`@tool`](../../../api-reference/tools.md#strands.tools.decorator.tool) decorator. 30 | 31 | ```python 32 | from strands import Agent, tool 33 | 34 | @tool 35 | def get_user_location() -> str: 36 | """Get the user's location 37 | """ 38 | 39 | # Implement user location lookup logic here 40 | return "Seattle, USA" 41 | 42 | @tool 43 | def weather(location: str) -> str: 44 | """Get weather information for a location 45 | 46 | Args: 47 | location: City or location name 48 | """ 49 | 50 | # Implement weather lookup logic here 51 | return f"Weather for {location}: Sunny, 72°F" 52 | 53 | agent = Agent(tools=[get_user_location, weather]) 54 | 55 | # Use the agent with the custom tools 56 | agent("What is the weather like in my location?") 57 | ``` 58 | 59 | ### 2. Model Context Protocol (MCP) Tools 60 | 61 | The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) provides a standardized way to expose and consume tools across different systems. This approach is ideal for creating reusable tool collections that can be shared across multiple agents or applications. 62 | 63 | ```python 64 | from mcp import stdio_client, StdioServerParameters 65 | from strands import Agent 66 | from strands.tools.mcp import MCPClient 67 | 68 | # Connect to an MCP server using stdio transport 69 | stdio_mcp_client = MCPClient(lambda: stdio_client( 70 | StdioServerParameters(command="uvx", args=["awslabs.aws-documentation-mcp-server@latest"]) 71 | )) 72 | 73 | # Create an agent with MCP tools 74 | with stdio_mcp_client: 75 | # Get the tools from the MCP server 76 | tools = stdio_mcp_client.list_tools_sync() 77 | 78 | # Create an agent with these tools 79 | agent = Agent(tools=tools) 80 | ``` 81 | 82 | ### 3. Example Built-in Tools 83 | 84 | Strands offers an optional example tools package `strands-agents-tools` which includes pre-built tools to get started quickly experimenting with agents and tools during development. 85 | 86 | Install the `strands-agents-tools` package by running: 87 | 88 | ```bash 89 | pip install strands-agents-tools 90 | ``` 91 | 92 | ## Available Built-In Strands Tools 93 | 94 | #### RAG & Memory 95 | 96 | - `retrieve`: Semantically retrieve data from Amazon Bedrock Knowledge Bases for RAG, memory, and other purposes 97 | 98 | #### File Operations 99 | 100 | - `editor`: Advanced file editing operations 101 | - `file_read`: Read and parse files 102 | - `file_write`: Create and modify files 103 | 104 | #### Shell & System 105 | 106 | - `environment`: Manage environment variables 107 | - `shell`: Execute shell commands 108 | 109 | #### Code Interpretation 110 | 111 | - `python_repl`: Run Python code 112 | 113 | #### Web & Network 114 | 115 | - `http_request`: Make API calls, fetch web data, and call local HTTP servers 116 | 117 | #### Multi-modal 118 | 119 | - `image_reader`: Process and analyze images 120 | - `generate_image`: Create AI generated images with Amazon Bedrock 121 | - `nova_reels`: Create AI generated videos with Nova Reels on Amazon Bedrock 122 | 123 | #### AWS Services 124 | 125 | - `use_aws`: Interact with AWS services 126 | 127 | #### Utilities 128 | 129 | - `calculator`: Perform mathematical operations 130 | - `current_time`: Get the current date and time 131 | - `load_tool`: Dynamically load more tools at runtime 132 | 133 | #### Agents & Workflows 134 | 135 | - `agent_graph`: Create and manage graphs of agents 136 | - `journal`: Create structured tasks and logs for agents to manage and work from 137 | - `swarm`: Coordinate multiple AI agents in a swarm / network of agents 138 | - `stop`: Force stop the agent event loop 139 | - `think`: Perform deep thinking by creating parallel branches of agentic reasoning 140 | - `use_llm`: Run a new AI event loop with custom prompts 141 | - `workflow`: Orchestrate sequenced workflows 142 | -------------------------------------------------------------------------------- /src/strands_mcp_server/server.py: -------------------------------------------------------------------------------- 1 | from importlib import resources 2 | 3 | from mcp.server.fastmcp import FastMCP 4 | 5 | pkg_resources = resources.files("strands_mcp_server") 6 | 7 | mcp = FastMCP( 8 | "strands-agents-mcp-server", 9 | instructions=""" 10 | # Strands Agents MCP Server 11 | 12 | This server provides tools to access Strands Agents documentation. 13 | Strands Agents is a Python SDK for building AI agents. 14 | It may also be referred to as simply 'Strands'. 15 | 16 | The full documentation can be found at https://strandsagents.com. 17 | """, 18 | ) 19 | 20 | 21 | @mcp.tool() 22 | async def quickstart() -> str: 23 | """Quickstart documentation for Strands Agents SDK.""" 24 | return pkg_resources.joinpath("content", "quickstart.md").read_text( 25 | encoding="utf-8" 26 | ) 27 | 28 | 29 | @mcp.tool() 30 | async def model_providers() -> str: 31 | """Documentation on using different model providers in Strands Agents.""" 32 | return pkg_resources.joinpath("content", "model_providers.md").read_text( 33 | encoding="utf-8" 34 | ) 35 | 36 | 37 | @mcp.tool() 38 | async def agent_tools() -> str: 39 | """Documentation on adding tools to agents using Strands Agents.""" 40 | return pkg_resources.joinpath("content", "tools.md").read_text(encoding="utf-8") 41 | 42 | 43 | def main(): 44 | mcp.run() 45 | --------------------------------------------------------------------------------