Token导航 LogoToken导航TokenDH.com
Paginate MCP logo
AI代理stdio官方级别未说明来源级核验

Paginate MCP

MCP Server

paginate-mcp

Paginate-Cmd MCP Server 是一个防止大型命令输出被截断的服务,确保AI代理可以访问和分析完整的命令结果。

工具数

2

提示词数

0

GitHub Stars

0

资源数

0
TypeScriptClaude命令行工具Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

andrelip

提供方

andrelip

最后核验

2026/5/17 20:22

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx paginate-mcp

详细介绍

寻呼Cmd MCP服务器

一种模型上下文协议(MCP)服务器,在处理大型命令输出时防止输出截断。非常适合确保AI代理可以访问和分析完整的命令结果,而不会达到上下文限制。

为什么使用这个?

当运行产生大量输出的shell命令时(如 git diff, git log, cat large_file.txt,或测试结果),Claude和其他AI代理经常截断输出或无法处理整个内容。这会导致分析不完整和信息缺失。

Paginate MCP通过以下方式解决了这个问题:

  • 防止截断 -自动处理超过5000个令牌的输出
  • 保留完整的上下文 -确保代理可以通过分页访问所有输出
  • 无缝集成 -与现有工作流透明地协同工作

设置

克劳德代码

使用一个命令将此MCP服务器添加到Claude Code中:

claude mcp add paginate_mcp npx paginate-mcp@latest

克劳德桌面

直接与npx一起使用,无需任何安装:

npx paginate-mcp

或者添加到您的Claude桌面或配置中:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "paginate-mcp": {
      "command": "npx",
      "args": ["-y", "paginate-mcp@latest"]
    }
  }
}

其他MCP客户端

直接与npx一起使用,无需任何安装:

npx paginate-mcp

示例用法

配置后,您可以向Claude提出通常会导致输出截断的问题:

Read git diff against origin/main using paginate-mcp and present me some suggestions to improve it

其他有用的例子:

  • “使用分页mcp运行完整的测试套件并分析所有故障”
  • “使用分页mcp读取昨天的整个应用程序日志并识别错误模式”
  • “使用分页mcp显示最近100次提交的完整git日志”

工具

run_paginated_cmd

执行shell命令并捕获其输出。

参数:

  • command (必填):要执行的shell命令
  • working_directory (可选):命令执行的工作目录
  • timeout (可选):超时秒数(默认值:30)

退货:

  • 如果输出\5000个令牌:分页响应 output_id 用于检索

示例(小输出):

{
  "status": "complete",
  "output": "=== STDOUT ===\nHello World\n\n=== STDERR ===\n\n=== Return Code: 0 ===",
  "estimated_tokens": 25,
  "command": "echo 'Hello World'",
  "return_code": 0
}

示例(大输出):

{
  "status": "paginated",
  "output_id": "uuid-here",
  "message": "Output too large (25000 estimated tokens). Use 'read_output_page' tool to retrieve all 5 pages sequentially.",
  "instruction": "IMPORTANT: You must paginate through ALL 5 pages...",
  "command": "cat large_file.txt",
  "return_code": 0,
  "total_pages": 5,
  "total_lines": 3421,
  "estimated_tokens": 25000
}

read_output_page

检索存储的命令输出的特定页面。

参数:

  • output_id (必填):分页响应中的ID
  • page (必填):要检索的页码(1-索引)

退货:

{
  "output_id": "uuid-here",
  "command": "cat large_file.txt",
  "page": 2,
  "total_pages": 5,
  "pages_read": [1, 2],
  "all_pages_read": false,
  "content": "page content here...",
  "has_next": true,
  "has_previous": true
}

令牌估计

服务器估计令牌为 text.length * 0.25这是一个保守的估计,以确保输出符合克劳德的上下文窗口。

分页行为

  • 页面大小:每页700行
  • 字符限制:每页30000个字符(硬限制)
  • 自动清理:读取所有页面后,输出存储将自动清理

依赖项

生产

  • @modelcontextprotocol/sdk -MCP协议实现

发展

  • typescript -TypeScript编译器
  • @types/node -Node.js类型定义

内置模块(无需安装)

  • child_process -命令执行
  • crypto -UUID生成
  • util -Promise实用程序

运作原理

sequenceDiagram
    participant Agent as AI Agent
    participant MCP as Paginate-MCP Server
    participant Shell as Shell Command
    participant Storage as In-Memory Storage

    Agent->>MCP: run_paginated_cmd("git log --all")
    MCP->>Shell: Execute command
    Shell-->>MCP: Full output (stdout/stderr)

    alt Output >Agent: Return complete output immediately
    else Output > 10,000 tokens
        MCP->>Storage: Store full output with UUID
        MCP-->>Agent: Return {status: "paginated", output_id, total_pages}

        loop For each page
            Agent->>MCP: read_output_page(output_id, page_num)
            MCP->>Storage: Retrieve page (700 lines)
            Storage-->>MCP: Page content
            MCP->>Storage: Mark page as read
            MCP-->>Agent: Page content + metadata
        end

        Note over MCP,Storage: After all pages read
        MCP->>Storage: Auto-cleanup output
    end

服务器维护两个内存中的数据结构:

  • outputStorage:存储分页的完整命令输出
  • pagesRead:跟踪已检索到的页面

当输出的所有页面都已读取时,存储会自动清理。

特性

  • 使用完整的stdout/stderr捕获执行shell命令
  • 超过10000个令牌的输出自动分页
  • 基于页面的大输出检索(每页700行或30KB)
  • MCP SDK之外没有外部依赖关系
  • 具有完全类型安全的TypeScript实现

许可证

麻省理工学院

目录标签

目录标签

TypeScriptClaude命令行工具命令处理本地部署AI代理分页服务

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

paginate-mcp

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP