mcp-adapter-service

No description

GitHub Stars

1

User Rating

Not Rated

Forks

0

Issues

0

Views

1

Favorites

0

README
MCP Adapter Service

A lightweight, containerized FastAPI service that receives Model Context Protocol (MCP) requests and asynchronously dispatches them to backend services such as:

  • maceopt: Geometry optimization using MACE
  • zeopp: Structural analysis using Zeo++
  • xtb: GFN1-xTB-based optimization

๐Ÿš€ Features
  • โœ… Supports standardized MCP request format
  • ๐Ÿง  Asynchronous task queue via Celery
  • ๐Ÿงช Rich structured logging with trace ID
  • ๐Ÿ”Œ Easily extendable to more backend models
  • ๐Ÿณ Fully containerized for server deployment
  • ๐Ÿงต Route-based Zeo++ multi-function support

๐Ÿ“ฆ Deployment (Docker Compose)
1. Clone the repository
git clone https://github.com/your-org/mcp-adapter-service.git
cd mcp-adapter-service
```text
2. Configure environment

Create a .env file:

# Redis
REDIS_URL=redis://redis:6379/0
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0

# Backend services
MACEOPT_BASE_URL=http://192.168.100.208:4748
ZEO_BASE_URL=http://192.168.100.208:9876
XTB_BASE_URL=http://192.168.100.208:4548
3. Build and start all services
docker-compose up --build -d

Access the API via: http://<your-server-ip>:9000/docs


๐Ÿง  API Endpoints
POST /mcp

Submit a structured request to route to the appropriate backend.

Example body:

{
  "input": "<.xyz or .cssr content>",
  "context": {
    "task_id": "mcp_001",
    "model": "zeopp",
    "parameters": {
      "route": "surface_area",
      "output_filename": "output.sa"
    }
  }
}
GET /result/{task_id}

Query asynchronous task result by task ID.

GET /zeopp/list_routes

List all supported Zeo++ analysis endpoints.


๐Ÿ“‚ Project Structure
app/
โ”œโ”€โ”€ adapters/         # Dispatcher and router
โ”œโ”€โ”€ middleware/       # Trace logging
โ”œโ”€โ”€ models/           # Pydantic schema
โ”œโ”€โ”€ services/         # Celery tasks and backend clients
โ”œโ”€โ”€ utils/            # Rich logger and trace ID
โ”œโ”€โ”€ main.py           # FastAPI app entry
celery_worker.py      # Celery worker entry
Dockerfile
docker-compose.yml
.env.template

๐Ÿ‘ค Author

Shibo Li ยท 2025
MIT License

Author Information
Shibo Li

Senior AI Engineer in MiQroEra, SH. Supervisor of AI-Material in MiQroEra, SH

MiQroEraShanghai

3

Followers

98

Repositories

0

Gists

8

Total Contributions

Top Contributors

Threads