MCP server that formats C/C++ files with clang-format
Project description
mcp-server-cpp-format
Model Context Protocol (MCP) server that formats C/C++ source files in-place using clang-format.
Designed to back the cpp-format Claude Code plugin,
but usable as a standalone MCP server in any MCP-compatible client.
Install
The server is published on PyPI and intended to be invoked via uvx:
uvx mcp-server-cpp-format
Or install into a regular environment:
pip install mcp-server-cpp-format
mcp-server-cpp-format
Requires Python 3.10+ and clang-format available on PATH (or via CLANG_FORMAT_BIN).
Tools
applyClangFormat
Formats C/C++ source files in-place.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
files |
string[] |
yes | Absolute file paths or absolute glob patterns (/path/**/*.cpp). Directory paths without a glob are rejected. |
style |
string |
no | Explicit style (LLVM, Google, file, file:<path>, ...). Overrides environment defaults. |
Allowed extensions (others are silently skipped):
.c .cc .cpp .cxx .c++ .h .hh .hpp .hxx .h++ .ipp .tpp .inl
Style resolution priority
styleargument when explicitly providedCLANG_FORMAT_CONFIGenv (path to a.clang-format) →--style=file:<path>CLANG_FORMAT_STYLEenv (e.g.LLVM,Google) →--style=<style>- Default →
--style=file(clang-format auto-discovers.clang-formatupward; falls back to LLVM)
Environment variables
| Variable | Effect |
|---|---|
CLANG_FORMAT_BIN |
Absolute path to a clang-format binary. Default: clang-format from PATH. |
CLANG_FORMAT_CONFIG |
Absolute path to a .clang-format file to enforce. |
CLANG_FORMAT_STYLE |
Fallback style name when no .clang-format is provided/found. |
CPP_FORMAT_LOG_LEVEL |
Logging verbosity for the server (default INFO). |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_server_cpp_format-0.1.0.tar.gz.
File metadata
- Download URL: mcp_server_cpp_format-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c09a19012bb958b4f13d0f3a86407bc82b8f21cb00e4ff1b77fbe9534a665700
|
|
| MD5 |
fcd2ee6324117ea00ec9eccd913dd03d
|
|
| BLAKE2b-256 |
49510d7f6163ab68c0aecb3a93b63e97265128e8a85319ab2ea20a7cbc7db41f
|
File details
Details for the file mcp_server_cpp_format-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_server_cpp_format-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eda53922f1d479fa5a99e8a19beae227387547dc7deda5033cc071fede50f569
|
|
| MD5 |
1e67803559ecb594935b96cef9f80d22
|
|
| BLAKE2b-256 |
90fc1865287baf77f8cedef65d350c861a57daedadfdebfdd7810107a8ba6b8a
|