Loop

Provides an MCP server that processes an array item by item with a per-item task, supporting batches, results storage, and optional summaries.
  • javascript

0

GitHub Stars

javascript

Language

6 months ago

First Indexed

3 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "smogili1-loop_mcp": {
      "command": "node",
      "args": [
        "/path/to/loop_mcp/server.js"
      ]
    }
  }
}

You can run a Loop MCP Server to let a large language model process an array item by item, performing a specific task on each entry, with optional batch processing and result summarization. This approach is ideal for long-running item-level workflows where you want clear progress, per-item results, and an optional summary of the entire run.

How to use

To process an array of items with a defined task, you first initialize the array and task description. You then fetch items one by one or in batches, perform your processing, and store each result. Once all items have been processed, you retrieve all results and, if desired, a summary. If you need to start over, you can reset the processing state.

Key flow patterns you can use:

  • Initialize the array with a task description and optional batch size.
  • Fetch the next item with get_next_item, process it, and store the result with store_result.
  • Or fetch the next batch with get_next_batch, process the batch, and store the batch results.
  • After all items are done, retrieve all results with get_all_results, optionally asking for a summary by setting summarize to true.
  • If you want to start over, call reset to clear the current processing state.

Initializing and running item-by-item processing

Initialize the array and task with two required fields: the list of items and the task description. You can also set batchSize to control how many items are processed together.

// Initialize
await callTool('initialize_array', {
  array: [1, 2, 3, 4, 5],
  task: 'Square each number',
  batchSize: 1
});

Process each item sequentially by repeatedly fetching the next item, performing your operation, and storing the result.

// Process each item
while (true) {
  const item = await callTool('get_next_item');
  if (item.text === 'All items have been processed.') break;
  const result = item.value * item.value;
  await callTool('store_result', { result });
}

Retrieve all results when processing is complete. You can request an optional summary.

const results = await callTool('get_all_results', { summarize: true });

Processing in batches

If you prefer batch processing, initialize with a batchSize greater than 1 and use get_next_batch to fetch items in groups.

// Initialize with batch size
await callTool('initialize_array', {
  array: [1,2,3,4,5,6,7,8,9,10],
  task: 'Double each number',
  batchSize: 3
});

// Process in batches
while (true) {
  const batch = await callTool('get_next_batch');
  if (batch.text === 'All items have been processed.') break;
  const results = batch.items.map(item => item * 2);
  await callTool('store_result', { result: results });
}

const results = await callTool('get_all_results', { summarize: true });

Resetting and integration

If you need to start over, call reset to clear the current processing state and begin again from the first item.

You can also integrate the Loop MCP Server with external tooling using standard MCP client calls. For example, you can configure a local runtime to point to the server and use a client to drive the initialization, processing, and final retrieval steps.

Example running context

Run the server locally and interact with it through your MCP client or automation script. You can start by installing dependencies and starting the server, then exercise the initialization, processing, and retrieval steps as shown above.

Available tools

initialize_array

Set up the array and task. Provide the array of items, the task description, and an optional batchSize to control processing batches.

get_next_item

Fetch the next item to process. Returns the item value, its index, the task, and how many items remain.

get_next_batch

Fetch the next batch of items based on the configured batchSize. Returns the batch items, indices, the task, and remaining count.

store_result

Store the result of processing a single item or a batch of items.

get_all_results

Retrieve all results after all items have been processed. Optionally request a summary.

reset

Clear the current processing state to restart the workflow from the first item.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational