BlackBox-MCP

BlackBox-MCP

Local-first FastMCP server for project context (scanning, memory, agent handoff) and configurable AI assistant delegation, supporting multiple providers, capability-based discovery, and asynchronous task management with state stored in JSON under ~/.blackbox.

Category
访问服务器

README

BlackBox-MCP

A FastMCP server for local project context and a configurable Agent Assistants / delegation system. Everything is local-first: state lives in plain JSON under ~/.blackbox/ — no database, no cloud service, no remote BlackBox. API keys are never stored in configuration; only the name of an environment variable that supplies them.

Tools

Project context (original)

Tool Purpose
project_scan Inventory a local project (file counts, languages, tree) and cache the result.
project_memory Small key/value facts scoped to a project (set / get / list / delete).
agent_handoff Leave, read, and resolve notes between agents.

Agent Assistants (v0.1)

Tool Purpose
list_providers List configured providers (public config only — never keys).
create_provider / update_provider / delete_provider Manage provider configurations.
list_assistants List configured assistants.
get_assistant Full configuration of one assistant.
create_assistant / update_assistant / delete_assistant Manage assistant profiles.
enable_assistant / disable_assistant Toggle an assistant on/off.
list_capabilities All capability terms in use across enabled assistants.
find_assistants Discover assistants by capability (all-of or any-of).
delegate_task Send a task to an assistant; returns a persistent task id.
get_task / list_tasks Inspect task state/result.
cancel_task Cancel a queued or running task when possible.

Install

cd ~/BlackBox-MCP
python3 -m venv .venv
.venv/bin/pip install "mcp>=1.10,<2" "httpx>=0.27"

server.py runs with the stdio transport, which is what Zed (and most MCP clients) expect.

Note: mcp 2.x replaced the FastMCP class with MCPServer, so BlackBox pins the latest 1.x release, which still ships the FastMCP API used here.

Run

~/BlackBox-MCP/.venv/bin/python ~/BlackBox-MCP/server.py

Zed configuration

Add this to ~/.config/zed/settings.json:

{
  "context_servers": {
    "blackbox": {
      "command": "/Users/michaelshingara/BlackBox-MCP/.venv/bin/python",
      "args": ["/Users/michaelshingara/BlackBox-MCP/server.py"],
      "env": {}
    }
  }
}

Then run the zed: restart server action for the BlackBox server (or restart Zed).

Note: args is required for stdio servers in Zed — an entry without it fails to load. The legacy "mcp" settings key has been replaced by "context_servers". Zed only resolves settings-based context servers when at least one project folder is open — extension servers are the exception.

Agent Assistants: concepts

Two separate, independently configurable concepts:

  • Providers describe how a model is reached (endpoint, provider type, optional env-var key). They contain no assistant identity and no prompt.
  • Assistants are user-defined agent profiles: identity, provider reference, model, system prompt, temperature, max tokens, capabilities, permissions, metadata.

Changing an assistant's provider or model never touches its name, description, system prompt, or capabilities.

Configuration

Configuration is human-readable JSON stored in ~/.blackbox/. You can edit the files directly or manage everything through the MCP tools.

Providers — ~/.blackbox/providers.json

{
  "provider::ollama": {
    "name": "ollama",
    "type": "ollama",
    "endpoint": "http://localhost:11434",
    "api_key_env": "",
    "options": {}
  },
  "provider::mistral": {
    "name": "mistral",
    "type": "openai_compatible",
    "endpoint": "https://api.mistral.ai/v1",
    "api_key_env": "MISTRAL_API_KEY",
    "options": {}
  }
}

Built-in provider types: stub (offline/test), openai_compatible (any /chat/completions endpoint: Mistral, OpenRouter, Gemini, custom), ollama.

Assistants — ~/.blackbox/assistants.json

{
  "assistant::swift_expert": {
    "id": "swift_expert",
    "name": "Swift Expert",
    "description": "Senior Swift/iOS engineer",
    "provider": "ollama",
    "model": "qwen2.5-coder",
    "system_prompt": "You are an expert Swift and iOS engineer. Answer concisely.",
    "temperature": 0.2,
    "max_tokens": 2048,
    "enabled": true,
    "capabilities": ["swift", "swiftui", "ios"],
    "permissions": ["read_files"],
    "metadata": {}
  }
}

Secrets

