Borrowing it
Nothing to install: this file belongs to masx200/persistent-terminal-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/masx200/persistent-terminal-mcp/main/CLAUDE.mdgit clone --depth 1 https://github.com/masx200/persistent-terminal-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/masx200/persistent-terminal-mcp/claude-md)<a href="https://agentmods.dev/instructions/masx200/persistent-terminal-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/masx200/persistent-terminal-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/masx200/persistent-terminal-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/masx200/persistent-terminal-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01910 | $0.01910 |
| Opus 5.5 | $0.00764 | $0.00764 |
| Sonnet 5.5 | $0.00382 | $0.00382 |
| Haiku 4.5 | $0.00191 | $0.00191 |
Grade A, and why
persistent-terminal-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 302 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
项目概述
这是一个基于 TypeScript 的 Model Context Protocol (MCP) 服务器,提供持久化终端会话管理功能。项目实现了完整的 MCP 协议标准,支持多种客户端(Claude Desktop、Claude Code、Cursor、Cline 等)。
核心架构
主要组件
-
MCP 服务器 (
src/mcp-server.ts)- 实现 Model Context Protocol 标准
- 处理 JSON-RPC 通信
- 提供工具、资源、提示词和日志功能
-
终端管理器 (
src/terminal-manager.ts)- 基于
node-pty的持久化终端会话管理 - 支持多终端会话并发
- 智能输出处理和 Spinner 压缩
- 自动超时清理机制
- 基于
-
Web UI 系统
- 基于 Express + WebSocket 的实时界面 (
src/web-ui-server.ts) - 使用 xterm.js 渲染终端界面 (
public/terminal.html) - 支持交互式操作和实时通信
- 基于 Express + WebSocket 的实时界面 (
-
REST API 服务器 (
src/rest-server.ts,src/rest-api.ts)- 独立的 HTTP 服务器(端口 3001)
- 完整的 RESTful API 接口
- 支持非 MCP 客户端集成
数据流架构
MCP Client ↔ MCP Server ↔ Terminal Manager ↔ Node PTY ↔ Terminal Process
↓
Web UI Server ↔ WebSocket ↔ Browser
↓
REST API Server ↔ HTTP Client
开发命令
构建和运行
# 构建 TypeScript 项目
npm run build
# 开发模式运行 MCP 服务器
npm run dev
# 生产模式运行
npm run start
# 开发模式运行 REST API 服务器
npm run dev:rest
测试
# 运行所有测试
npm test
# 仅运行单元测试
npm run test:unit
# 运行集成测试
npm run test:integration
# 运行特定集成测试
npm run test:integration:stdio
npm run test:integration:cursor
npm run test:integration:terminal
# 运行测试并生成覆盖率报告
npm test -- --coverage
示例和调试
# 基本使用示例
npm run example:basic
# REST API 演示
npm run example:rest
# 交互式演示
npm run example:interactive
# 智能读取演示
npm run example:smart
# Spinner 压缩测试
npm run example:spinner
# Web UI 测试
npm run example:webui
# 测试所有工具
npm run test:tools
环境配置
必需环境变量
# REST API 服务器端口
REST_PORT=3001
# 终端配置
MAX_BUFFER_SIZE=10000 # 最大缓冲区行数
SESSION_TIMEOUT=86400000 # 会话超时时间(24小时)
# 终端尺寸
DEFAULT_COLS=80
DEFAULT_ROWS=24
# 日志级别
LOG_LEVEL=info
开发配置
# 启用 MCP 调试模式
MCP_DEBUG=true
# 启用应用调试模式
DEBUG=true
关键技术细节
MCP 协议实现
- 使用
@modelcontextprotocol/sdk实现 - 支持 stdio 传输模式
- 保持 stdout 纯净,所有日志输出到 stderr
- 实现完整的工具、资源、提示词和日志功能
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 302 lines · 1,910 tokens per session scan A 9a4cee6ec337
persistent-terminal-mcp CLAUDE.md is an instructions file published in the GitHub repository masx200/persistent-terminal-mcp (4 stars, last pushed 6mo ago), licensed MIT. It adds 1,910 tokens to every session, about $0.0076 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
persistent-terminal-mcp CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| persistent-terminal-mcp CLAUDE.mdmasx200/persistent-terminal-mcp | Instructions file | 4 | 6mo ago | MIT | A | 1,910 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |