mohnishi commited on
Commit
b61a793
·
1 Parent(s): f971da3
Files changed (2) hide show
  1. README.md +21 -21
  2. app.py +3 -3
README.md CHANGED
@@ -13,31 +13,31 @@ short_description: MCP server for the PolyOmics polymer materials database
13
 
14
  # PolyOmics MCP Server
15
 
16
- [PolyOmics dataset](https://huggingface.co/datasets/yhayashi1986/PolyOmics) の MCP サーバーです。
17
- 100,000 種以上のポリマー材料の物性データを Claude などの MCP クライアントから検索できます。
18
 
19
- ## 提供するツール
20
 
21
- | ツール | 説明 |
22
- |--------|------|
23
- | `get_database_info` | データベースの統計情報を取得 |
24
- | `search_polymers_by_smiles` | SMILES フラグメントでポリマーを検索 |
25
- | `get_polymer_by_id` | モノマー ID で全物性値を取得 |
26
- | `query_polymers_by_property` | 物性値の範囲でポリマーをフィルタ |
27
- | `filter_by_polymer_class` | ポリマークラス(PEST, PAMD 等)でフィルタ |
28
- | `get_chi_parameter` | 指定溶媒の Flory-Huggins χ パラメータを取得 |
29
- | `get_chi_parameters_for_polymer` | 全溶媒の χ パラメータを一括取得 |
30
 
31
- ## Claude Desktop への接続設定
32
 
33
- `claude_desktop_config.json` に以下を追加します。
34
 
35
  ```json
36
  {
37
  "mcpServers": {
38
  "polyomics": {
39
  "type": "sse",
40
- "url": "https://<your-username>-polyomics-mcp.hf.space/gradio_api/mcp/sse",
41
  "headers": {
42
  "Authorization": "Bearer <your-hf-token>"
43
  }
@@ -46,11 +46,11 @@ short_description: MCP server for the PolyOmics polymer materials database
46
  }
47
  ```
48
 
49
- > **Note:** `<your-username>` `<your-hf-token>` を実際の値に置き換えてください。
50
- > HF トークンは [Settings > Access Tokens](https://huggingface.co/settings/tokens) で発行できます(`read` 権限で可)。
51
 
52
- ## データソース
53
 
54
- - **データセット:** [yhayashi1986/PolyOmics](https://huggingface.co/datasets/yhayashi1986/PolyOmics)
55
- - **ライセンス:** CC-BY 4.0
56
- - **論文:** arXiv:2511.11626
 
13
 
14
  # PolyOmics MCP Server
15
 
16
+ MCP server for the [PolyOmics dataset](https://huggingface.co/datasets/yhayashi1986/PolyOmics).
17
+ Query physical property data for 100,000+ polymer materials from Claude and other MCP clients.
18
 
19
+ ## Available Tools
20
 
21
+ | Tool | Description |
22
+ |------|-------------|
23
+ | `get_database_info` | Get overview statistics of the database |
24
+ | `search_polymers_by_smiles` | Search polymers by SMILES fragment |
25
+ | `get_polymer_by_id` | Get all properties for a polymer by monomer ID |
26
+ | `query_polymers_by_property` | Filter polymers by property value range |
27
+ | `filter_by_polymer_class` | Filter by polymer class (PEST, PAMD, etc.) |
28
+ | `get_chi_parameter` | Get Flory-Huggins χ parameter for a specific solvent |
29
+ | `get_chi_parameters_for_polymer` | Get χ parameters for all solvents at once |
30
 
31
+ ## Connecting from Claude Desktop
32
 
33
+ Add the following to `claude_desktop_config.json`:
34
 
35
  ```json
36
  {
37
  "mcpServers": {
38
  "polyomics": {
39
  "type": "sse",
40
+ "url": "https://<your-username>-polyomics-mcp-server.hf.space/mcp/sse",
41
  "headers": {
42
  "Authorization": "Bearer <your-hf-token>"
43
  }
 
46
  }
47
  ```
48
 
49
+ > **Note:** Replace `<your-username>` and `<your-hf-token>` with your actual values.
50
+ > Generate an HF token at [Settings > Access Tokens](https://huggingface.co/settings/tokens) (`read` permission is sufficient).
51
 
52
+ ## Data Source
53
 
54
+ - **Dataset:** [yhayashi1986/PolyOmics](https://huggingface.co/datasets/yhayashi1986/PolyOmics)
55
+ - **License:** CC-BY 4.0
56
+ - **Paper:** arXiv:2511.11626
app.py CHANGED
@@ -449,7 +449,7 @@ def build_demo() -> gr.Blocks:
449
  "# PolyOmics MCP Server\n"
450
  "Polymer property database with Flory-Huggins χ parameters.\n\n"
451
  f"**Dataset:** [{DATASET_REPO}](https://huggingface.co/datasets/{DATASET_REPO})\n\n"
452
- "**MCP endpoint:** `/mcp/sse`"
453
  )
454
 
455
  with gr.Tab("Database Info"):
@@ -502,10 +502,10 @@ def build_demo() -> gr.Blocks:
502
  def build_app() -> GradioApp:
503
  demo = build_demo()
504
 
505
- # GradioFastAPIアプリをlaunch()前に生成
506
  app = GradioApp.create_app(demo, app_kwargs={"docs_url": "/docs"})
507
 
508
- # MCP SSEルートをlaunch()前に追加 uvicornが起動する前に確定する
509
  security = TransportSecuritySettings(enable_dns_rebinding_protection=False)
510
  sse = SseServerTransport("/mcp/messages/", security_settings=security)
511
 
 
449
  "# PolyOmics MCP Server\n"
450
  "Polymer property database with Flory-Huggins χ parameters.\n\n"
451
  f"**Dataset:** [{DATASET_REPO}](https://huggingface.co/datasets/{DATASET_REPO})\n\n"
452
+ "**MCP endpoint:** `https://mohnishi-polyomics-mcp-server.hf.space/mcp/sse`"
453
  )
454
 
455
  with gr.Tab("Database Info"):
 
502
  def build_app() -> GradioApp:
503
  demo = build_demo()
504
 
505
+ # Create the Gradio FastAPI app before calling launch()
506
  app = GradioApp.create_app(demo, app_kwargs={"docs_url": "/docs"})
507
 
508
+ # Mount MCP SSE routes before uvicorn starts so they are registered at startup
509
  security = TransportSecuritySettings(enable_dns_rebinding_protection=False)
510
  sse = SseServerTransport("/mcp/messages/", security_settings=security)
511