JB

juspay/bedrock-mcp-connector

Developer tools공식

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

2 stars 6 forks 품질 40 트렌드 8

A connector to connect agentic models to MCP tools

개요

A TypeScript client for interacting with AWS Bedrock and MCP (Model Context Protocol) servers. - Seamless integration with AWS Bedrock's Converse API - Support for Claude and other Bedrock models - Connect to MCP servers to discover and use available tools - Register custom tool handlers - Event-based architecture for streaming responses - TypeScript support with full type definitions - Command-line interface for interactive usage - Modular design for easy integration into other projects The package supports both in-memory and Redis storage for conversation history: Tools are a powerful feature that allow the LLM to perform actions and access external data. This section provides detailed guidance on how to create and register tools effectively. The registerTool method takes four parameters: 1. : Each tool should do one thing well 2. : Use descriptive, action-oriented names (e.g., getCurrentTime, searchDatabase) 3.

README

원문 README의 일부입니다. 원문 보기.

Bedrock MCP Connector

A TypeScript client for interacting with AWS Bedrock and MCP (Model Context Protocol) servers.

Features

  • Seamless integration with AWS Bedrock’s Converse API
  • Support for Claude and other Bedrock models
  • Connect to MCP servers to discover and use available tools
  • Register custom tool handlers
  • Event-based architecture for streaming responses
  • TypeScript support with full type definitions
  • Command-line interface for interactive usage
  • Modular design for easy integration into other projects

Installation

npm install @juspay/bedrock-mcp-connector

Usage

Basic Usage

import { BedrockMCPClient, LogLevel } from "@juspay/bedrock-mcp-connector";

// Create a client
const client = new BedrockMCPClient({
  modelId: "anthropic.claude-3-sonnet-20240229-v1:0",
  region: "us-east-1",
  systemPrompt: "You are a helpful assistant.",
  mcpServerUrl: "http://localhost:5713/sse", // Optional
});

// Set the log level (optional)
// LogLevel.INFO - Default, shows important information
// LogLevel.DEBUG - Shows detailed debugging information
// LogLevel.WARN - Shows only warnings and errors
// LogLevel.ERROR - Shows only errors
// LogLevel.NONE - Suppresses all logs
client.setLogLevel(LogLevel.INFO);

// Connect to MCP server (if URL is provided)
if (client.mcpServerUrl) {
  await client.connect();
}

// Send a prompt
const response = await client.sendPrompt("What is the capital of France?");
console.log("Response:", response);

// Disconnect when done
if (client.isConnectedToMCP()) {
  await client.disconnect();
}

Using Redis for Persistent Storage

The package supports both in-memory and Redis storage for conversation history:

import { BedrockMCPClient } from "@juspay/bedrock-mcp-connector";

// Using Redis storage for persistent conversations
const client = new BedrockMCPClient({
  modelId: "anthropic.claude-3-sonnet-20240229-v1:0",
  region: "us-east-1",
  sessionId: "user-session-123", // Unique session identifier
  userId: "user-456", // Optional user identifier
  storage: {
    type: "redis",
    config: {
      host: "localhost",
      port: 6379,
      password: "your-redis-password", // Optional
      db: 0, // Redis database number
      keyPrefix: "bedrock-mcp:", // Key prefix for Redis keys
      ttl: 86400, // TTL in seconds (24 hours)
      connectionOptions: {
        connectTimeout: 5000,
        lazyConnect: true
      }
    }
  }
});

// Conversations are now persistent across client restarts
const response = await client.sendPrompt("Remember this: my favorite color is blue");
console.log("Response:", response);

// Later, in a new client instance with the same sessionId...
const newClient = new BedrockMCPClient({
  modelId: "anthropic.claude-3-sonnet-20240229-v1:0",
  region: "us-east-1",
  sessionId: "user-session-123", // Same session ID
  storage: { type: "redis", config: { /* same config */ } }
});
GitHub에서 전체 README 보기

설치

npx @juspay/bedrock-mcp-connector
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →