Metadata-Version: 2.4
Name: cnx-mcp
Version: 0.1.0
Summary: Local MCP stdio bridge for cnx — GPU rental negotiation agent (proxies to the live cnx /mcp HTTP endpoint, zero local business logic)
License: MIT
Keywords: compute,gpu,mcp,negotiation,x402
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: mcp<2,>=1.28
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest-mock>=3.14; extra == 'dev'
Requires-Dist: pytest>=8.3.3; extra == 'dev'
Description-Content-Type: text/markdown

# cnx-mcp

A real, installable **local MCP stdio server** for [cnx](../README.md), the
GPU rental negotiation agent. It bridges any MCP-compatible host (Claude
Desktop, Claude Code, etc.) to the live cnx backend over stdio, so you can
add cnx to a host with one line instead of hand-rolling an HTTP bridge.

This package is a **thin protocol bridge, not a reimplementation**. On every
`tools/list` and `tools/call` request it forwards straight through to the
live cnx `/mcp` HTTP endpoint

```
https://ddlcl1en1j.execute-api.us-east-1.amazonaws.com/production/mcp
```

and reshapes the JSON-RPC response into the MCP types the SDK's stdio
transport expects. There are **no hardcoded tool schemas** in this package -
`list_tools()` always reflects whatever the live backend currently serves,
so this bridge can never drift out of sync with the real tool set.

## Install & run

**Not yet published to PyPI.** Once published, any of these will work:

```bash
# No install - run directly
uvx cnx-mcp

# Same idea, via pipx
pipx run cnx-mcp

# Install then run
pip install cnx-mcp
cnx-mcp
```

Until then, run it from a local checkout of this repo:

```bash
# From the repo root
pip install -e ./mcp-server
cnx-mcp

# or, without a persistent install, via uv:
uvx --from ./mcp-server cnx-mcp
```

## Configuring an MCP host

Add cnx to your host's MCP server config. For Claude Desktop
(`claude_desktop_config.json`), once `cnx-mcp` is published:

```json
{
  "mcpServers": {
    "cnx": {
      "command": "uvx",
      "args": ["cnx-mcp"]
    }
  }
}
```

Or, if you installed it with `pip install cnx-mcp`:

```json
{
  "mcpServers": {
    "cnx": {
      "command": "cnx-mcp"
    }
  }
}
```

**Before publish**, point a host at a local checkout instead:

```json
{
  "mcpServers": {
    "cnx": {
      "command": "uvx",
      "args": ["--from", "/absolute/path/to/mcp-server", "cnx-mcp"]
    }
  }
}
```

Claude Code (`.mcp.json` or `claude mcp add`) uses the same
`command`/`args` shape.

## Pointing at a different backend

By default `cnx-mcp` talks to the live production endpoint. Override it with
`CNX_MCP_BASE_URL` - useful for local development or a staging deployment
without needing a new release of this package:

```json
{
  "mcpServers": {
    "cnx": {
      "command": "uvx",
      "args": ["cnx-mcp"],
      "env": {
        "CNX_MCP_BASE_URL": "https://your-staging-endpoint.example.com/mcp"
      }
    }
  }
}
```

Or from the shell:

```bash
CNX_MCP_BASE_URL=http://localhost:3000/mcp cnx-mcp
```

## Available tools

The tool list is discovered dynamically from the live backend on every
`tools/list` call - this README is not the source of truth for it. As of
this writing the backend serves 5 tools: `rent_compute`, `negotiate_price`,
`submit_payment`, `check_rental_status`, `report_unreachable`. See the main
repo's `SKILLS.md` for the current, authoritative description of each.

## Development

```bash
cd mcp-server
python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/pytest tests/ -v
```

## Publishing

Publishing to PyPI (`uv publish` / `twine upload`) is a deliberate manual
step, not automated by this package or its build tooling. Verify the PyPI
name `cnx-mcp` is still available and the built package passes review before
publishing.
