No description
- Python 100%
| tests | Added a more complete test | |
| .gitignore | Added tests | |
| pyproject.toml | Changed the name (with Claude Haiku) | |
| README.md | Added tests | |
| server.py | Close, but no sigar for Claude | |
| uv.lock | Added tests | |
Bacting MCP Server
A Model Context Protocol (MCP) server built with FastAPI for chemistry and cheminformatics support using pybacting.
Setup
- Activate the virtual environment:
uv venv venv # only once
source venv/bin/activate
- Install dependencies:
uv pip install -e .
Or with development dependencies:
uv pip install -e ".[dev]"
Running the Server
python server.py
The server will start on http://localhost:8000
Available Endpoints
GET /- Server infoGET /health- Health checkPOST /mcp/call- MCP tool callsGET /docs- Interactive API documentation (Swagger UI)
Example Usage
List available tools
curl -X POST http://localhost:8000/mcp/call \
-H "Content-Type: application/json" \
-d '{"method": "tools/list"}'
Call a tool
curl -X POST http://localhost:8000/mcp/call \
-H "Content-Type: application/json" \
-d '{"method": "tools/call", "params": {"name": "smiles_to_molecule", "arguments": {"smiles": "CCO"}}}'
Testing
To run the test suite:
uv pip install -e ".[dev]"
uv run pytest
Or run tests with verbose output:
uv run pytest tests/ -v
To run a specific test:
uv run pytest tests/test_server.py::test_smiles_to_molecule_valid -v
The test suite includes:
- Validation of available tools
- Testing valid SMILES string conversion (ethanol, benzene)
- Error handling for invalid SMILES strings
- Edge cases (empty strings, unknown tools)
Adding New Tools
To add new tools, modify the list_tools() and call_tool() functions in server.py.