README.md•3.8 kB
# Build MCP Server
A Model Context Protocol (MCP) server that provides build and development tools for AI assistants. This server enables AI agents to run build commands, tests, linting, and manage dependencies in development projects.
## Features
- **Build Management**: Run build commands with customizable parameters
- **Test Execution**: Execute test suites and report results
- **Package Analysis**: Read and analyze package.json files
- **Dependency Management**: Install dependencies using npm, yarn, or pnpm
- **Code Linting**: Run linting tools and report code quality issues
## Installation
### From GitHub (Recommended)
```bash
npx build-mcp-server
```
### Local Development
```bash
git clone <your-repo-url>
cd build-mcp-server
npm install
npm run build
```
## Configuration
Add this server to your MCP configuration file:
```json
{
"mcpServers": {
"build-server": {
"command": "npx",
"args": [
"-y",
"build-mcp-server"
],
"env": {}
}
}
}
```
Or for local development:
```json
{
"mcpServers": {
"build-server": {
"command": "node",
"args": [
"/path/to/build-mcp-server/dist/index.js"
],
"env": {}
}
}
}
```
## Available Tools
### `run_build`
Execute build commands in a project directory.
**Parameters:**
- `command` (string, optional): Build command to run (default: "npm run build")
- `directory` (string, optional): Directory to run the build in (default: current directory)
**Example:**
```
Run build command "npm run build" in the current directory
```
### `run_test`
Execute test suites in a project directory.
**Parameters:**
- `command` (string, optional): Test command to run (default: "npm test")
- `directory` (string, optional): Directory to run tests in (default: current directory)
**Example:**
```
Run tests using "yarn test" in the ./frontend directory
```
### `check_package_json`
Analyze package.json files and extract key information.
**Parameters:**
- `directory` (string, optional): Directory containing package.json (default: current directory)
**Example:**
```
Check package.json in the current directory
```
### `install_dependencies`
Install project dependencies using various package managers.
**Parameters:**
- `manager` (string, optional): Package manager to use - npm, yarn, or pnpm (default: "npm")
- `directory` (string, optional): Directory to install dependencies in (default: current directory)
**Example:**
```
Install dependencies using yarn in the ./backend directory
```
### `lint_code`
Run code linting and quality checks.
**Parameters:**
- `command` (string, optional): Lint command to run (default: "npm run lint")
- `directory` (string, optional): Directory to run linting in (default: current directory)
**Example:**
```
Run linting with "eslint ." command
```
## Usage Examples
Once configured, you can use natural language to interact with the build server:
- "Build the project"
- "Run tests in the frontend directory"
- "Install dependencies using yarn"
- "Check what scripts are available in package.json"
- "Lint the code and show me any issues"
## Error Handling
The server provides detailed error messages and output for all operations. Build failures, test errors, and linting issues are clearly reported with full context.
## Security
This server executes shell commands in the specified directories. Ensure you trust the environment and commands being executed. The server includes timeout protections to prevent long-running processes.
## Development
To contribute or modify the server:
```bash
# Clone and install
git clone <repo-url>
cd build-mcp-server
npm install
# Development with auto-reload
npm run dev
# Build for production
npm run build
# Test the server
npm start
```
## License
MIT