Skip to content

v0.0.1: 公開APIを介してAIがChatworkを操作できるMCPサーバー#1

Merged
sudame merged 14 commits intomainfrom
v0
Mar 23, 2025
Merged

v0.0.1: 公開APIを介してAIがChatworkを操作できるMCPサーバー#1
sudame merged 14 commits intomainfrom
v0

Conversation

@sudame
Copy link
Copy Markdown
Collaborator

@sudame sudame commented Mar 19, 2025

まずは初期実装。

やったこと

  • プロジェクトのセットアップ
  • 公開APIのスキーマをZodで定義
  • 公開APIを操作できるMCPサーバーの定義

見送ったこと (次バージョン以降やると良いこと)

  • テストの整備
  • 自動デプロイの整備
  • READMEの充実
  • 各プロパティに対するメタ情報の付与

@sudame sudame requested a review from Copilot March 19, 2025 01:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the initial version ("V0") of the Chatwork MCP Server by setting up ESLint configuration, a CLI entry point, test and deployment workflows, and a complete set of API schemas and server routing for various Chatwork operations.

  • Added ESLint, Vitest, Dependabot, and GitHub workflow configurations
  • Implemented Chatwork client, API schemas using zod, and server tool routing for Chatwork endpoints
  • Updated README with usage instructions and provided a placeholder for tool callback tests

Reviewed Changes

Copilot reviewed 15 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
eslint.config.mjs ESLint configuration with JavaScript and TypeScript support
src/index.ts Main entry point connecting the MCP server
vitest.config.ts Vitest configuration using dotenv for environment variables
src/toolCallbacks.test.ts Placeholder test file for tool callbacks
src/chatworkClient.ts Chatwork API client implementation
.github/dependabot.yaml Dependabot configuration for daily npm updates
.github/workflows/deploy.yaml Deployment workflow stub
README.md README update with usage instructions for Chatwork MCP server
.github/workflows/check.yaml Workflow configuration for linting, type-checking, and testing
src/schema.ts Zod schemas for validating parameters for various API endpoints
src/server.ts Server routing for Chatwork endpoints using schemas and callbacks
Files not reviewed (4)
  • .clineignore: Language not supported
  • .prettierrc: Language not supported
  • cspell.json: Language not supported
  • package.json: Language not supported
Comments suppressed due to low confidence (1)

src/server.ts:225

  • The callback for 'list_incoming_requests' is set as listContacts, which may not correctly align with retrieving incoming contact requests. Please verify if the appropriate callback should be used or update the endpoint description accordingly.
server.tool('list_incoming_requests', '自分へのコンタクト承認依頼一覧を最大100件まで取得します。', listContacts,);

@sudame sudame requested a review from Copilot March 19, 2025 04:14
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the initial version ("V0") of the Chatwork MCP Server by adding configuration files, implementation for client/server communication, API schemas with Zod, and initial workflows/tests. Key changes include the ESLint configuration setup, implementation of the Chatwork client and server logic, and CI/CD configurations.

Reviewed Changes

Copilot reviewed 15 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
eslint.config.mjs Adds ESLint configuration with recommended settings.
src/index.ts Introduces the entry point for starting the server.
src/chatworkClient.ts Implements the Chatwork client for making API requests.
vitest.config.ts Sets up the testing configuration using Vitest.
src/toolCallbacks.test.ts Contains a placeholder for tests, marked as TODO.
.github/dependabot.yaml Adds Dependabot configuration for automatic dependency updates.
.github/workflows/deploy.yaml Provides a placeholder for deployment automation via GitHub actions.
README.md Updates documentation with usage instructions for the MCP server.
.github/workflows/check.yaml Configures CI workflows for linting, type checking, and testing.
src/schema.ts Introduces Zod schemas for validating API endpoint parameters.
src/server.ts Integrates tool callbacks with the MCP server framework.
Files not reviewed (4)
  • .clineignore: Language not supported
  • .prettierrc: Language not supported
  • cspell.json: Language not supported
  • package.json: Language not supported
Comments suppressed due to low confidence (1)

src/toolCallbacks.test.ts:3

  • Replace the placeholder test with concrete tests to ensure the tool callbacks functionality is properly covered.
// TODO!

Comment thread src/index.ts
await server.connect(transport);
}

main().catch(() => {
Copy link

Copilot AI Mar 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider logging the error message in the catch block before calling process.exit(1) to aid in debugging.

Suggested change
main().catch(() => {
main().catch((error) => {
console.error('An error occurred:', error);

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[将来的な話]
どうして停止したのか不明になるため、今後同様の処理を検討するのが良いだろう

@sudame sudame changed the title V0 v0.0.1: 公開APIを介してAIがChatworkを操作できるMCPサーバー Mar 19, 2025
@sudame sudame requested review from eiel and magcho March 19, 2025 04:19
Copy link
Copy Markdown
Member

@magcho magcho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Copy Markdown
Contributor

@eiel eiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

まだ npmにデプロイしていないため、npx で利用できない。そのためclaude_desktop_config.jsonを以下のような形にし、npm install & npm run build を行うことでClaud Desktopでマイチャットにメッセージを送信する形で動作確認した。

{
    "mcpServers": {
        "chatwork": {
            "command": "/abs/path/node",
            "args": ["xxxxxxx/chatwork-mcp-server/dist/index.js"],
            "env": {
                "CHATWORK_API_TOKEN": "XXXXX"
            }
        }
    }
}

使い方次第では動作しないケースが存在する可能性があるが、ドッグフーディングしながら修正していく。

Comment thread package.json
"AI"
],
"author": "kubell Co., LTD",
"license": "MIT",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[確認]ライセンスはMITを採用

on:
push:
branches:
- main
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[将来的な確認事項]
on.push.branchsがcheckと同じため、同時にdeployが始まってしまう。checkで失敗したにも関わらずdeployが発生しうる。
deployするもの次第では、checkの確認をするのが望ましい。

Comment thread src/index.ts
await server.connect(transport);
}

main().catch(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[将来的な話]
どうして停止したのか不明になるため、今後同様の処理を検討するのが良いだろう

Comment thread src/toolCallbacks.ts
const minifyListRoomsResponse = (
res: ChatworkClientResponse,
): ChatworkClientResponse => {
if (!res.ok || res.response.length < 2500) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[メモ]
サイズが大きすぎると通信に失敗する。そのため、2500文字で暫定対応している。
これが起きるのはListRoomだけではないが、ユースケースとして利用されることが多く、利用で致命的であるため対応されている。

@sudame sudame merged commit d2aa39d into main Mar 23, 2025
3 checks passed
@sudame sudame deleted the v0 branch March 23, 2025 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants