Skip to main content
Glama

mcp-research-collective

Un sistema de investigación multi-agente construido sobre el Model Context Protocol (MCP). Agentes especializados (Planificador → Investigador → Razonador) colaboran a través de una pizarra de creencias compartidas segura para hilos, expuesta como herramientas MCP que pueden conectarse a Claude Desktop o cualquier otro host MCP.

Python License Local-first MCP Async

Qué demuestra esto

  • Model Context Protocol — un servidor FastMCP real y ejecutable con siete herramientas (blackboard_set, blackboard_get, blackboard_query, blackboard_dump, además de add/subtract/multiply/divide).

  • Arquitectura de pizarra — un almacén de creencias compartidas seguro para hilos (dataclass Belief + clase Blackboard con upsert/lectura/consulta protegidos por RLock, TTLs, consultas regex y filtros de etiquetas).

  • Orquestación multi-agente — El Planificador descompone el prompt → El Investigador obtiene hechos de una KB JSON → El Razonador sintetiza la respuesta final. Los agentes solo conocen el conector, nunca entre sí; se coordinan únicamente a través de la pizarra.

  • Dos transportes intercambiables — un MCPConnector en proceso para ejecuciones rápidas en notebooks/pruebas, y el servidor FastMCP STDIO real para producción / integración con Claude Desktop.

Related MCP server: deep-research

Stack tecnológico

  • Model Context Protocol Python SDK (mcp[cli]) — servidor FastMCP, ClientSession, transporte STDIO

  • Python 3.10+, asyncio, threading.RLock

  • pytest para pruebas deterministas de pizarra / agentes

  • Sin dependencia de LLM — los agentes en esta demo se orquestan sobre una KB estructurada. El servidor MCP es la superficie a la que tú (o cualquier host MCP) puedes conectar un LLM.

Arquitectura

