Metadata-Version: 2.4
Name: bangc-mcp-server
Version: 0.3.4
Summary: Single-binary MCP server for embedded BangC, CNRT, and CNNL documentation search.
Author: BangC MCP contributors
License-Expression: MIT
Project-URL: Homepage, https://pypi.org/project/bangc-mcp-server/
Keywords: mcp,bangc,cambricon,mlu,cnrt,cnnl
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Documentation
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# BangC MCP Server

`bangc-mcp-server` is a self-contained MCP server for searching embedded BangC,
CNRT, and CNNL reference material. It ships prebuilt Rust binaries and exposes a
small Python launcher so the server can be started with `uvx`.

```bash
uvx bangc-mcp-server
```

HTTP mode is also available:

```bash
uvx bangc-mcp-server serve --http --addr 127.0.0.1:8765
```

The command line is organized around subcommands:

```bash
uvx bangc-mcp-server serve
uvx bangc-mcp-server serve --http --addr 127.0.0.1:8765
uvx bangc-mcp-server stats
```

Generate a clangd-compatible compilation database for `.mlu` files in the
current project:

```bash
uvx bangc-mcp-server ccdb -r . -a mtp_372
```

The default output is the standard `compile_commands.json` file. Use
`-o compile_command.json` only for tools that require a custom filename.

Compile a single `.mlu` file from the CLI:

```bash
uvx bangc-mcp-server compile-object kernel.mlu -a mtp_372
uvx bangc-mcp-server compile-extension kernel.mlu -a mtp_372 --smoke-import
```

## MCP Configuration

Use the `uvx` command as the MCP server command:

```json
{
  "mcpServers": {
    "bangc-docs": {
      "command": "uvx",
      "args": ["bangc-mcp-server"]
    }
  }
}
```

## Included Tools

- `bangc_search`
- `bangc_api_lookup`
- `bangc_symbols`
- `bangc_get_chunk`
- `bangc_get_doc`
- `bangc_tutorials`
- `bangc_context_pack`
- `bangc_list_documents`
- `bangc_list_sources`
- `neuware_api_search`
- `neuware_api_lookup`
- `neuware_env_check`
- `mlu_device_query`
- `python_torch_env_check`
- `bangc_compile_torch_extension`
- `bangc_compile_torch_extension_plan`

The `mlu_device_query` tool uses bounded one-shot `cnmon` commands when the
local Neuware runtime is available. Mutating or continuously refreshing monitor
modes are intentionally not exposed.

The `bangc_compile_torch_extension` tool compiles a local `.mlu` file into a
Python torch extension for debugging on a machine with Neuware, `cncc`, PyTorch,
and `torch_mlu` installed. It generates a small pybind11 binding around the
wrapper function and does not run task-specific reference checks. Successful
compile results are intentionally compact; use `bangc_compile_torch_extension_plan`
to inspect the full environment and command lines.

## Supported Platforms

This package currently includes:

- Windows x86_64
- Linux x86_64, musl-linked

Set `BANGC_MCP_SERVER_BIN=/path/to/bangc-mcp-server` to override the bundled
binary.

## Notes

The package README intentionally avoids local filesystem paths, private
environment output, usernames, hostnames, and device-specific command output.
