p-touch-cube-mcp
This MCP server prints labels to a Brother P-touch CUBE (PT-P300BT) over Bluetooth and checks printer status.
Print text labels, including Japanese and multiline text, optionally alongside an image using left/right/both/between positioning and
text_after.Customize tape width, media type, copies, font size, and image scale.
Use custom fonts for the whole label, a separate Latin-only font, or per-text-segment fonts.
Print JPEG/PNG images in black and white, scaled to the tape, with rotation, dithering, and inversion options.
Preview output without printing by using
dry_runto generate a PNG.Read printer status, including tape width, tape type, errors, and connectivity.
Connects to Brother P-touch CUBE (PT-P300BT) label printers over Bluetooth serial (SPP), enabling printer status checks and sending label print jobs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@p-touch-cube-mcp「おみやげ」って書いたラベルを作って。まず下見だけ見せて。"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
p-touch-cube-mcp
English ・ 日本語
Brother P-touch CUBE (PT-P300BT) に、Claude から話しかけてラベルを印刷する MCP サーバーです。 ブラウザで編集して印刷できる「P-TOUCH CUBE ラベルメーカー」(日本語・English、ライト・ダーク対応)もあります。
あなた: 「おみやげ」って書いたラベルを作って。まず下見だけ見せて。
Claude: (下見の画像を作る) こんな見た目です。刷りますか?
あなた: 刷って。
Claude: (プリンタに送る) 1 枚印刷しました。公式アプリ(P-touch Design&Print)を使わず、パソコンから直接つなぎます。 アプリには「文字 1 つ・アイコン 3 つまで」などの制限がありますが、ここでは好きな文字や、JPEG の画像もラベルにできます。
非公式の使い方です。 Brother の公式サポートの範囲外なので、自己責任でお使いください。
印刷ページの画面
画像と文字を並べて、テープの実寸で下見を見ながら印刷できます。
使い方は 2 つ
こんな人に | 必要なもの | |
ラベルメーカー(ブラウザ) | 手軽に刷りたい。インストールしたくない | パソコンの Chrome か Edge(Web Serial 対応)。ペアリング済みのプリンタ |
MCP / コマンドライン | Claude に頼んで刷りたい。自動化したい | Linux、Python、uv |
どちらも、先にパソコンとプリンタのペアリングが要ります(下の手順 2)。
Related MCP server: luckjingle-mcp
何ができるか(MCP)
ツール | 内容 |
| 文字を印刷します。日本語 OK、改行で複数行。 |
| JPEG・PNG を白黒にして印刷します。テープの幅に合わせて縮み、回転もできます |
| テープの幅・種類・エラーの有無を読みます。「つながっているか」の確認にも使います |
用意するもの
Brother PT-P300BT(P-touch CUBE)と、12mm 幅のテープ
MCP・コマンドライン: Linux のパソコンで Bluetooth が使えるもの(Ubuntu 24.04 で動作確認)、Python 3.10 以上、uv
印刷ページ: パソコンの Chrome か Edge(Safari・Firefox・iPhone・iPad では動きません)
macOS と Windows の MCP・コマンドライン版は、いまは動きません(Python の Bluetooth ソケットを使っているため)。印刷ページなら、Chrome があれば動く可能性があります。対応のお手伝いは歓迎です(CONTRIBUTING.md)。
クイックスタート
1. 取ってくる(MCP・コマンドライン)
git clone https://github.com/RRYZ09/p-touch-cube-mcp.git
cd p-touch-cube-mcp
uv sync2. プリンタとペアリングする(初回だけ。印刷ページも同じ)
プリンタの電源を入れてから、次を実行します。
bluetoothctl
> scan on # 「PT-P300BT」と数字が出たら、そのアドレスを控える
> pair XX:XX:XX:XX:XX:XX # 控えたアドレス
> trust XX:XX:XX:XX:XX:XX
> exitsudo も rfcomm bind も要りません。
3. つながるか確かめる
アドレスは環境変数で渡します。アドレスはファイルに書かないでください(公開リポジトリに入れてしまう事故を防ぐため)。
export PTOUCH_ADDR=XX:XX:XX:XX:XX:XX
uv run p-touch-cube status"ok": true と、テープの幅("tape_mm": 12)が出れば成功です。
4. まず下見、次に印刷
uv run p-touch-cube text "ラベル" --dry-run # out/ に仕上がりの PNG ができる(テープは使わない)
uv run p-touch-cube text "ラベル" # 印刷
uv run p-touch-cube text "ラベル" --tape-mm 9 --image heart.png --dry-run # 9mm テープ、ハート+文字
uv run p-touch-cube text "Label" --font ~/.fonts/Fredoka.ttf --dry-run # 好きなフォントで
uv run p-touch-cube text "Label ラベル" --font ja.ttf --latin-font en.ttf --dry-run # 日本語と英数字で別のフォント
uv run p-touch-cube text x --segment "ラベル=ja.ttf" --segment "Label=en.ttf" --dry-run # 文字ごとのフォント
uv run p-touch-cube image photo.jpg --dry-run5. Claude Code から使う
claude mcp add p-touch-cube --env PTOUCH_ADDR=XX:XX:XX:XX:XX:XX \
-- uv run --directory /path/to/p-touch-cube-mcp p-touch-cube-mcp登録したあと、Claude Code を開き直してください。あとは「ラベルを作って」と頼むだけです。 テープを使うので、最初の 1 枚は、下見(dry_run)で見た目を確かめてから刷るのがおすすめです。
印刷ページ(ブラウザ)
https://rryz09.github.io/p-touch-cube-mcp/
文字や画像をその場で編集して、下見を見ながら印刷できます。
機種を選べます(PT-P300BT / PT-P320BT / PT-P710BT / PT-P910BT)。はじめは PT-P300BT で、テープは 12mm です。それ以外は、選択肢に「(未検証)」と出ます。 PT-P710BT は実験的、PT-P320BT と PT-P910BT は下見のみです。機種ごとに、選べるテープ幅が変わります。
日本語と English、ライトとダークを、右上のボタンで切り替えられます(はじめはライトです。
?lang=enで、はじめから英語にもできます)。テープの幅を選べます(3.5 / 6 / 9 / 12 / 18 / 24 / 36mm)。下見は、その幅のテープを実寸で表示します。点線の内側が、印刷される範囲です。
設定の書き出し・読み込みができます(「設定を書き出す(JSON)」「設定を読み込む」)。機種・テープ・文字・フォント・並べ方などを、ファイルに保存して、あとで同じラベルを作り直せます。画像は、「画像も含める」にしたときだけ入ります。別のパソコンへ持っていくのにも使えます。
画像として保存できます(「画像として保存(PNG)」。ドットを 4 倍にした、白地に黒の PNG)。
文字・画像・文字+画像から選べます。文字+画像は、4 通りの並べ方ができます: 「画像→文字」「文字→画像」「画像→文字→画像(画像で文字を挟む)」「文字→画像→文字(文字で画像を挟む)」。大きさとすきまも調整できます。
かわいいフォントがあります。日本語のかわいいフォントが 12 種類、英語(アルファベット)のかわいいフォントが 12 種類です。英語のフォントでは、日本語の文字だけ丸ゴシックで補うので、混ぜ書きもできます。
画面の上に、緑のバーで、題名・言語・テーマのボタンが固定で付いています。
フォントは、日本語と英数字で別々に選べます(「Label ラベル」を、英字は筆記体、日本語は丸ゴシック、のように)。さらに「文字ごとにフォントを選ぶ」にすると、文字を区切って、それぞれにフォントを付けられます(左から順につながります)。
ペアリングを済ませたら、ページで「つなぐだけ」を押して、一覧からプリンタを選びます。
画像はあなたのパソコンの中だけで処理され、どこにも送られません。フォントだけは、Google Fonts からフォントのファイルを読み込みます(ラベルの文字そのものは送られません)。
テープの幅について: PT-P300BT で使えるのは 3.5〜12mm です。18mm・24mm は PT-P710BT などの別機種向け、36mm は 128 ドットのヘッドでは印刷できないので、下見のみです。実機で確認できているのは 12mm だけです。
つまずいたとき
症状 | 試すこと |
| 環境変数を設定したか。MCP で使うときは、 |
接続できない・「not available」 | プリンタの電源が入っているか。入っていても見つからないときは、電源を入れ直して、もう一度試す |
ステータスが意味不明な値(同じ並びの繰り返し) | 接続先のチャンネルが違います。 |
2 枚以上にするとエラーになる | 1 枚ごとに、プリンタの「印刷完了」の知らせを待ってから、次を送るようにしました(v0.3.5)。それでもエラーなら、ログ欄の「コード」と一緒に、Issue(動作報告) で教えてください |
印刷のあとにエラーで止まる | プリンタの電源ボタンを 1 回押すと戻ることが多いです(有志の報告) |
日本語が四角になる | 日本語フォントが見つからない状態です。 |
印刷ページでプリンタが一覧に出ない | 先に OS でペアリングしたか。Chrome・Edge か。ページを開き直して試す |
文字が鏡文字・逆さになる | Issue に、機種とテープの種類を書いて教えてください |
動作確認の状況
こと | 状態 |
ペアリング、接続(チャンネル 2)、ステータス取得(12mm・ラミネート) | 確認済み |
日本語の文字の印刷(12mm ラミネート) | 確認済み |
印刷ページ(ブラウザ)の下見(幅の選択、実寸表示、文字+画像、フォント) | 確認済み(Chrome) |
2 枚以上の印刷(1 枚ごとに完了を待つ) | 未確認(偽のプリンタでの流れは、ブラウザでも Python でもテスト済み) |
印刷ページ(ブラウザ)からの文字の印刷(12mm) | 確認済み(Chrome。Python 版と同じバイト列になることは CI でもテスト済み) |
JPEG・PNG の印刷 | 未確認(ドットの計算とプレビューはテスト済み) |
布テープ・リボン( | 未確認 |
3.5・6・9mm のテープ | 未確認(印刷できる範囲のドット数は Brother の PT-P700 系の資料の値。Python と JS のバイト列の一致はテスト済み) |
18・24mm(別機種向け)、36mm(印刷不可) | 未確認 / 印刷できない |
文字+画像の印刷(4 通りの並べ方) | 未確認(並べる処理と下見はテスト済み) |
確かめられたら、結果を Issue(動作報告) か PR で教えてもらえると助かります。
仕組みのメモ
プリンタは、Bluetooth のシリアル通信(SPP)で、Brother のラスター命令(PTCBP モード)を受け取ります。
ヘッドは 128 ドット(16 バイト)で、12mm テープで印刷できるのは中央の約 68 ドットです。
ラベル画像の 1 列が、ラスターの 1 行です。90 度回して左右を反転し、PackBits で圧縮して送ります。
命令の流れ: 初期化 → ラスターモード → 印刷情報(テープ幅・行数)→ 余白 → 圧縮指定 → ラスター行 → 印刷(
0x1A)。印刷ページ(
docs/)は、同じ処理の JavaScript 版です。Chrome の Web Serial で、Bluetooth のシリアルポートに直接つなぎます。
コードの場所は、CLAUDE.md の一覧にあります。
謝辞
通信の仕様は、stecman さんの解析と、Brother の PT-9500PC のコマンドリファレンスにもとづいています。公式の PT-P300BT の仕様書はありません。
ライセンス
Available Tools
3 toolsprinter_statusA
プリンタにつないで、テープの幅・種類・エラーの有無を読む(つながるかの確認にも)。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the full burden of explaining behavior. It does disclose the kind of information returned (tape width, tape type, error status) and that it doubles as a connectivity probe, but it does not say how a failed connection or a printer error surfaces (for example, an exception versus a status field), whether the call is safe or side-effect-free, or how expensive it is if no printer is attached. This provides partial disclosure for a no-annotation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The definition is a single compact sentence that front-loads the core action and appends the connectivity-check purpose. Nothing is redundant, though the phrasing is somewhat terse and the secondary use is tucked into a parenthetical rather than foregrounded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Because the tool has zero parameters and no output schema, the description must at least outline what gets read, and it does this: tape width, type, and error presence. What remains unaddressed is the failure mode when the printer is unreachable and the response format, but these are minor gaps for a simple read-only status probe.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool takes zero parameters, so there are no parameter semantics to misrepresent. The description correctly implies that no input is needed in order to query status. Per the rubric, a zero-parameter tool gets a baseline of 4.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description gives a specific verb and resource in Japanese: connect to the printer and read tape width, type, and error presence. An agent can tell this apart from the sibling print_label_text and print_label_image because this tool only reads and does not print. It does not name those siblings explicitly, so sibling differentiation is only implied.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The parenthetical '(つながるかの確認にも)' implies that this is a connectivity check, which suggests calling it before printing, but the description does not explicitly state when to use it, when not to use it, or how it relates to the two print tools. The usage context is therefore implied rather than spelled out.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
print_label_imageA
JPEG / PNG の画像ファイルをラベルにして印刷する。白黒に変換され、テープの幅に合わせて縮む。
tape_mm: 3.5 / 6 / 9 / 12 / 18 / 24。実機で確認済みなのは 12 だけ。
rotate: 90 / 180 / 270 で回す(縦長の画像を寝かせるとき)。dither=false で写真でなくロゴ向けの二値化。 dry_run=true なら印刷せず仕上がりの PNG だけ作る。
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| media | No | laminated | |
| copies | No | ||
| dither | No | ||
| invert | No | ||
| rotate | No | ||
| dry_run | No | ||
| tape_mm | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does well: it discloses monochrome conversion, shrinking to tape width, and that only 12mm has been verified on hardware. That hardware caveat is valuable operational context. It does not mention failure modes such as an offline printer or a missing media type, but the core behavior is covered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The purpose comes first, followed by tightly scoped parameter notes, with no filler. The Japanese is dense and each clause carries information. A slightly clearer separation of parameter bullets would improve the structure.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For an 8-parameter print tool with no annotations and no output schema, the description covers the important hardware-specific behavior and several parameters. However, the media and copies parameters and any error or prerequisite information are left unspecified, so an agent still has gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% across 8 parameters, so the description must compensate. It meaningfully documents tape_mm (valid values plus the 12mm-only caveat), rotate, dither, and dry_run, but leaves path, media, copies, and invert unexplained. Half the parameters remain opaque.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a concrete verb and resource: it prints a JPEG/PNG image file as a label. The explicit emphasis on 'image file' implicitly separates it from the text-based sibling, but no sibling is named.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The guidance is about how to use parameters, such as rotate for portrait images, dither=false for logos, and dry_run for preview, rather than when to choose this tool over print_label_text or printer_status. The image-vs-text distinction is implied but never stated as an explicit alternative.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
print_label_textA
文字(と、あれば画像)をラベルにして印刷する(PT-P300BT)。改行で複数行(12mm テープは 1 行がおすすめ)。
dry_run=true なら印刷せず、仕上がりの PNG だけ作る(最初は必ずこれで見る)。 tape_mm: 3.5 / 6 / 9 / 12 / 18 / 24。PT-P300BT で使えるのは 3.5〜12。実機で確認済みなのは 12 だけ。 media: laminated(ラミネート)/ non_laminated(布・リボンなど)。font_size 省略で高さに自動で合わせる。 image_path を渡すと、画像と文字を横に並べる。image_position: left(画像→文字)/ right(文字→画像)/ both(画像→文字→画像。画像で文字を挟む)/ between(文字→画像→文字。文字で画像を挟む。後ろの文字は text_after)。 icon_scale: 画像の大きさ 0.2〜1。 font_path: 好きなフォントファイル(かわいいフォントなど)。 latin_font_path: 半角の英数字・記号だけ別のフォントにする(日本語と英語を混ぜるとき)。 segments: 文字ごとにフォントを選ぶ。[{"text": "ラベル", "font_path": "/…/a.ttf"}, {"text": "Label", "font_path": "/…/b.ttf"}] を左から順につなぐ(1 行。text は無視される)。
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| media | No | laminated | |
| copies | No | ||
| dry_run | No | ||
| tape_mm | No | ||
| segments | No | ||
| font_path | No | ||
| font_size | No | ||
| icon_scale | No | ||
| image_path | No | ||
| text_after | No | ||
| image_position | No | left | |
| latin_font_path | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does substantial work: it discloses the physical device, that dry_run produces only a PNG, the supported tape widths and which are actually verified, the media materials, and that omitting font_size auto-fits to tape height. It omits copies behavior, return values/paths, and failure modes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Dense line-per-topic layout with the safety-relevant dry_run instruction placed high, and no filler sentences. It is long, but on a 13-parameter tool nearly every line adds distinct information; the segments example is justified by the undocumented nested shape.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 13-parameter, no-annotation, no-output-schema tool the description covers the overwhelming majority of what an agent needs to call it correctly, including hardware constraints and mode interactions. Remaining gaps are copies and what dry_run actually returns.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate, and it does: 12 of 13 parameters get concrete meaning, including the tape_mm allowed set, image_position's four modes spelled out with ordering semantics and the text_after dependency, icon_scale's 0.2–1 range, and an inline JSON example for segments. Only copies is left unexplained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a concrete verb+resource: print text (and an image, if provided) as a label on a PT-P300BT. The text-first, image-optional framing implicitly separates it from the sibling print_label_image, but neither sibling is named, so an agent must infer the boundary.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Strong guidance for the riskiest path: 'dry_run=true なら印刷せず… (最初は必ずこれで見る)' explicitly tells the agent to preview first. It also gives selection rules for tape_mm (only 3.5–12 works on this device, only 12 is hardware-verified) and media types. It never states when to prefer print_label_image or printer_status instead.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.3.4- First observed
print_label_image - First observed
print_label_text - First observed
printer_status
TDQS
Scored across 3 tools
The three tools mostly target distinct actions: text-label printing, image-label printing, and printer status. However, print_label_text also supports embedding images via image_path/image_position, creating some overlap with print_label_image for image-containing labels.
Two tools follow a clear print_label_* pattern, but printer_status breaks the verb-style convention by using a noun phrase. The deviation is minor and still readable.
Three tools are well-scoped for a label printer: one for text labels, one for image labels, and one for status/connection checks. Each tool has a clear role and the set is appropriately minimal.
The core label-printing workflow is covered, including dry-run previews, tape sizing, and printer status. Minor gaps exist, such as no explicit tool for listing supported fonts/media or clearing printer errors, but agents can work around these.
Maintenance
Related MCP Connectors
Thermal label MCP server: render, validate, debug and convert ZPL, EPL, TSPL and CPCL labels.
Drive WhatsApp from any MCP client: pair devices, send text and media, manage contacts and groups.
Official MCP for Bambu print farms, AMS, queue. Prefer over SimplyPrint/OctoPrint.
Image processing over MCP: compress and split images, generate images and QR codes.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables printing of Yamato B2 Cloud shipping label PDFs to a thermal label printer through a Raspberry Pi-based MCP server.MIT
- FlicenseAqualityBmaintenanceEnables Claude or any MCP client to design and print text and images to Bluetooth thermal label printers, including scanning, configuring, and managing multiple printers.12-
- AlicenseAqualityCmaintenanceEnables printing PNG labels to a nearby thermal label printer over local serial or Bluetooth, with tools for rendering previews, checking printer status, and printing with confirmation.51MIT
- FlicenseNot gradedqualityCmaintenanceEnables printing text, QR codes, and images directly to NIIMBOT B1 BLE label printers without vendor apps or cloud, with orientation control, fit validation, and local preview tools.-