API keys are not stored in configuration. Providers reference an environment variable name via api_key_env; the value is resolved at request time. list_providers and create_provider only ever report the env-var name, never the key value.

Delegation

Lead Agent → BlackBox MCP → select assistant → resolve provider+model → execute → structured result
  • delegate_task(assistant_id, task, context=..., timeout=...) enqueues a task and returns a persistent task_id immediately. Execution is asynchronous.
  • Poll get_task(task_id) or list_tasks(...) for status.
  • Task statuses: queued, running, completed, failed, cancelled.
  • Task metadata: task_id, assistant_id, status, created_at, started_at, completed_at, task, context, result, error.

Safeguards (safe defaults)

  • max concurrent tasks: 4
  • per-task timeout: 600s (override per task)
  • maximum delegation depth: 3 (prevents uncontrolled recursive delegation)

Safeguards are module constants in blackbox/assistants/tasks.py and can be tuned there.

Capability-based discovery

You don't need to know every assistant's id:

Need: swift + ios + code_review
→ find_assistants(capabilities='["swift", "ios", "code_review"]')

Returns every enabled assistant whose capabilities contain all requested terms (or any, with any_of=true). list_capabilities() shows which terms exist.

Permissions

Assistants carry a simple, explicit permissions list (e.g. read_files, run_commands, git, web, build, test). Default is an empty list — nothing is granted implicitly. Permissions are currently descriptive metadata; enforcement hooks are designed into the model so they can be expanded later. BlackBox never executes arbitrary commands simply because a delegated assistant requests them.

Agent Orchestration coexistence

BlackBox-MCP does not duplicate Agent Orchestration:

  • Agent Orchestration → coordination, shared work state, handoffs, team coordination
  • BlackBox-MCP → project intelligence, memory, configurable assistants, delegation infrastructure

The existing agent_handoff tool is the bridge: assistants can record notes that Agent Orchestration reads.

Storage

All data lives locally in ~/.blackbox/:

  • projects.json — cached project_scan summaries
  • memory.jsonproject_memory facts
  • handoffs.jsonagent_handoff notes
  • providers.json — provider configurations
  • assistants.json — assistant profiles
  • tasks.json — delegated task state

Stop the server and delete a file to wipe that store.

Tests

cd ~/BlackBox-MCP
.venv/bin/python -m unittest discover -s tests -v

Tests cover the assistant registry (CRUD, validation, capability matching) and the delegation/task lifecycle (submit, completion, cancellation, timeouts, depth guard). They run against temporary directories and never touch ~/.blackbox.

Assistant/Provider Configuration Format

Provider

{
  "name": "openai",
  "type": "openai_compatible",
  "endpoint": "https://api.openai.com/v1",
  "api_key_env": "OPENAI_API_KEY",
  "options": {
    "model": "gpt-4o"
  }
}

Supported types: stub, openai_compatible, ollama, mistral, stepfun.

Assistant

{
  "name": "Pickle",
  "provider": "openai",
  "model": "gpt-4o",
  "role": "implementation",
  "description": "General-purpose implementation assistant",
  "system_prompt": "You are Pickle, an expert implementation assistant.",
  "temperature": 0.2,
  "capabilities": ["swift", "ios", "python"],
  "filesystem_permissions": ["read", "write"],
  "command_execution_permissions": ["bash"],
  "max_delegation_depth": 3,
  "timeout": 600.0,
  "memory_access": ["project_facts", "discoveries"]
}

Delegation Modes

  • delegate — single assistant
  • parallel — same task to multiple assistants
  • review — one produces, another reviews
  • debate — competing analyses
  • pipeline — chained output-to-input

Memory Categories

  • project_facts
  • architectural_decisions
  • discoveries
  • bugs
  • failed_approaches
  • recommendations
  • agent_observations
  • user_instructions

Security

  • API keys are referenced by env-var name only
  • Keys are never exposed via tools, logs, or memory
  • Configurable delegation depth and max spawned agents
  • Optional approval gates for command/file-write/destructive operations

First Delegation Example

  1. Create provider: create_provider(name="openai", type="openai_compatible", endpoint="https://api.openai.com/v1", api_key_env="OPENAI_API_KEY")
  2. Create assistant: create_assistant(name="Pickle", provider="openai", model="gpt-4o", role="implementation")
  3. Delegate: delegate_task(assistant_id="pickle", task="Implement this feature")
  4. Check result: get_task(task_id)

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选