Skip to main content
Glama
Scouts MCP Server

Scouts MCP Server

by Cedriccmh
README.md
# Scouts MCP Server

A Model Context Protocol (MCP) server that exposes the `scouts_search` tool, which wraps the `ccr code` CLI to process task files and generate results.

## Overview

This MCP server provides a single tool:
- **scouts_search**: Takes a task file path, runs `ccr [subcommand]` on it, and returns the path to the generated `result.md` file. The subcommand is configurable via `CCR_SUBCOMMAND` environment variable.

## Prerequisites

- **Node.js** ≥ 18
- **ccr** CLI tool must be installed and available on your PATH
  - Test with: `ccr --version` or `ccr code --help`
  - If `ccr` is in a custom location, set the `CCR_PATH` environment variable

## Installation

```bash
npm install
```

## Usage

### Development Mode

Run the server in development mode (useful for testing):

```bash
npm run dev
```

### Production Build

Build the TypeScript to JavaScript:

```bash
npm run build
```

The compiled output will be in the `dist/` directory.

### Running as MCP Server

The server uses stdio transport, so it's designed to be spawned by an MCP client (like Claude Desktop or other MCP-compatible applications).

Add to your MCP client configuration (e.g., `claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "scouts": {
      "command": "node",
      "args": ["/absolute/path/to/scouts-mcp/dist/server.js"]
    }
  }
}
```

Or if installed globally:

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

## Tool: scouts_search

### Input

- `taskPath` (string, required): Absolute or relative path to the task.md file

### Behavior

1. Resolves the absolute path to the task file
2. Runs: `ccr [subcommand] --dangerously-skip-permissions 'task file <taskPath>'` (where subcommand is from `CCR_SUBCOMMAND` env var, default: none)
3. Checks if `result.md` was created in the same directory as the task file
4. If `result.md` doesn't exist, writes ccr's stdout to `result.md` as a fallback
5. Returns the absolute path to `result.md`

### Output

Returns a text response containing the absolute path to the generated `result.md` file.

### Example

If you have a task file at `.kilocode/sub-memory-bank/tasks/2025-10-25-example.md`, the tool will:
- Run ccr on that file
- Generate `.kilocode/sub-memory-bank/tasks/result.md`
- Return the full path to `result.md`

## Environment Variables

- `CCR_PATH`: Custom path to the `ccr` executable (defaults to `ccr` on PATH). If you wrap it in quotes in your config, the server strips them automatically. For testing, you can point this to the dummy script (e.g., `C:\path\to\scripts\ccr-dummy.ps1`).
- `CCR_SUBCOMMAND`: CCR subcommand to use (e.g., `code`). Default: empty (no subcommand). This allows flexibility in how you invoke ccr.
- `CCR_TIMEOUT_MS`: Timeout in milliseconds for ccr execution (default: 600000 = 10 minutes). Set to a shorter value like 30000 (30 seconds) for faster feedback during testing.

## Error Handling

The tool will return an error if:
- The `ccr` command is not found
- The `ccr` process exits with a non-zero code
- The `ccr` process doesn't create `result.md` and doesn't output anything to stdout

## Project Structure

```
cli-as-mcp/
├── src/
│   └── server.ts           # Main MCP server implementation
├── dist/                   # Compiled JavaScript (after build)
├── scripts/
│   ├── ccr-dummy.js        # Node.js dummy CCR for testing
│   └── ccr-dummy.ps1       # PowerShell dummy CCR for testing
├── tests/
│   ├── test-mcp-server.js  # MCP protocol tests
│   ├── test-mcp-server-real.js # Real CCR integration tests
│   ├── run-direct.cjs      # Direct CCR invocation tool
│   └── README.md           # Test documentation
├── docs/
│   ├── DEVELOPMENT.md      # Development guide
│   ├── TESTING.md          # Testing guide
│   ├── TROUBLESHOOTING.md  # Troubleshooting guide
│   ├── USAGE.md            # Usage guide
│   ├── scouts-system-prompt.md # Scouts system documentation
│   └── TEST-REPORT.md      # Test report
├── package.json
├── tsconfig.json
└── README.md
```

## Development

The server is implemented using:
- `@modelcontextprotocol/sdk` for MCP protocol
- `zod` for input validation
- Node.js `child_process.spawn` for secure ccr invocation

For detailed development information, see:
- [Development Guide](docs/DEVELOPMENT.md)
- [Testing Guide](docs/TESTING.md)
- [Usage Guide](docs/USAGE.md)
- [Troubleshooting](docs/TROUBLESHOOTING.md)

## Platform Notes

- **Windows**: The spawn implementation uses an args array (no shell), so paths with spaces are handled safely
- **Unix**: Same approach works cross-platform
- **Security**: The `--dangerously-skip-permissions` flag is passed to ccr as required; ensure you trust the task files being processed

## License

MIT

TDQS

A3.8/5.0

Scored across 1 tool

Disambiguation5/5

There is only one tool, so an agent cannot confuse it with anything else. Its purpose (running a parallel hybrid search over a task file) is unambiguous, and the input contract is spelled out in detail.

Naming Consistency4/5

The single name 'scouts_search' follows a readable server-prefix + action pattern that would extend predictably. With one tool there is nothing to be inconsistent with, so it cannot earn a perfect score on pattern evidence.

Tool Count3/5

One tool is thin for a server that claims to cover codebase, doc, and commit-history search plus feature/bug/refactor workflows. It functions as a single facade over a CLI invocation, which is coherent but leaves little for an agent to compose.

Completeness2/5

The tool returns only a path to a result file, with no tool to read, poll, or list results, and no way to create or validate the required task markdown file under the sub-memory-bank directory. Agents hit a dead end after the search completes.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues