Brightsy MCP サーバー
これは、Brightsy AI エージェントに接続するモデル コンテキスト プロトコル (MCP) サーバーです。
インストール
Related MCP server: Bluesky MCP Server
使用法
サーバーを起動するには:
npm start -- --agent-id=<your-agent-id> --api-key=<your-api-key>
または位置引数を使用する場合:
npm start -- <your-agent-id> <your-api-key> [tool-name] [message]
エージェントに送信する初期メッセージを指定することもできます。
npm start -- --agent-id=<your-agent-id> --api-key=<your-api-key> --message="Hello, agent!"
ツール名のカスタマイズ
デフォルトでは、MCPサーバーは「brightsy」という名前のツールを登録します。この名前は--tool-nameパラメータを使用してカスタマイズできます。
npm start -- --agent-id=<your-agent-id> --api-key=<your-api-key> --tool-name=<custom-tool-name>
ツール名を 3 番目の位置引数として設定することもできます。
npm start -- <your-agent-id> <your-api-key> <custom-tool-name>
または、 BRIGHTSY_TOOL_NAME環境変数を使用します。
export BRIGHTSY_TOOL_NAME=custom-tool-name
npm start -- --agent-id=<your-agent-id> --api-key=<your-api-key>
環境変数
サーバーを構成するために、次の環境変数を使用できます。
BRIGHTSY_AGENT_ID : 使用するエージェントID(コマンドライン引数の代替)
BRIGHTSY_API_KEY : 使用する API キー (コマンドライン引数の代替)
BRIGHTSY_TOOL_NAME : 登録するツール名(デフォルト: "brightsy")
agent_proxyツールのテスト
agent_proxyツールを使用すると、Brightsy AIエージェントへのリクエストをプロキシできます。このツールをテストするには、提供されているテストスクリプトを使用してください。
前提条件
テストを実行する前に、次の環境変数を設定します。
export AGENT_ID=your-agent-id
export API_KEY=your-api-key
# Optional: customize the tool name for testing
export TOOL_NAME=custom-tool-name
あるいは、次の値をコマンドライン引数として渡すこともできます。
# Using named arguments
npm run test:cli -- --agent-id=your-agent-id --api-key=your-api-key --tool-name=custom-tool-name
# Using positional arguments
npm run test:cli -- your-agent-id your-api-key custom-tool-name
テストの実行
すべてのテストを実行するには:
特定のテストを実行するには:
# Test using the command line interface
npm run test:cli
# Test using the direct MCP protocol
npm run test:direct
テストスクリプト
コマンドライン テスト( test-agent-proxy.ts ): テスト メッセージを使用して MCP サーバーを実行し、agent_proxy ツールをテストします。
直接 MCP プロトコル テスト( test-direct.ts ): 適切にフォーマットされた MCP 要求をサーバーに直接送信して、agent_proxy ツールをテストします。
ツールの仕組み
MCPサーバーは、OpenAI互換のAIエージェントにリクエストを転送し、レスポンスを返すツール(デフォルトでは「brightsy」という名前)を登録します。このツールは、 roleとcontentプロパティを持つメッセージオブジェクトの配列であるmessagesパラメータを受け取ります。
MCP クライアントでの使用例:
// Using the default tool name
const response = await client.callTool("brightsy", {
messages: [
{
role: "user",
content: "Hello, can you help me with a simple task?"
}
]
});
// Or using a custom tool name if configured
const response = await client.callTool("custom-tool-name", {
messages: [
{
role: "user",
content: "Hello, can you help me with a simple task?"
}
]
});
応答にはcontentフィールドにエージェントの返信が含まれます。