Get the FREE Ultimate OpenClaw Setup Guide →

mcp-summarization-functions

Provides summarised output from various actions that could otherwise eat up tokens and cause crashes for AI agents

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio braffolk-mcp-summarization-functions node path/to/summarization-functions/build/index.js \
  --env API_KEY="your-api-key" \
  --env MODEL_ID="claude-3-5-sonnet-20241022" \
  --env PROVIDER="ANTHROPIC" \
  --env MCP_WORKING_DIR="default_working_directory"

How to use

Summarization Functions provides a set of MCP tools designed to optimize AI context usage by generating concise summaries of large outputs. The server exposes four primary tools: summarize_command for executing and summarizing command outputs, summarize_files for summarizing the contents of one or more files, summarize_directory for obtaining a concise overview of a directory structure, and summarize_text for summarizing arbitrary text content. These tools help control context window growth, improve response quality, and enable focused analysis (e.g., security, API surface, error handling). To use them, configure an MCP client to invoke the appropriate function by sending the required payloads (with any optional hints or output formats) and receive structured summaries in your preferred format such as text, JSON, Markdown, or Outline. The server is designed to support multiple AI providers and configurable models via environment variables, making it adaptable to different agent workflows and deployment environments.

When integrating with AI agents, you should route large or potentially noisy outputs through the appropriate summarization function rather than feeding raw data directly. For example, use summarize_command to condense terminal results, summarize_files to condense file contents before passing to the agent, and summarize_directory to provide a high-level view of project structures. You can also tailor the output with hints (e.g., security_analysis, api_surface, error_handling) and select an output_format that best suits downstream tooling or prompts. By leveraging these tools, agents can maintain a compact but informative contextual baseline while retaining access to full data when necessary through content IDs or cached references.

How to install

Prerequisites:

  • Node.js (v14+ or as recommended by the project) and npm installed on your system
  • Access to the MCP server repository or package

Installation steps:

  1. Install using Smithery (recommended for seamless client integration):
npx -y @smithery/cli install mcp-summarization-functions --client claude
  1. Or install the MCP server package directly via npm (when available as a package):
npm i mcp-summarization-functions
  1. Verify installation and set up your environment variables as described in the README (Provider, API_KEY, MODEL_ID, etc.).
  2. Ensure the MCP server configuration includes the appropriate command, path, and environment variables so the server can start and respond to requests.

Starting the server (example):

node path/to/summarization-functions/build/index.js

Adjust the paths to match your project structure after installation.

Additional notes

Notes and tips:

  • Environment variables control which AI provider and model the server uses. Ensure API keys and provider selections are correct for your deployment.
  • You can customize MAX_TOKENS, SUMMARIZATION_CHAR_THRESHOLD, and other optional settings to tune performance and cost.
  • If you encounter authentication or network issues, verify API_KEY and PROVIDER_BASE_URL (when using OPENAI-COMPATIBLE providers) are correctly set.
  • For large repositories, consider using summarize_directory with recursive set to true to obtain a scalable overview before drilling down with summarize_files.
  • When using Smithery, you can integrate the CLI into CI/CD to automate installation and updates of the MCP server components.
  • If you need to switch providers or models, update the ENV VARs accordingly and restart the MCP server to apply changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers