
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
このプロジェクトは、ChainlitとMCP(Model Context Protocol)サーバーとAmazon Bedrockのファンデーションモデルを統合し、ツール強化されたインタラクティブなチャットインターフェイスを作成する方法を示しています...
概要
本プロジェクトでは、Amazon BedrockとChainlitとMCP(Model Context Protocol)サーバーのファンデーションモデルを統合し、ツール機能でインタラクティブなチャットインターフェイスを作成する方法を説明します。 - Anthropic Claude 3.7を使用したAmazonのBedrockとの統合 Sonnet - 対話型AIインタラクションのためのChainlit Webインターフェイス - 基本的な数学操作を実行するカスタムモデルコンテキストプロトコル(MCP)サーバー - スムーズなユーザーエクスペリエンスに対する応答のストリーミング - MCPアダプターとLangChainの統合により、外部ツールを接続 - ツールが使用するReAct(Reasoning and Acting)エージェントを作成するためにLangGraph 始める前に、次のことを確実にします。 - : AWSアカウントにBedrockアクセスが必要です - : AWSアカウントがAnthropic Claude 3.7 Sonnetモデルにアクセスできることを確認してください - : 適切な資格情報と権限で構成 - : このプロジェクトでは、Python 3.13またはnewerが必要です - : 依存関係管理とビルド(pip install uvでインストール) 2.
概要(AI 翻訳)
本プロジェクトでは、Amazon BedrockとChainlitとMCP(Model Context Protocol)サーバーのファンデーションモデルを統合し、ツール機能でインタラクティブなチャットインターフェイスを作成する方法を説明します。
プロジェクト概要
このサンプル アプリケーション ショーケース:
- Anthropic Claude 3.7 Sonnet を使用したAmazon Bedrockとの統合
- 対話型AIインタラクションのためのChainlit Webインターフェイス
- 基本的な数学操作を実行するカスタムモデルコンテキストプロトコル(MCP)サーバー
- スムーズなユーザーエクスペリエンスに対する応答のストリーミング
- MCP アダプターとの LangChain の統合は外的な用具を接続します
- ツールの使用をオーケストラにするReAct(Reasoning and Acting)エージェントを作成するLangGraph
前提条件
始める前に、次のことを確実にします。
-AWSアカウント: BedrockアクセスでAWSアカウントが必要です -Bedrock Access:AWSアカウントがAnthropic Claude 3.7 Sonnetモデルにアクセスできることを確認してください
- ** AWS CLI**: 適切な資格情報と権限の設定
- Python 3.13+: このプロジェクトでは、Python 3.13 または newer が必要です。
-UV: 依存関係管理と建物([
pip install uvでインストール)の場合
インストール
-
リポジトリのクローン化:
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
Amazon Bedrock and MCP Server integration, the easy way
This project demonstrates how to integrate foundation models on Amazon Bedrock with Chainlit and MCP (Model Context Protocol) servers to create an interactive chat interface with tool-enhanced capabilities.
Project Overview
This sample application showcases:
- Integration with Amazon Bedrock using Anthropic Claude 3.7 Sonnet
- A Chainlit web interface for conversational AI interactions
- A custom Model Context Protocol (MCP) server that performs basic math operations
- Streaming responses for a smooth user experience
- LangChain integration with MCP adapters to connect external tools
- LangGraph for creating a ReAct (Reasoning and Acting) agent that orchestrates tool use
Prerequisites
Before getting started, ensure you have:
- AWS Account: You’ll need an AWS account with Bedrock access
- Bedrock Access: Ensure your AWS account has access to the Anthropic Claude 3.7 Sonnet model
- AWS CLI: Configured with appropriate credentials and permissions
- Python 3.13+: This project requires Python 3.13 or newer
- UV: For dependency management and building (install with
pip install uv)
Installation
-
Clone the repository:
git clone https://github.com/aws-samples/sample-bedrock-mcp.git cd sample-bedrock-chainlit-mcp -
Create a virtual environment and install dependencies using UV:
uv sync --all-groups -
Configure AWS credentials (if not already done):
aws configure
Building from Source
To build the project from source using UV:
-
Build the package:
uv build
This will create distribution files in the dist/ directory, including the wheel file dist/sample_bedrock_chainlit_mcp-0.1.0-py3-none-any.whl that can be installed or used directly as the MCP server.
Usage Guide
Starting the Chainlit Application
To start the Chainlit application:
chainlit run src/ui/app.py
This will launch a web server (typically at ) with the chat interface.
Setting up the MCP Server
The Math MCP server needs to be connected to provide calculation capabilities:
- In the Chainlit web interface, look for the small plug icon under the chat text input element
- Click on it to open the MCP connection dialog
- Enter the following details:
- Name:
math - Command:
uvx dist/sample_bedrock_chainlit_mcp-0.1.0-py3-none-any.whl - Type: default (stdio)
- Name:
- Click “Confirm”
A successful connection will be indicated in the interface, and the math tools will become available to the Claude model.
Example Usage
Once the Chainlit application is running and the MCP server is connected, you can ask mathematical questions like:
- “What’s (3 + 5) x 12?”
- “Can you calculate 144 divided by 12?”
- “If I have 7 apples and get 9 more, then give 4 away, how many do I have left?”
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →