opencode-tokenrhythm-image-mcp
开发工具 活跃维护

opencode-tokenrhythm-image-mcp

bauerelizabeth07139/opencode-tokenrhythm-image-mcp

DeepSeek Harness plugin and OpenCode MCP server: generate images with TokenRhythm (qwen-image-2.0, wan2.7-image) and save them to a directory you choose. Exposes mcp__tokenrhythm_image__generate_image.

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
27 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:bauerelizabeth07139/opencode-tokenrhythm-image-mcp
git clone https://github.com/bauerelizabeth07139/opencode-tokenrhythm-image-mcp.git
git clone git@github.com:bauerelizabeth07139/opencode-tokenrhythm-image-mcp.git
README.md main

opencode-tokenrhythm-image-mcp

dsh.so risk

Text to image, straight to disk. qwen-image-2.0 or wan2.7-image
through TokenRhythm; the generated file lands in a directory you choose and its
path is returned to the model.

用 TokenRhythm 生成图片并直接落盘,把本地路径交回模型。

As a DeepSeek Harness plugin: the MCP server ships inside the bundle, so
installing one plugin is the whole setup — no mcpServers file to hand-edit.

Install

DeepSeek Harness Desktop — open Plugins in the sidebar, choose Add
plugin
, and enter:

https://github.com/bauerelizabeth07139/opencode-tokenrhythm-image-mcp

Then switch the new dsh-tokenrhythm-image bundle on. The Desktop app boots the
reserved desktop profile, so that is where it has to be enabled.

dsh CLI — install it into the profile you actually boot:

dsh plugin --profile web add bauerelizabeth07139/opencode-tokenrhythm-image-mcp

No git on the machine? pnpm resolves a git shorthand with git ls-remote,
which fails with 'git' is not recognized when git is missing. Use the tarball
instead — that path is plain HTTPS:

dsh plugin --profile web add https://codeload.github.com/bauerelizabeth07139/opencode-tokenrhythm-image-mcp/tar.gz/main

The same address works in the Desktop Add plugin dialog. Replace main
with a commit SHA to pin an exact revision (/tar.gz/<sha>).

Uninstall with dsh plugin --profile web remove dsh-tokenrhythm-image.

Requirements

  • Python ≥ 3.8 on PATH, or pointed at with python.
  • No third-party packages. The server is pure standard library.
  • A TokenRhythm API key in TOKENRHYTHM_API_KEY (or config.apiKey), plus
    network access to https://tokenrhythm.studio/v1.

Tools

The server registers 2 tool(s). DSH namespaces them automatically,
so the model calls them as mcp__tokenrhythm_image__<tool>:

Tool What it does
generate_image Generates up to four images and writes each one into the output directory, returning the local paths and the remote URLs. Parameters: prompt (required), model (qwen-image-2.0 or wan2.7-image), n (1–4), size.
list_image_models Lists the two TokenRhythm image models.

Configuration

Key Environment variable Default Meaning
python — discovered interpreter that runs the server
apiKey TOKENRHYTHM_API_KEY (empty) TokenRhythm credential
baseUrl TOKENRHYTHM_BASE_URL https://tokenrhythm.studio/v1 API base
outputDir TOKENRHYTHM_OUTPUT_DIR ~/Pictures/opencode-tokenrhythm where generated images are written
toolCallTimeoutMs — 360000 DSH's per-call budget; a single request may take 300 s
env — {} raw environment passthrough

Every field is optional and lives in the loader row. For example, in
cordis.patch.yml:

- id: dsh-tokenrhythm-image
  name: 'dsh-tokenrhythm-image'
  config:
    apiKey: 'sk-...'
    outputDir: 'D:/images/generated'
    toolCallTimeoutMs: 360000

Notes

  • Set outputDir. The server's default writes outside the workspace
    (~/Pictures/opencode-tokenrhythm on this platform). Point it somewhere you
    expect files to appear.
  • Timeouts. The server's own HTTP budget is 300 s for a generation request,
    so the plugin mounts with 360 s rather than the harness's 60 s default.
  • Paid API. Generation needs a working key and network access; without a key
    the tool returns TOKENRHYTHM_API_KEY environment variable is not set.

How it is mounted

index.js resolves a Python interpreter (the configured python, then
python3/python on PATH), hands the server its argv and working directory,
and mounts it as a stdio MCP server through @deepseek-ai/dsh-mcp-client with
failOnStartupError: true, so a server that cannot start is a visible error
rather than a silently missing tool.

Credentials are forwarded explicitly. The harness scrubs credential-shaped
variables (KEY, TOKEN, SECRET, PASSWORD) out of the environment a child
process inherits, so config.apiKey — falling back to the variable the server
documents — is written into the child's environment by the plugin itself. That
means both of these work:

config:
  apiKey: '<your key>'
export TOKENRHYTHM_API_KEY='<your key>'   # picked up at load time

Development

No build step and no runtime dependencies — @deepseek-ai/cordis and
@deepseek-ai/dsh-mcp-client are peers supplied by the Harness.

npm test    # node >= 22: manifest checks + the stdio mount, both Harness-free

The mount test loads index.js with @deepseek-ai/dsh-mcp-client stubbed and
asserts the exact stdio configuration the plugin produces, including the
credential forwarding above.

Repository layout

Path Purpose
index.js the DSH plugin: resolves the interpreter and mounts the server
cordis.patch.yml the loader row that activates the plugin
locale/{en,zh}.json card title and description for the plugin lists
assets/icon.svg card artwork
test/ npm test: manifest composition and the mount contract
server.py the MCP server, unchanged

Other hosts (unchanged)

The server is a plain stdio MCP server and still works anywhere else. The
repository's original README is kept verbatim as
README.opencode.md, and the launch stanza from it keeps
working:

{
  "mcp": {
    "tokenrhythm-image": {
      "type": "local",
      "command": ["python", "C:\\path\\to\\server.py"],
      "enabled": true,
      "environment": { "TOKENRHYTHM_API_KEY": "{env:TOKENRHYTHM_API_KEY}" }
    }
  }
}

License

MIT — the repository shipped no licence; this plugin's release adds one for the repository owner's own code.