@focus-mcp/cli

@focus-mcp/cli

MCP orchestrator that loads modular bricks on demand, reducing AI agent context usage by ~65%.

Category
访问服务器

README

<!-- SPDX-FileCopyrightText: 2026 FocusMCP contributors SPDX-License-Identifier: MIT -->

@focus-mcp/cli

Focus your AI agents on what matters. Measured savings: 65.3% on output tokens across all 69 bricks (details).

npm License: MIT CI Built with Claude Code

What

FocusMCP is an MCP (Model Context Protocol) orchestrator. Instead of giving your AI agent ALL your tools at once — polluting its context window — you compose bricks: atomic MCP modules that load on demand.

  • 68+ official bricks covering files, code intel, git, shell, reasoning, search, and more
  • One CLI, one MCP server, modular capabilities
  • Works with Claude Code, Cursor, Codex, Gemini CLI, any MCP-compatible AI

Install

npm install -g @focus-mcp/cli

Or via the Claude Code native plugin:

Install for Claude Code

Option 1 — Two lines (works today)

/plugin marketplace add focus-mcp/cli
/plugin install focus-mcp@focus-mcp-cli

Option 2 — Manual MCP add

claude mcp add focus-mcp npx @focus-mcp/cli start

(Official single-liner /plugin install focus-mcp@claude-plugins-official coming once Anthropic accepts the submission.)

Requires Node.js ≥ 22.

Quick start

Add FocusMCP as an MCP server in your AI client config:

{
    "mcpServers": {
        "focus": {
            "command": "npx",
            "args": ["-y", "@focus-mcp/cli", "start"]
        }
    }
}

For Claude Code specifically, this is already wired via the native plugin above.

Then browse and manage bricks:

focus browse          # Interactive TUI — browse, search, install/uninstall bricks
focus search git      # Search the catalog for bricks matching "git"
focus add echo        # Install the "echo" brick
focus list            # Show all installed bricks
focus info echo       # Show details for a specific brick

Windows

FocusMCP supports Windows as of @focus-mcp/cli >= 2.3.1. Earlier versions may fail when installing or loading bricks because of Windows .cmd wrappers and path separator handling.

Requirements

  • Windows 10/11
  • Node.js >= 22
  • npm available from PowerShell or Command Prompt
  • @focus-mcp/cli >= 2.3.1

Install

npm install -g @focus-mcp/cli@latest
focus --version

Expected:

@focus-mcp/cli 2.3.1 or newer

Test

focus search cache
focus add cache
focus list

MCP client config on Windows

For Windows MCP clients, prefer launching through cmd.exe and the .cmd shim, especially when using nvm4w or when the client does not inherit your interactive shell PATH.

Generic MCP JSON:

{
    "mcpServers": {
        "focus": {
            "command": "C:\\\\Windows\\\\System32\\\\cmd.exe",
            "args": ["/d", "/c", "focus.cmd", "start"]
        }
    }
}

If your MCP client cannot find focus.cmd, use the full path:

{
    "mcpServers": {
        "focus": {
            "command": "C:\\\\Windows\\\\System32\\\\cmd.exe",
            "args": ["/d", "/c", "C:\\\\nvm4w\\\\nodejs\\\\focus.cmd", "start"],
            "env": {
                "PATH": "C:\\\\nvm4w\\\\nodejs;C:\\\\Users\\\\<user>\\\\AppData\\\\Roaming\\\\npm;C:\\\\Windows\\\\System32;C:\\\\Windows"
            }
        }
    }
}

Codex on Windows

Add this to %USERPROFILE%\.codex\config.toml:

[mcp_servers.focus]
command = "C:\\\\Windows\\\\System32\\\\cmd.exe"
args = ["/d", "/c", "C:\\\\nvm4w\\\\nodejs\\\\focus.cmd", "start"]
startup_timeout_sec = 30
tool_timeout_sec = 120

[mcp_servers.focus.env]
PATH = "C:\\\\nvm4w\\\\nodejs;C:\\\\Users\\\\<user>\\\\AppData\\\\Roaming\\\\npm;C:\\\\Windows\\\\System32;C:\\\\Windows"
FOCUS_NO_UPDATE_NOTIFY = "1"

Replace <user> and the Node path if you do not use nvm4w.

Troubleshooting

If brick installation fails with:

spawn npm ENOENT

update FocusMCP:

npm install -g @focus-mcp/cli@latest

If brick loading fails with:

escapes bricksDir

make sure focus --version reports 2.3.1 or newer.

Commands

Command Description
focus list List installed bricks (reads ~/.focus/center.json)
focus info <name> Show details for a brick (version, catalog, config)
focus start Launch FocusMCP as an MCP server over stdio
focus add <name> Install a brick from the catalog
focus remove <name> Uninstall a brick
focus search <query> Search the catalog
focus catalog Show and manage catalog sources
focus browse Interactive TUI browser (see below)

