1
0
Fork
You've already forked bacting-mcp-server
0
No description
  • Python 100%
2026年04月24日 20:49:26 +02:00
tests Added a more complete test 2026年04月24日 20:49:26 +02:00
.gitignore Added tests 2026年04月24日 20:13:54 +02:00
pyproject.toml Changed the name (with Claude Haiku) 2026年04月24日 19:54:38 +02:00
README.md Added tests 2026年04月24日 20:13:54 +02:00
server.py Close, but no sigar for Claude 2026年04月24日 20:47:38 +02:00
uv.lock Added tests 2026年04月24日 20:13:54 +02:00

Bacting MCP Server

A Model Context Protocol (MCP) server built with FastAPI for chemistry and cheminformatics support using pybacting.

Setup

  1. Activate the virtual environment:
uv venv venv # only once
source venv/bin/activate
  1. 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 info
  • GET /health - Health check
  • POST /mcp/call - MCP tool calls
  • GET /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.