
Imagine Mcp
io.github.n24q02m由 GitHub 账号 n24q02m 发布v1.11.6更新于 Oct 24, 2026
MCP server for image/video understanding & generation (Gemini/OpenAI/Grok)
概览
已归档的 MCP 服务器,让助手理解图片和视频链接,并通过 Gemini、OpenAI 或 Grok 生成图片和视频。
- 可以做什么
- 根据提示词、提供商和档位,描述、分类或推理一个或多个图片与视频链接
- 用文本提示生成图片或视频,可选参考图、宽高比和时长,并通过 job id 轮询视频任务
- 查看和修改运行时设置,如凭据状态、默认提供商与档位、日志级别和响应缓存有效期
- 读取 understand、generate 和 config 工具的内置 Markdown 帮助
- 适用场景
- 适合助手需要在同一会话中查看图片或视频并产出新媒体的场景,用统一接口覆盖三家提供商,并可在廉价快速与高质量档位间切换。注意该项目已归档,README 建议改用图片提供商的原生 API;现有安装仍可使用,但不再获得更新或支持。
- 运行要求
- 通过 uvx 或 Docker 镜像以 stdio 在本地运行,也可自建 HTTP 守护进程。至少需要一个提供商密钥:GEMINI_API_KEY、OPENAI_API_KEY 或 XAI_API_KEY;stdio 模式下若都未设置则直接退出。可用 UNDERSTAND_MODELS、GENERATE_MODELS 等可选变量调整模型链。需要访问各提供商的网络。
安装
在 SourceWeft 中
- 打开 控制台中的 Imagine Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
ARCHIVED 2026-09-13 — This repository is no longer maintained. Use your image provider's native API instead of this MCP server. Existing installations keep working but receive no updates or support.
imagine-mcp
mcp-name: io.github.n24q02m/imagine-mcp
Image and video understanding + generation for AI agents -- across Gemini, OpenAI, and Grok.
[Mode: daemon · http remote relay] [CI] [codecov] [PyPI] [Docker] [License: Apache-2.0]
[Python] [FastMCP] [MCP] [semantic-release] [Renovate]
Sister projects from n24q02m (click to expand)
Table of contents
- Features
- Install
- Smithery
- Configuration
- CLI
- Remote (HTTP mode)
- Documentation
- Tools
- Comparison
- Security
- Build from Source
- Deploy to Cloudflare
- Deployment
- Trust Model
- Contributing
- License
Features
- Multimodal understanding -- Describe, classify, or reason over images and videos (Gemini handles mixed image + video in one call)
- Image generation -- Text-to-image and image-to-image (edit / inpaint) across Gemini Imagen, OpenAI gpt-image, Grok Imagine
- Video generation -- Text-to-video and image-to-video (Gemini Veo 3.1, Grok Imagine Video)
- 3 providers x 2 tiers -- Same interface for
gemini/openai/grokatpoor(cheap/fast) orrich(high quality); swap via parameter - Open model passthrough -- Understanding routes through litellm; pass any
provider/model, or configure an ordered model chain (no hardcoded catalog) - Degraded mode -- Server starts with zero credentials and surfaces remaining providers as you add keys
- Response cache -- Disk-based caching of
understandresponses with configurable TTL - Dual transport -- pure stdio with provider env vars (default) or HTTP multi-user with paste-token relay form
Install
Run with uvx (no install step) or pull the container image:
Add it to an MCP client by pointing the client at the uvx imagine-mcp command and
supplying at least one provider key (see Configuration):
For per-client snippets (Claude Code, Codex, Gemini CLI, Cursor, Windsurf) and the browser-based HTTP setup, see the Setup docs.
Install with an AI agent -- paste this to your AI coding agent:
Install MCP server
imagine-mcpfollowing the steps at https://raw.githubusercontent.com/n24q02m/claude-plugins/main/plugins/imagine-mcp/setup-with-agent.md
Smithery
imagine-mcp ships a smithery.yaml so it can be installed and
run through Smithery. The entry launches the published
PyPI package over stdio (uvx --python 3.13 imagine-mcp) with an empty config
schema -- no setup fields are required at deploy time. Provider keys are supplied
at runtime through the server's own credential flow (env vars in stdio mode, or
the browser setup form in HTTP mode; see Configuration).
Configuration
Two transports (default stdio; opt into http with --http, MCP_TRANSPORT=http,
or TRANSPORT_MODE=http):
- stdio (default) -- single-user, reads credentials from env vars only. Exits if none of the three provider keys are set.
- http -- HTTP daemon. Local self-host on
127.0.0.1by default, or multi-user remote (per-JWT-sub credential isolation) whenPUBLIC_URL+MCP_DCR_SERVER_SECRETare set. In HTTP mode credentials are entered through a browser form at/authorize.
Provider keys
All optional -- the server starts in degraded mode and surfaces whichever providers have a key. Set at least one.
When a tool is called without an explicit provider, the first key present wins in the
order XAI_API_KEY -> OPENAI_API_KEY -> GEMINI_API_KEY.
Model chains (optional)
Model choice passes straight through to litellm (understand) or the native
provider SDK (generate) -- there is no hardcoded model catalog. Each chain is a
CSV of litellm provider/model entries; the order is the fallback order.
Understanding is routed through litellm (provider/model passthrough), so any litellm
provider works -- supply that provider's <PROVIDER>_API_KEY. Generation stays on the
native provider SDKs (Gemini, OpenAI, Grok). Example:
Runtime knobs
config(action="set", key=..., value=...) adjusts log_level, default_provider,
default_tier, and cache_ttl_seconds at runtime.
CLI
The imagine-mcp console command installed by the package takes no
subcommands -- it starts the MCP server directly. Transport is selected by a
single flag or its environment-variable equivalents:
In stdio mode the server exits if none of the provider keys are set. The remote
HTTP bind knobs (MCP_HOST, MCP_PORT) apply only when PUBLIC_URL is set; see
Configuration.
Remote (HTTP mode)
An HTTP deployment serves clients that support remote HTTP MCP servers. It is
OAuth-gated -- an unauthenticated request returns 401 with a
WWW-Authenticate: Bearer challenge -- and credentials are provisioned through
the browser setup form. Point an HTTP-capable MCP client at
https://<your-host>/mcp and complete the OAuth flow to connect.
To stand one up, see Deploy to Cloudflare.
Documentation
Full docs at mcp.n24q02m.com/servers/imagine-mcp/setup/:
- Setup -- install methods for Claude Code, Codex, Gemini CLI, Cursor, Windsurf, mcp.json
- Modes overview -- stdio / local-relay / remote-relay / remote-oauth
- Multi-user setup -- per-JWT-sub credential model
Tools
4 MCP tools (understand, generate, config, help), plus config__open_relay (framework-injected by mcp-core):
Model choice is caller-driven (litellm provider/model passthrough or a *_MODELS
env chain) -- see Model chains above.
Comparison
How imagine-mcp stacks up against direct competitors in each pillar:
Security
- SSRF + LFI prevention -- All
media_urlsandreference_image_urlare validated at the dispatch boundary; onlyhttp://andhttps://schemes reach the providers.file://,ftp://,gopher://, and scheme-less URLs are rejected. - No credentials in errors -- Provider-side errors are sanitized before being returned.
- Degraded start -- Missing credentials do not prevent the server from starting; affected actions surface actionable errors instead of crashing at boot.
- Credential storage -- Credentials submitted through the browser credential form are stored encrypted via
mcp-core(AES-GCM, machine-bound key) at~/.imagine-mcp/config.json.
Workspace username (HTTP setup form)
The browser credential form has an optional workspace username field. Entering
the same username always lands you in the same per-sub bucket, so your provider
keys stay reachable across a re-authorization and across devices, instead of being
tied to the one-off subject minted for each /authorize round-trip. Leaving it
blank keeps the previous per-authorize behaviour.
Trust boundary: when the form is gated by a shared MCP_RELAY_PASSWORD, the
username is a partition key, not a secret -- anyone who knows that password can
type any username and reach that bucket. That is fine for a trusted group; an
untrusted multi-tenant deployment needs a per-user secret or delegated OAuth
instead.
One-time migration: existing users must re-enter their credentials once after this change. Nothing is deleted; credentials stored under the old random subject are simply no longer addressed.
Build from Source
Deploy to Cloudflare
Run your own imagine instance serverless on Cloudflare (Worker + Container + KV). Storage
is KV-only -- the per-user credential vault lives in KV, and generation returns base64 only
because the container filesystem is ephemeral (IMAGINE_OUTPUT_MODE=base64).
Prerequisites: a Cloudflare account on the Workers Paid plan -- required for Containers (the Cloudflare free tier does not include Containers) -- and the wrangler CLI.
git clone https://github.com/n24q02m/imagine-mcp && cd imagine-mcpwrangler login- Create the KV namespace (imagine is KV-only -- no D1 or Vectorize), then paste the
returned id into
wrangler.jsonc(the<imagine-kv-namespace-id>placeholder): - Push the container image to your Cloudflare managed registry (CF Containers cannot pull
from external registries directly), then set
<YOUR_ACCOUNT_ID>inwrangler.jsonc: - Point the remaining
wrangler.jsoncplaceholders at your own domain:<YOUR_PUBLIC_URL>(thevars.PUBLIC_URL, e.g.https://imagine.example.com) and<YOUR_WORKER_DOMAIN>(theroutescustom-domain pattern, e.g.imagine.example.com). - Set secrets.
CREDENTIAL_SECRET(stable JWT signing key + per-user vault key) andMCP_DCR_SERVER_SECRET(proof of an intentional multi-user deploy) are required;MCP_RELAY_PASSWORDgates the browser setup form's login. Provider keys are optional server defaults -- users normally paste their own through the setup form instead: wrangler deploy, then open your Worker domain and finish setup in the browser relay form.
The http container image already runs multi-user (MCP_TRANSPORT=http is baked into the
image target). Storage maps to Cloudflare via MCP_STORAGE_BACKEND=cf-kv (encrypted
credential vault) with IMAGINE_OUTPUT_MODE=base64, which forces base64 responses so no
media path is written to the ephemeral container filesystem.
Deployment
The Cloudflare deployment is CD-managed: publishing a release triggers the
deploy-cf job in .github/workflows/cd.yml,
which checks out the released tag, builds the http-slim container image
tagged with the released version, pushes it to Cloudflare's managed registry,
deploys the Worker + Container stack, and gates on a canary -- a failed canary
fails the job rather than landing a bad deploy, so the live image always
corresponds to a released, immutable image tag. Hand-running wrangler deploy
against that deployment breaks the release-to-tag correspondence and is not
the supported path; to run your own instance instead, see
Deploy to Cloudflare.
The job is currently gated off: the repository Actions variable
CF_HOSTED_ENABLED is set to false, so releases do not auto-deploy and no
hosted endpoint is operated. Self-hosting (above) is the active HTTP path.
Trust Model
This plugin implements TC-Local (machine-bound, single trust principal). See mcp-core trust model for full classification.
Contributing
See CONTRIBUTING.md for the full development workflow, commit convention, and release process. Issues + Discussions welcome.
License
Apache-2.0 -- see LICENSE.
来源:README.md,提交 fae631e
工具
0版本历史
1- v1.11.6最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分