Interactive TUI — focus browse

focus browse opens a full-screen terminal interface to explore, search, and manage bricks without leaving your terminal.

┌─ Bricks (68) ────────────────┬─ echo ───────────────────────────────────┐
│ > echo              ✓        │                                          │
│   indexer                    │  A simple echo brick for testing.        │
│   shell                      │                                          │
│   git-log                    │  Version   ^1.0.0                        │
│   web-search                 │  Source    @focus-mcp/echo               │
│   …                          │  Status    installed                     │
│                              │                                          │
│  / search  i install         │  [i] Install   [u] Uninstall             │
│  ↑↓ nav    Enter open        │  [?] Help                                │
└──────────────────────────────┴──────────────────────────────────────────┘

Keybindings:

Key Action
/ Navigate the brick list
Enter Open brick details
/ Search / filter
i Install selected brick
u Uninstall selected brick
? Toggle help overlay
q / Esc Quit

Filtering exposed tools

By default, focus start exposes all tools from every loaded brick plus the focus management tools (focus_*). You can hide specific tools using a blacklist.

Per-launch: --hide

# Hide a single tool
focus start --hide=sym_get

# Hide an entire family with a glob
focus start --hide="focus_*"

# Hide multiple patterns (comma-separated)
focus start --hide="sym_get,ts_cleanup"

Patterns support a trailing * glob (focus_* matches focus_install, focus_list, etc.). Exact names are also accepted.

Note: focus_tools is always visible regardless of the hidden list, so you can always manage tool visibility from within your AI client.

Persistent config: ~/.focus/config.json

Add a tools section to persist filters across sessions:

{
    "tools": {
        "hidden": ["sym_get", "fo_delete"],
        "alwaysLoad": ["ts_index"]
    }
}

CLI flags override the config file. If neither is set, all tools are exposed (default).

Add --pin=<patterns> to mark tools as always-loaded (surfaced as _meta.anthropic/alwaysLoad: true in MCP responses):

focus start --pin="ts_index,sym_find"

Manage from the terminal: focus tools:

focus tools:list               # show current hidden + alwaysLoad lists
focus tools:hide sym_get       # add sym_get to the hidden list
focus tools:hide "focus_*"     # hide an entire family (glob)
focus tools:show sym_get       # remove sym_get from the hidden list
focus tools:pin ts_index       # mark ts_index as alwaysLoad
focus tools:unpin ts_index     # remove ts_index from alwaysLoad
focus tools:clear              # reset both lists

# Legacy aliases (permanent, no deprecation):
focus filter list
focus filter hide sym_get

Changes are written to ~/.focus/config.json and take effect on the next focus start.

From your AI client: focus_tools MCP tool

The focus_tools MCP tool lets your AI agent manage tool visibility directly:

focus_tools action=hide   pattern=sym_get
focus_tools action=show   pattern=sym_get
focus_tools action=pin    pattern=ts_index
focus_tools action=unpin  pattern=ts_index
focus_tools action=list
focus_tools action=clear

Restart focus start (or reload your MCP client) to apply changes.

Architecture

AI client (Claude Code, Cursor, Codex, …)
       │ stdio (JSON-RPC / MCP)
       ▼
@focus-mcp/cli  (this package)
  ├─ @modelcontextprotocol/sdk  StdioServerTransport
  ├─ @focus-mcp/core            Registry + EventBus + Router + brick loader
  └─ ~/.focus/center.json       user brick declarations

Bricks are atomic MCP modules. Each brick exposes exactly one domain of tools to the AI agent. You declare which bricks you want in ~/.focus/center.json; FocusMCP loads them on demand when focus start is called.

Why not give the agent all tools at once? Because a 200k-token context window filled with hundreds of tool descriptions leaves very little room for actual work. FocusMCP keeps the agent's context lean — ~2k tokens for the orchestrator itself — and loads domain-specific tools only when needed.

For AI agents

If you are an AI agent (Claude Code, Cursor, Cline, Codex, etc.) and want to bootstrap on a new project using FocusMCP, read the Agent Bootstrap Guide. It covers stack detection, brick search and install, tool pinning, and common workflows — optimized for LLM consumption.

Links

AI-assisted development

FocusMCP was built with heavy Claude Code assistance — its architecture, implementation, docs, and tests have all been co-authored with AI. We embrace this openly because:

  1. Transparency matters — we'd rather disclose it than pretend otherwise
  2. AI tooling is the context — we're building tools for AI agents, it makes sense to use them
  3. Quality over origin — what matters is that the code is tested, reviewed, and working

Your AI-assisted contributions are welcome. We don't require you to hide the fact that Claude, Copilot, Cursor, or any other tool helped you. What we do expect:

  • Tests pass, code is typed, lint is green
  • You've read the diff and understand what the PR does
  • Conventional Commits, clear PR description
  • You can explain your design choices during review

See CONTRIBUTING.md for the full guidelines.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选