DECIMER MCP Server について
DECIMER MCP Serverは、化学構造画像のリクエストを既存のDECIMER FastAPIサービスへ転送し、SMILESを返すMCPクライアント向けアダプターです。ヘルスチェックと構造化された推論結果を提供し、DECIMERモデル自体は実行しません。
主な機能
- 01化学画像からSMILESへのリクエスト
- 02APIの到達性チェック
- 03構造化された推論結果
- 04JSON失敗時のフォーム形式への切り替え
活用シーン
- 01DECIMER APIの到達性確認
- 02化学構造画像からのSMILES抽出
MCP 対応
MCPクライアントに`server_health`と`analyze_chemical_image`のツールを提供します。画像解析は稼働中のDECIMER FastAPIサービスに委ねます。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
DecimerMCPServer
mcp-name: io.github.DocMinus/decimer-mcp-server
DECIMER の画像から SMILES への変換機能をツール呼び出しとして公開する MCP サーバーです。
このプロジェクトは、既存の FastAPI サービスである DecimerServerAPI の薄いアダプターです。
DECIMER モデルを直接実行することはありません。
アダプターはデフォルトで JSON リクエストを送信し、互換性のためにフォーム形式のペイロードへ自動的にフォールバックします。
ツール
server_health:DECIMER FastAPI サーバーに接続できるか確認します。analyze_chemical_image:Base64 エンコードされた画像を/image2smiles/に送信し、構造化された出力を返します。
要件
- Python 3.10+
- 起動中の DECIMER API サーバー(デフォルト:
http://localhost:8099)
次のいずれかのバージョンを参照してください。
- GitHub:https://github.com/DocMinus/DecimerServerAPI
- Dockerhub:https://hub.docker.com/r/docminus/decimer_api
インストール
cd /Users/a/dev/DecimerMCPServer
uv venv
uv sync
設定
.env.example の値を環境にコピーします。
DECIMER_API_BASE_URL(デフォルトhttp://localhost:8099)DECIMER_API_TIMEOUT_SECONDS(デフォルト60)DECIMER_MAX_IMAGE_BYTES(デフォルト10000000)DECIMER_MCP_LOG_LEVEL(デフォルトINFO)
実行(stdio トランスポート)
uv run decimer-mcp-server
または
uv run python -m decimer_mcp_server
MCP クライアント設定の例
{
"mcpServers": {
"decimer": {
"command": "uv",
"args": ["run", "python", "-m", "decimer_mcp_server"],
"env": {
"DECIMER_API_BASE_URL": "http://localhost:8099"
}
}
}
}
出力形式
analyze_chemical_image は次の値を返します。
{
"ok": true,
"smiles": "CCO",
"reason": null,
"api_status_code": 200,
"api_message": null,
"classifier_score": 0.0000012,
"classifier_threshold": 0.3,
"classifier_decision": "structure_like"
}
API 分類器の動作により SMILES が返されない場合:
{
"ok": true,
"smiles": null,
"reason": "not_chemical_structure",
"api_status_code": 200,
"api_message": "No SMILES returned by API",
"classifier_score": 0.99999,
"classifier_threshold": 0.3,
"classifier_decision": "not_structure_like"
}
開発テスト
uv sync --extra dev
uv run pytest
Make のターゲット:
make sync
make test
スモークテスト用ヘルパー
DECIMER API に対して、ヘルスチェックを 1 回、推論呼び出しを 1 回実行します。
cd /Users/a/dev/DecimerMCPServer
DECIMER_API_BASE_URL=http://chitchat:8099 uv run decimer-mcp-smoke-test --image /Users/a/dev/DecimerServerAPI/example_usage/structure.png
設定を .env に保存している場合は、次のコマンドで読み込みます。
uv run --env-file .env decimer-mcp-smoke-test --image /Users/a/dev/DecimerServerAPI/example_usage/structure.png
または make を使用します。
make smoke
必要に応じて画像のパスを上書きします。
make smoke SMOKE_IMAGE=/absolute/path/to/image.png
## MCP Registry publishing
Tags matching `v*` trigger `.github/workflows/publish-mcp.yml`.
Workflow steps:
- installs `mcp-publisher`
- validates `server.json`
- calls registry publish using secret `MCP_REGISTRY_TOKEN`
- publishes slug `io.github.DocMinus/decimer-mcp-server` (case sensitive; must match registry grant)
Before tagging:
1. Update `pyproject.toml` + `server.json` versions
2. Ensure `server.json` stays valid (`uv pip install jsonschema && python validate snippet from AGENTS.md`)
3. Add GitHub repo secret `MCP_REGISTRY_TOKEN` (GitHub PAT with `repo`, `workflow` scopes)
Release flow:
```bash
git tag v0.1.1
git push origin v0.1.1
Actions タブを確認してください。公開に失敗した場合は、問題を修正してからワークフローのディスパッチを使って再実行してください。
## Contribution
This project was built by DocMinus with AI-assisted coding support (OpenCode/Copilot-style tooling), then reviewed and tested by the author.
## AI usage policy
- AI assistance was used for scaffolding, implementation drafts, and documentation edits.
- Final technical decisions, validation runs, and acceptance were performed by the maintainer.
- Runtime behavior should be validated with local tests (`make test`) and smoke tests (`make smoke`) before release.
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。