post_to_stream MCPツール: AIエージェントのメッセージをSlackストリームにマージ表示#141
Merged
Conversation
Claudeをloop等でエージェント的に稼働させた際、その発言をSlack経由ではなく 直接slack-cli-streamのコンソールにSlackメッセージと時系列マージで表示できる ようにする。 - core.display: data.synthetic分岐を追加し、Slack外ソースのメッセージは channel/userをID解決せず任意ラベルとしてchalk.cyanで表示 - core.postToStream: synthetic dataを組み立て display + buffer + SQLite記録の パイプラインに流す。slack_tsはnullなのでバックフィルを汚染しない - mcp-server: 書き込みツールpost_to_stream(text, channel?, user?)を追加し postToStreamを引き回し - test: post_to_streamのテスト3件追加 - README: MCPサーバー節とpost_to_streamのloop運用手順・表示イメージを追記 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- .gitignore: *.db / *.sqlite / *.sqlite3 / *.tsv を追加。 --log-sqlite / --log で生成される実Slackメッセージ入りファイルの 誤コミットを防止する - README: MCPサーバーが無認証であること、localhostバインドのまま利用し 0.0.0.0公開やポートフォワードを避ける旨の注意書きを追記 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Claude を loop 等でエージェント的に稼働させているとき、Claude が発するメッセージを Slack 経由ではなく直接 slack-cli-stream のコンソールに、Slack メッセージと時系列マージで表示できるようにします。既存の MCP サーバー(
--mcp-port)に書き込みツールpost_to_streamを1つ追加する形で実現しています。変更内容
lib/core.jscore.displayにdata.synthetic分岐を追加。Slack 外ソースのメッセージはchannel/userを Slack ID として解決せず、任意ラベルとしてchalk.cyanで表示(Slack 発言と視覚的にも区別)。core.postToStream(text, {channel, user})を追加。synthetic なdataを組み立て、コンソール表示 + バッファ投入 + SQLite記録の既存パイプラインに流す。slack_tsは null のためバックフィル処理を汚染しない。lib/mcp-server.jspost_to_stream(text必須 /channel・user任意、既定claude)を追加。postToStream未設定時はisErrorを返す。startMcpServer/buildMcpServer/registerToolsにpostToStreamを引き回し。test/mcp_server_test.js—post_to_streamのテスト3件(引数渡し / デフォルト / コールバック未設定エラー)。README.md— MCPサーバー節とpost_to_streamのセットアップ手順・表示イメージを追記。.gitignoreに*.db/*.sqlite/*.sqlite3/*.tsvを追加(実メッセージ入りログ/DBの誤コミット防止)。テスト
npm test(lint + mocha): 58 passing(既存55 + 新規3)。表示パイプライン(フォーマット・複数行継続・バッファ投入)はスモークテストで動作確認済み。
🤖 Generated with Claude Code