0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MCPサーバーとQiita自動投稿ツールの構築・運用まとめ

Last updated at Posted at 2025-04-24

概要

本記事では、Model Context Protocol (MCP) Python SDKを用いたMCPサーバーの構築、およびQiita APIを利用した自動記事投稿ツールの実装・運用方法についてまとめます。

1. MCPサーバーの構築

  • MCP公式SDK(modelcontextprotocol, mcp)を利用
  • from mcp.server.fastmcp import FastMCP でサーバーインスタンス作成
  • @mcp.tool() デコレータでツール(例: Qiita投稿)を登録
  • サーバー起動は if __name__ == "__main__": mcp.run() でOK

2. Qiita投稿ツールの実装

  • MCPツールとして post_qiita_article を実装
  • 引数は「記事データファイルパス(str)」または「記事データ本体(dict)」両対応
  • .envにQIITA_TOKENを保存し、API認証に利用
  • 記事データはQiita API仕様(title, body, tags, private等)に準拠

3. テスト・運用

  • テストコードや送信データ、スクリーンショットは用途ごとにディレクトリ分離(TestCodes, QiitaArticles, Screenshots等)
  • MCP InspectorやClaude Desktopからサーバーを呼び出し、ツール経由で記事投稿可能

4. 参考


この記事は自動生成・自動投稿の検証用です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?