cafe-shop-mcp-agent
Cafe Shop MCP Agent - 詳細ドキュメント
システム概要
Cafe Shop MCP Agent("Bean & Brew")は、Model Context Protocol (MCP) エコシステムの高度な実装です。MCP の streamable-http トランスポートプロトコルを使用して安全に通信する2つのスタンドアロンサービスで構成されています。
このシステムは、AWS Bedrock 上で動作する LangChain ベースの ReAct エージェントを使用して、自然言語のコーヒーショップリクエストを処理し、MCP サーバーを介して PostgreSQL データベースに対してライブ在庫の照会と注文の実行を行います。
Related MCP server: @striderlabs/mcp-starbucks
1. アーキテクチャ詳細
1.1 クライアントインターフェース(client/)
クライアントは、ユーザー向け API および LangChain エージェントの実行環境として機能します。
フレームワーク: FastAPI
エージェントオーケストレーター: LangGraph + LangChain(
create_agent)LLM エンジン: AWS Bedrock(
ChatBedrock)永続化: スレッドレベルのメモリのための LangGraph AsyncPostgresSaver(チェックポインター)。
ミドルウェア統合:
SummarizationMiddleware: 2000トークンまたは10メッセージを超える履歴を圧縮します。PIIMiddleware: Bedrock に送信する前に、メールアドレスを編集し、クレジットカードをマスクし、電話番号を編集します。HumanInTheLoopMiddleware: 実行前に明示的な人間の承認を得るために、add_orderツール呼び出しをインターセプトします。
1.2 MCP サーバー(mcp_server/)
サーバーは、ドメインロジックとデータ境界を安全に公開します。
フレームワーク: FastMCP(
mcp.server.fastmcp)データベース: PostgreSQL(SQLAlchemy ORM 経由で管理)。
トランスポート: HTTP SSE(
streamable-http)。
2. API 契約とデータフロー
2.1 チャットエンドポイント(クライアント)
POST /api/v1/chat
リクエストペイロード(ChatRequest):
{
"message": "I'd like to order 2 Cappuccinos please.",
"mode": "normal",
"stream": false,
"thread_id": "user-session-id"
}注: mode は normal、structured、または空のままにできます。stream は、レスポンスが SSE か同期 JSON かを決定します。
レスポンスペイロード(ChatResponse - ノーマルモード):
{
"message": "I have set up your order for 2 Cappuccinos. Before I finalize it, do you approve?",
"structured_output": null,
"stream_chunks": null,
"pending_approval": {
"tool": "add_order",
"args": {"customer_name": "Guest", "items": [{"item_name": "Cappuccino", "quantity": 2}]},
"description": "Tool add_order requires approval."
}
}(pending_approval が存在する場合、次のリクエストの message は同じ thread_id で正確に "approve" または "reject" である必要があります)。
2.2 データベーススキーマ(MCP サーバー)
PostgreSQL データベースは、4つの主要テーブルで構成されています:
menu_items:menu_item_id(PK)、name(一意)、price(Numeric)、stock_quantity(int)、is_active(bool)。orders:order_id(UUID PK)、order_sequence_id(BigInt シーケンス)、customer_name(str)、status(str)。order_items:ordersとmenu_itemsをquantity列でリンクするジャンクションテーブル。error_logs:log_id、error_code、message、source。
3. Model Context Protocol (MCP) バインディング
FastMCP サーバーは、以下のコンポーネントを明示的に登録します。クライアントは、セッション初期化中(load_session_context)にこれらを無条件にロードします。
3.1 ツール(@mcp.tool())
ツール名 | 引数 | 戻り値 | 説明 |
| なし |
| アクティブなメニュー項目( |
|
|
| 整数のシーケンス ID を検索して、注文ステータス( |
|
|
| 注文を確定し、シーケンス ID を生成し、在庫 |
3.2 プロンプト(@mcp.prompt())
brew_buddy_system: 役割、目的、制約、出力形式をフォーマットする主要な ReAct エージェントの指示(XML タグ<role>、<instructions>を使用)。order_confirmation(customer_name, items): 温かみのあるフォーマット済みの確認レシートを生成します。
3.3 リソース(@mcp.resource())
menu://items: ライブメニューと価格の読み取り専用テキストダンプ。store://info: 営業時間、所在地、連絡先ポリシーを含む静的文字列。
4. セットアップと実行手順
4.1 前提条件
PostgreSQL がローカルまたは Docker 経由で実行されていること。
AWS Bedrock へのアクセス(AWS 認証情報が設定されていること)。
Python 3.11+ と
uvパッケージマネージャー。
4.2 MCP サーバーを起動する
mcp_server/ に移動し、.env を DB_HOST、DB_USER、DB_PASS などで更新して、以下を実行します:
uv sync
python main.pyこれにより、データベースマイグレーション(create_tables.py)が自動的にトリガーされ、デフォルトのコーヒーメニューがシードされ、FastMCP がポート 8000 で起動します。
4.3 クライアント API を起動する
client/ に移動し、.env を AWS と MCP サーバーの認証情報(MCP_SERVER_URL=http://localhost:8000)で更新して、以下を実行します:
uv sync
python main.pyこれにより、ユーザー向け FastAPI アプリケーションがポート 8080 で起動します。
4.4 ワークフロー例
ユーザーがメニューを尋ねる:
POST /api/v1/chat-> エージェントがmenu://itemsリソースを読み取ります。ユーザーが注文する:
POST /api/v1/chat-> エージェントがadd_orderを呼び出します。HITL ミドルウェアがインターセプトしてpending_approvalを返します。ユーザーが承認する:
POST /api/v1/chat(message: "approve"、同じ thread_id)-> クライアントが LangGraph チェックポインターの状態を再開 -> ツールが MCP サーバー上で実行 -> DB の在庫が減少します。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Let AI agents query data and act across all your business apps via MCP.
Hosted MCP for e-commerce: live product catalog, stock, and pricing for AI agents.
Connect e-commerce and marketing data to AI assistants via MCP.
Related MCP Servers
- FlicenseBqualityCmaintenanceAn MCP adapter that maps Coffee Company B2B HTTP APIs to MCP tools, allowing AI agents to query member information, benefits, coupons, and payment statuses. It enables seamless integration for AI assistants to manage coffee-related customer assets and loyalty details through natural language.101
- AlicenseAqualityDmaintenanceMCP server for Starbucks — let AI agents search the menu, customize drinks, find stores, place mobile pickup orders, and manage Starbucks Rewards.16141MIT
- AlicenseNot gradedqualityCmaintenanceEnables cataloging and managing personal inventory (items, attachments) through natural language, allowing users to add, search, update, and retrieve item details and attachments via MCP tools.1MIT
- FlicenseNot gradedqualityBmaintenanceEnables coffee shop order management via MCP, including menu lookup, order creation, and status tracking.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rizhwan05/cafe-shop-mcp-agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server