flowchart TB
    U[User Prompt] --> P[PlannerAgent<br/>decomposes into subtasks]
    P -->|publishes 'task.list'| BB[(Blackboard<br/>thread-safe<br/>belief store)]
    BB -->|reads tasks| R[ResearchAgent<br/>fetches from kb/*.json]
    R -->|publishes belief.what / why / how| BB
    BB -->|reads beliefs| S[ReasonerAgent<br/>synthesizes answer]
    S -->|publishes answer.v1| BB
    S --> Out[Final answer<br/>+ full blackboard state]

    subgraph "MCP Surface"
        BB <-->|set/get/query/dump| MCP[FastMCP server<br/>STDIO transport]
        MCP <-->|JSON-RPC| Claude[Claude Desktop /<br/>any MCP host]
    end

Inicio rápido

# 1. Python env
python -m venv .venv
source .venv/Scripts/activate   # Windows: .venv\Scripts\activate
pip install -e .[dev]

# 2. Run the deterministic tests
pytest

# 3. Run the in-process orchestrator from the CLI
mcp-research-orchestrator "What is a Faculty Senate, why have one, and how is it built?"

# 4. Run the standalone MCP server (for Claude Desktop or another MCP host)
mcp-research-collective

Uso programático (en proceso, sin STDIO)

from mcp_research_collective import run_collective

answer, blackboard_state_json = run_collective(
    "What is the role of a Faculty Senate and why have one?"
)

print(answer)
# # Synthesized Answer
#
# **What it is**
# - Elected body of faculty that represents the academic community...
# ...
# **Why it matters**
# - Ensures academic decisions are not solely administrative
# ...

Uso con Claude Desktop

Este es el factor diferenciador: el mismo código que ejecuta la demo en proceso es también un servidor MCP funcional al que puedes conectarte desde Claude Desktop. Añade esto a tu claude_desktop_config.json:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "research-collective": {
      "command": "python",
      "args": ["-m", "mcp_research_collective.entrypoints.run_server"],
      "env": {
        "PYTHONPATH": "/absolute/path/to/mcp-research-collective/src"
      }
    }
  }
}

Después de reiniciar Claude Desktop, verás cuatro herramientas blackboard_* y cuatro herramientas matemáticas disponibles en la interfaz de usuario de Claude. Prueba:

Usa la herramienta blackboard_set para publicar un hecho sobre la fecha límite de mi proyecto, luego blackboard_query para encontrarlo de nuevo.

Añadir un nuevo tema de investigación

Coloca un archivo JSON en src/mcp_research_collective/kb/ con el esquema:

{
  "key": "topic.subkey",
  "what": ["fact 1", "fact 2"],
  "why":  ["fact 1", "fact 2"],
  "how":  ["fact 1", "fact 2"]
}

Luego construye el orquestador con topic_key="topic.subkey". No se requieren cambios de código.

Lo que aprendí

El patrón Planificador→Investigador→Razonador con una pizarra hace que la responsabilidad de cada agente sea lo suficientemente pequeña como para razonar sobre ella de forma aislada. El sistema escala dinámicamente su esfuerzo según el prompt: preguntar solo "qué" y "por qué" resulta en que el Planificador publique solo define.what y explain.why. El Investigador obtiene exactamente lo que se necesita, y la pizarra rastrea esta recopilación selectiva de contexto.

La mayor victoria no fue el formato de cable MCP, sino la disciplina de forzar cada mutación de estado a través de mcp.call("blackboard.set", ...). Ese único punto de estrangulamiento hace que todo el sistema sea trivialmente observable: dump_state() muestra exactamente qué contribuyó cada agente, cuándo y con qué confianza. Añadir un cuarto agente (como un Crítico o una Caché) es sencillo porque el contrato es simplemente "leer creencias etiquetadas, escribir creencias etiquetadas".

Diseño del proyecto

mcp-research-collective/
├── src/mcp_research_collective/
│   ├── blackboard.py        # Belief + thread-safe Blackboard
│   ├── connector.py         # In-process MCPConnector (set/get/query/dump)
│   ├── kb/*.json            # Knowledge base topics (drop-in JSON files)
│   ├── knowledge_base.py    # Loader for kb/*.json
│   ├── agents.py            # PlannerAgent, ResearchAgent, ReasonerAgent
│   ├── orchestrator.py      # CollectiveOrchestrator + run_collective
│   ├── mcp_server.py        # FastMCP server exposing blackboard + math tools
│   └── entrypoints/
│       ├── run_server.py        # `python -m ... run_server`
│       └── run_orchestrator.py  # `python -m ... run_orchestrator "<q>"`
├── tests/                   # blackboard + connector + orchestrator + KB tests
└── notebooks/demo.ipynb     # walkthrough with full blackboard state dump

Available Tools

8 tools
addB

Sum two numbers.

Inputs: a (required), b (required). Returns: result

blackboard_dumpA

Return the full (non-expired) blackboard state.

Inputs: no named parameters. Returns: object

blackboard_getA

Read a single belief by key. Returns None if absent or expired.

Inputs: key (required). Returns: result

blackboard_queryB

Query beliefs by regex pattern (over key or string value) and/or tag.

Inputs: pattern, tag. Returns: result

blackboard_setB

Publish a belief to the shared blackboard.

Returns the stored belief as a dict (with timestamp + provenance).

Inputs: key (required), value (required), source, confidence, +1 more. Returns: object

divideA

Divide a by b. Raises if b == 0.

Inputs: a (required), b (required). Returns: result

multiplyA

Multiply two numbers.

Inputs: a (required), b (required). Returns: result

subtractA

Subtract b from a.

Inputs: a (required), b (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 8 tools

    Disambiguation5/5

    All tools have clearly distinct purposes: the four arithmetic operations are separate, and the four blackboard operations (set, get, query, dump) each serve unique functions. There is no overlap or ambiguity.

    Naming Consistency3/5

    Arithmetic tools use single verbs (add, subtract, multiply, divide) while blackboard tools use a noun_verb pattern (blackboard_dump, blackboard_get, blackboard_query, blackboard_set). This inconsistency in naming convention across the server reduces coherence.

    Tool Count5/5

    With 8 tools covering two distinct subdomains (arithmetic and blackboard), the count feels well-scoped. Each tool serves a clear purpose without unnecessary duplication or bloat.

    Completeness4/5

    The arithmetic set is complete for basic operations. The blackboard tools are mostly complete but lack a delete/remove operation, which could be a gap for typical blackboard use cases. Minor gap.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      B
      maintenance
      File-based multi-agent coordination with persistent tasks, reports, issues and reviews. FCoP 4.0.5 provides 25 canonical MCP tools and 6 read-only resources over local stdio. Work stays in your project as Markdown records, with task lifecycle validation and branch workflows. Includes a Python API and a CLI for setup, inspection and diagnostics.
      25
      50 PyPI
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables deep research tasks using a multi-agent architecture that integrates any LLM and MCP tools. Available via MCP stdio, streamable HTTP, and SSE transports.
      16
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A multi-tool task agent MCP server with file search, SQLite query, calculator, and report writing tools. Enables Claude Code, Claude Desktop, or Cursor to control the same tools used by the agent, with guardrails for safety.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Shared memory and orchestration for coding agents, enabling persistent knowledge, multi-agent coordination, and a canonical workflow across MCP-compatible AI clients.
      83
      -