About Chapel Support for MCP
Chapel Support for MCP is an MCP server for AI assistants working with Chapel code. It combines primer access with compilation and optional linting tools.
Key features
- 01Browse Chapel primers
- 02Retrieve primer content
- 03Compile Chapel programs
- 04Lint code with chplcheck
- 05Apply automatic lint fixes
Use cases
- 01Explore Chapel learning examples
- 02Compile a Chapel program
- 03Check Chapel style and practices
MCP support
The MCP server exposes tools to list and retrieve Chapel primers, compile programs, and inspect or lint code for connected clients.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEChapel Support for MCP
A Model-Context-Protocol (MCP) server for the Chapel programming language, providing tools for working with Chapel code, accessing primers and examples, and integrating Chapel functionality with AI assistants and other tools.
What is Chapel?
Chapel is an open-source parallel programming language designed for productive parallel computing at scale. It aims to improve the programmability of parallel computers while matching or beating the performance and portability of current programming models like MPI, OpenMP, and CUDA.
Features
This MCP server provides the following Chapel support functionality:
- Chapel Primer Access: Browse and access Chapel's educational primer examples
- Code Compilation: Compile Chapel code directly through the API
- Linting: Check Chapel code for style and best practices using
chplcheckand apply automatic fixes - Smart CHPL_HOME Detection: Automatically locate Chapel's installation directory
Prerequisites
- Python 3.13 or higher
- Chapel programming language installed (see Chapel installation guide)
- (Optional)
chplcheckfor linting functionality
Installation
-
Clone this repository:
git clone <repository-url> cd chapel-support -
Create and activate a virtual environment with UV:
uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Synchronize the environment with project dependencies:
uv sync
Configuration
The MCP server needs to know the location of your Chapel installation (CHPL_HOME). It will try to find it in this order:
- From the
CHPL_HOMEenvironment variable - From a
.envfile in the project root - By running
chpl --print-chpl-homeif the Chapel compiler is in your PATH
To use a .env file, create one in the project root with:
CHPL_HOME=/path/to/your/chapel/installation
See .env.example for a template.
Usage
Running the MCP Server
uv run chapel-support.py
This will start the MCP server in stdio transport mode using your virtual environment.
Integrating with AI Assistants or Tools
To use this MCP server with AI assistants or other tools, configure them to connect to this server. For example, in a client configuration file:
{
"context_servers": {
"chapel-support": {
"command": {
"path": "uv",
"args": [
"run",
"--directory",
"/path/to/chapel-support",
"chapel-support.py"
],
"env": {}
},
"settings": {}
}
}
}
Note: Adjust the directory path to the location of your chapel-support installation.
Available Tools
list_primers()
Gets the list of available Chapel primers.
Returns: A list of paths to primer files relative to CHPL_HOME.
get_primer(path: str)
Retrieves the content of a specific Chapel primer.
Parameters:
path: The path to the primer, as returned bylist_primers()
Returns: The content of the primer as a string.
compile_program(program_text: str, program_name: str = "program.chpl")
Compiles a Chapel program.
Parameters:
program_text: The Chapel code to compileprogram_name: Optional name for the program file (default: "program.chpl")
Returns: A tuple containing:
- Success status (boolean)
- Compiler output/errors (string)
list_chapel_lint_rules()
Lists all available Chapel linting rules from chplcheck.
Returns: A list of dictionaries with rule information:
name: Rule namedescription: Rule descriptionis_default: Whether the rule is enabled by default
lint_chapel_code(program_text: str, program_name: str = "program.chpl", fix: bool = False, custom_rules: Optional[List[str]] = None)
Lints Chapel code and optionally applies fixes.
Parameters:
program_text: The Chapel code to lintprogram_name: Optional name for the program file (default: "program.chpl")fix: Whether to apply automatic fixes (default: False)custom_rules: List of specific rules to enable (default: None, uses default rules)
Returns: A dictionary containing:
warnings: String containing linting warningsfixed_code: The fixed code iffix=Trueerror: Error message if something went wrongstats: Statistics about the linting process
Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.