mcpField
D
DECIMER MCP Server

DECIMER MCP Server

本地服务
github.com/DocMinus科研与教育01 周前更新

关于 DECIMER MCP Server

DECIMER MCP Server 是供 MCP 客户端使用的适配器,将化学结构图像请求转发给现有的 DECIMER FastAPI 服务并返回 SMILES。它提供健康检查和结构化推理结果,不直接运行 DECIMER 模型。

主要功能

  1. 01化学图像转 SMILES 请求
  2. 02检查 API 连通性
  3. 03返回结构化推理结果
  4. 04JSON 请求失败时回退表单载荷

适用场景

  1. 01检查 DECIMER API 是否可访问
  2. 02从化学结构图像提取 SMILES

MCP 相关

它向 MCP 客户端提供 `server_health` 和 `analyze_chemical_image` 工具。图像分析由正在运行的 DECIMER FastAPI 服务处理。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"docminus-decimer": {
"command": "uvx",
"args": [
"decimer-mcp-server"
]
}
}
}
启动命令uvx decimer-mcp-server

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
pypidecimer-mcp-server0.1.4

工具

还没有获取到工具列表

本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。

详细介绍

DecimerMCPServer

mcp-name: io.github.DocMinus/decimer-mcp-server

将 DECIMER 图像转 SMILES 功能作为工具调用提供的 MCP 服务。

本项目是对 DecimerServerAPI 中现有 FastAPI 服务的轻量适配器。 它不会直接运行 DECIMER 模型。 默认情况下,适配器会发送 JSON 请求,并在需要兼容时自动回退到表单载荷。

工具

  • server_health:检查 DECIMER FastAPI 服务是否可访问。
  • analyze_chemical_image:向 /image2smiles/ 发送 Base64 编码的图像,并返回结构化输出。

要求

  • Python 3.10+
  • 正在运行的 DECIMER API 服务(默认:http://localhost:8099)

可通过以下任一版本获取:

安装

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 运行一次健康检查和一次推理调用:

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 选项卡。如果发布失败,请修复问题后使用 workflow dispatch 重新运行。


## 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.

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。