bedrock-claude-chat
bedrock-claude-chat copied to clipboard
MCP client
Issue #, if available: https://github.com/aws-samples/bedrock-claude-chat/issues/816
Description of changes: This PR implements MCP client feature.
This supports remote MCP server through Streamable HTTP transport (2025-03-26) by requests based implementation. This also supports AWS IAM authentication (SIGv4A).
This PR doesn't include any configuration UI.
This PR is ~~not fully tested yet~~ tested against official TypeScript SDK and Lambda Web Adapter based deployment (with IAM auth).
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
@suzuki-safie Thank you for your proposal. Could you explain the intended user experience? (If possible, pseudo-screenshots would help us understand better.)
@statefb Basic usecase:
- A developer (who can modify and deploy bedrock-claude-chat) deploys an MCP server on the network. If the MCP server doesn't support Streamable HTTP transport, a proxy is required. In my particular case, I'm trying to host MCP servers on AWS Lambda with IAM authentication.
- The developer registers the MCP server as an additional AgentTool in backend/app/agents/utils.py
def get_available_tools() -> list[AgentTool | AgentToolBundle]: tools: list[AgentTool | AgentToolBundle] = [] tools.append(internet_search_tool) tools.append(bedrock_agent_tool) tools.append(MCPAgentTool( name="mcp", description="MCP server", url="https://example.lambda-url.ap-northeast-1.on.aws/mcp", aws_sigv4a_service="lambda", )) return tools - Users (with CreatingBotAllowed permission) can create a bot with the mcp tool.
- Users can chat with the bot using tools provided by MCP.
If remote MCP servers becomes popular, it would be nice to have a GUI to manage them like internet_search_tool.
@suzuki-safie Thank you for your response. This is a good start, but I have some feedback on making it align better:
-
Accessibility for non-technical users: BrChat is designed to be accessible to users without deep technical knowledge. We should provide a proper configuration UI to make this feature truly accessible.
-
Configuration approach: Ideally, users would configure MCP servers directly from the bot creation screen, similar to how VSCode extensions or Anthropic Claude Desktop work (json configuration). ~~The problem is almost use-cases need local MCP server, which is currently difficult to align the concept.~~ ~~As you mentioned on the issue, remote MCP server is not mature enough (growing rapidly though), so it might not be a good timing to implement, which means user needs to build and run their own server by wrapping API Gateway as you did~~ Some early adopter like Notion serves their own MCP server, which can be a good point to start.
Tested against https://github.com/modelcontextprotocol/typescript-sdk/blob/df8701937de07074d96438a59be7f6c344f9d359/src/examples/server/simpleStreamableHttp.ts
Thank you for your work on the MCP client implementation. Your technical approach looks solid and well-tested. One of the most prominent advantage of MCP would be "easy configurable experience" like q dev cli, Cline or VSCode.
For example, user can setup MCP easily on bot configuration screen by editing JSON like:
{
"mcpServers": {
"awslabs.aws-documentation-mcp-server": {
"command": "uvx",
"args": ["awslabs.aws-documentation-mcp-server@latest"],
"env": {
"FASTMCP_LOG_LEVEL": "ERROR"
},
"disabled": false,
"autoApprove": []
}
}
}
source: https://awslabs.github.io/mcp/servers/aws-documentation-mcp-server/#installation
I'm trying to host MCP servers on AWS Lambda
The following can be a bridge between lambda and MCP client.
https://awslabs.github.io/mcp/servers/lambda-mcp-server/
As discussed, we prioritize UX for non-technical users in this project. We'd welcome further discussion on how we might develop a user-friendly configuration interface together. If you're interested in collaborating on the UI aspect, we're happy to discuss ideas and approaches.
Yesterday, Anthropic (and many MCP providers) announced remote MCP. https://x.com/AnthropicAI/status/1917972747000692919 These MCP servers have OAuth2-based authentication but this implementation does not work with them properly. (because of OAuth2, per-user MCP configuration is required.)