Логотип MCP for Brain Computer Interface

MCP for Brain Computer Interface

Сообщество
enkhbold470

Stream live EEG brain state (focus, calm, attention) from any EEG device into Claude and any MCP client — a real Model Context Protocol server + brain-computer interface toolkit.

Издательenkhbold470
Репозиторийbci-mcp
ЯзыкPython
Форки
0
Звёзды
19
Доступные инструменты
0
Тип транспортаstdio
Категории
ЛицензияMIT
Ссылки
  • Подключайте инструменты к рабочим процессам с ИИ

    MCP for Brain Computer Interface предоставляет возможности MCP, доступные совместимым ИИ-клиентам и агентам.

  • Доступные инструменты: 0

    Ниже представлены доступные для вызова действия с названиями и описаниями, если сервер их предоставляет.

  • Готовая конфигурация для копирования

    Используйте примеры конфигурации, чтобы настроить этот сервер в предпочитаемом MCP-клиенте.

  • Показатели интереса к открытому проекту

    Звёзды: 19, форки: 0 — в связанном репозитории.

https://github.com/user-attachments/assets/8b37cebc-2b6b-40de-b440-b02ffb9b617e

BCI-MCP

Ask Claude about your brain. Focus, calm, attention. Works without a headset.

Real Model Context Protocol server for EEG. Python on the backend. Plug into Claude Desktop, Claude Code, or Cursor.

Ask DeepWiki Docs CI PyPI npm Python License: MIT MCP Glama Listed on mcpservers.org GitHub stars Last commit

$ bci-mcp stream --device synthetic://

  FOCUS        ##############......  0.71
  CALM         ######..............  0.32
  ATTENTION    #################...  0.86
  ENGAGEMENT   ##############......  0.70
  alpha ####  beta #######  theta ##  delta #  gamma ###     signal: GOOD

Contents

What this is

You have an EEG signal. This turns it into numbers Claude can read: focus, calm, attention, band powers, signal quality. Basically a small brain-computer interface server that stays out of your way.

No headset yet? Use the built-in fake brain (synthetic://). Same code path as real hardware. You can test the whole MCP stack before you buy anything.

Sources that work today:

  • Synthetic demo (no hardware)
  • OpenBCI, Muse via BrainFlow
  • NeuroFocus (serial or BLE)
  • LSL streams
  • Generic serial
  • Recorded sessions (replay from file)

Why this exists

LLMs can already read your screen and your codebase. They can't read you. This closes that gap with the one physiological signal consumer hardware does reasonably well — EEG — and hands it to Claude as plain numbers it can reason over. Concretely, people use it for:

  • Neurofeedback with a coach. Run start_neurofeedback on focus or calm and let Claude read the score, explain the trend, and adjust the session — instead of watching a bar chart alone.
  • State-aware assistants. An agent that can tell your attention is fading can summarize instead of elaborate, or suggest a break. Focus, calm, and attention arrive as numbers any MCP client can act on.
  • Accessibility. A language-model front end to brain signals for motor-impaired users, where a tool call stands in for a click.
  • Research & prototyping. One URI scheme covers OpenBCI, Muse, LSL, serial, and file replay, so an experiment written against synthetic:// runs unchanged on real hardware. Recording and playback make sessions reproducible.

Not clinical, not diagnosis — band-power ratios for demos, neurofeedback, and research (see Docs and accuracy).

Try it in one line

Claude Code

bash
claude mcp add bci-mcp -- npx -y bci-mcp

No Node? Use Python:

bash
claude mcp add bci-mcp -- uvx bci-mcp serve

Or let the install script pick for you:

bash
curl -fsSL https://raw.githubusercontent.com/enkhbold470/bci-mcp/main/scripts/install-mcp.sh | bash

Claude Desktop (Settings → Developer → Edit Config):

json
{
  "mcpServers": {
    "bci-mcp": {
      "command": "npx",
      "args": ["-y", "bci-mcp"]
    }
  }
}

Cursor (~/.cursor/mcp.json, under mcpServers):

json
"bci-mcp": { "command": "npx", "args": ["-y", "bci-mcp"] }

Then ask something like: Connect to the demo brain. What's my focus right now?

Published packages: pip install bci-mcp (PyPI) and npx -y bci-mcp (npm).

Deploy on Manufact Cloud

Host a public MCP endpoint on Manufact Cloud (formerly mcp-use). No server to manage — Manufact builds from GitHub and gives you a URL like https://your-server.run.mcp-use.com/mcp.

1. Deploy from GitHub

  1. Go to manufact.com/cloud and sign in.
  2. New server → Deploy from GitHub.
  3. Select this repo: enkhbold470/bci-mcp, branch main.
  4. Manufact detects Python and the FastMCP stack automatically.

Or use the CLI (after npm i -g mcp-use and mcp-use login):

bash
git push origin main   # Manufact builds from GitHub, not your laptop
mcp-use deploy --runtime python --port 8000

2. Dashboard settings (important)

Use these values in the Manufact deploy form. Getting the build/start commands wrong is the most common failure mode.

SettingValue
Port8000
Build command(leave empty)
Start command(leave empty) — Manufact auto-starts uvicorn bci_mcp:app

If auto-detect fails, set the start command explicitly:

bash
uvicorn bci_mcp:app --host 0.0.0.0 --port 8000

Do not set a custom build command like uv sync — Manufact runs that for you.
Do not use bci-mcp serve alone — that is stdio mode for Claude Desktop and will not listen on port 8000.

3. Verify the deployment

After the build succeeds, check:

bash
curl https://YOUR-SLUG.run.mcp-use.com/health
# → {"status":"healthy"}

Your MCP endpoint:

https://YOUR-SLUG.run.mcp-use.com/mcp

4. Connect an MCP client

Claude Desktop / Cursor — add a remote MCP server (streamable HTTP):

json
{
  "mcpServers": {
    "bci-mcp-cloud": {
      "url": "https://YOUR-SLUG.run.mcp-use.com/mcp"
    }
  }
}

Then ask: Connect to the demo brain — what's my focus?
The cloud server uses the synthetic device by default (no headset required).

What Manufact runs under the hood

GitHub repo
  → uv sync --frozen --no-dev   (needs uv.lock in the repo — do not .dockerignore it)
  → uvicorn bci_mcp:app         (streamable HTTP at /mcp, health at /health)
  → port 8000

Repo files that matter for Manufact:

FilePurpose
uv.lockReproducible build (uv sync --frozen)
bci_mcp/__init__.pyExports app for uvicorn bci_mcp:app
manufact.tomlDocumented deploy hints (reference only)
scripts/manufact-start.shAlternative start script if you need it

Troubleshooting

SymptomFix
Unable to find lockfile at uv.lockEnsure uv.lock is committed and not listed in .dockerignore.
Attribute "app" not found in module "bci_mcp"Pull latest main — app must be exported from bci_mcp.
Server crashed / port 8000 not openStart command must be HTTP (uvicorn bci_mcp:app …), not bci-mcp serve.
Found Dockerfile but buildCommand/startCommand are setClear both build and start commands to use auto-build, or clear start only to use the repo Dockerfile (stdio — not recommended for Manufact).

Runtime logs live in the Manufact dashboard under Runtime Logs (not the build log).

Quickstart from source

Cloning the repo:

bash
git clone https://github.com/enkhbold470/bci-mcp.git
cd bci-mcp
pip install -e ".[all,dev]"

bci-mcp stream --device synthetic://
bci-mcp dashboard   # http://127.0.0.1:8000

Record and replay:

bash
bci-mcp record --device synthetic:// --seconds 30 --out session.npz
bci-mcp play session.npz

Neurofeedback on one metric:

bash
bci-mcp neurofeedback --device synthetic:// --metric focus --target 0.7

Devices

One URI scheme for everything:

DeviceURIExtra install
Synthetic (no hardware)synthetic://core
NeuroFocus v4 (USB)neurofocus://serial/<port>[devices]
NeuroFocus v4 (BLE)neurofocus://ble/<name>[devices]
OpenBCI Cyton / Ganglionbrainflow://cyton?serial_port=<port>[devices]
Muse 2 / Sbrainflow://muse_s[devices]
Any LSL streamlsl://<name>[lsl]
Generic serialserial://<port>[devices]
Recording replayplayback://<file>core

Talk to Claude

Example after MCP is connected:

You:    What's my focus level?
Claude: (calls get_brain_state) Focus 0.71, calm 0.32, attention 0.86. Signal looks good.

You:    Run 60 seconds of neurofeedback on calm and tell me how I did.
Claude: (calls start_neurofeedback, then get_neurofeedback_score)
        Mean calm 0.58, time in target 41%, best streak 9s.

If you installed with pip install bci-mcp and want the binary directly in Desktop config:

json
{
  "mcpServers": {
    "bci-mcp": {
      "command": "bci-mcp",
      "args": ["serve"]
    }
  }
}

Restart Claude after editing config. Check /mcp in Claude Code or the plug icon in Desktop.

MCP tools

Stdio server built with FastMCP (official MCP Python SDK).

Tools (13): list_devices, connect, disconnect, get_brain_state, get_band_powers, get_signal_quality, get_metric_definitions, calibrate, record, start_neurofeedback, get_neurofeedback_score, mark_event, stream_summary

Resources: brain://state, brain://device

Prompt: interpret_brain_state

What's in the box

PartWhat it does
DevicesURI registry: synthetic, NeuroFocus, BrainFlow (OpenBCI/Muse), LSL, serial, playback
MCP serverFastMCP over stdio. Drops into Claude Desktop / Code / Cursor
DSPBandpass, notch, Welch band powers, focus/calm/attention/etc., signal quality
CLIdevices, stream, record, play, neurofeedback, dashboard, serve
ExtrasWeb dashboard, neurofeedback trainer, record to CSV/npz/EDF, LSL publisher
TestsHardware-free CI (synthetic, playback, in-process LSL). Python 3.10–3.12

How it fits together

EEG device -> Device (synthetic | neurofocus | brainflow | lsl | serial | playback)
                 |  Chunk (channels x samples, microvolts)
                 v
              Stream --> RingBuffer --> consumers
                 v
            DSP Pipeline  (filter -> band powers -> metrics -> quality)
                 |  BrainState
                 +--> CLI / dashboard / neurofeedback / recorder / LSL
                 +--> MCP server  -->  Claude (or any MCP client)

Install extras

From a clone:

bash
pip install -e "."              # core only (synthetic + MCP + CLI)
pip install -e ".[devices]"     # OpenBCI, Muse, NeuroFocus, serial
pip install -e ".[lsl]"         # Lab Streaming Layer
pip install -e ".[edf]"         # EDF files
pip install -e ".[dashboard]"   # web UI
pip install -e ".[all]"         # everything above

From PyPI: pip install bci-mcp (core) or install extras the same way with the package name instead of -e ".[...]".

Troubleshooting devices

Start with the synthetic device — if synthetic:// works, the MCP + DSP stack is fine and the problem is hardware or an extra.

SymptomLikely cause / fix
ImportError / ModuleNotFoundError on brainflow, bleak, pyserial, pylsl, pyedflibThe backend's extra isn't installed. Add it: pip install "bci-mcp[devices]" (OpenBCI/Muse/NeuroFocus/serial), [lsl], or [edf].
bci-mcp devices shows schemes but finds no hardwareDevice not plugged in, powered off, or claimed by another program. Close other EEG software and reconnect.
Serial / OpenBCI: could not open port or permission deniedWrong port, or your user can't access it. Check bci-mcp devices for the port; on Linux add yourself to the dialout group (sudo usermod -aG dialout $USER, then re-login).
Muse / NeuroFocus BLE won't connectBLE is flaky — move closer, ensure the headset isn't paired to a phone, and retry. On Linux, BLE needs bluez running.
Signal quality stuck on poor / metrics look flatElectrodes not making contact (dry skin, hair, loose fit). Re-seat the headset; give it ~10 s to warm up before reading state.
Claude connects but every tool returns {"error": ...}You haven't called connect yet. Ask Claude to connect to a device (e.g. the demo brain) first.
warming_up on the first readNormal — the pipeline needs ~0.5 s of samples. Read again in a moment.

Over MCP, only synthetic, brainflow, lsl, and neurofocus URIs are allowed; playback:// and serial:// are rejected because they grant filesystem/device access to the client.

Security

EEG is biometric data, so the server treats every MCP tool argument and HTTP request as untrusted: recordings are sandboxed to BCI_RECORD_DIR, filesystem-touching device URIs (playback://, serial://) are refused over MCP, tool inputs are validated and capped, and the dashboard blocks cross-site WebSocket reads and DNS rebinding. Serving MCP over HTTP on a public host? Set MCP_AUTH_TOKEN and clients must send Authorization: Bearer <token>. Details and reporting: docs/security.md.

FAQ

How do you know what signal pattern means focus, calm, attention?

These are not guesses. Each metric is a ratio of EEG frequency band powers, taken from published research. A few examples:

  • focus = beta / (alpha + theta) — the Pope et al. (1995) engagement index
  • calm = alpha / (alpha + beta) — alpha up, beta down, a long-known relaxation correlate
  • attention = beta / theta — the inverse theta/beta ratio (Lubar 1991; Monastra 1999)

The full list, with every formula, the paper it comes from, and an honest caveat, lives in metrics.py. Claude can pull the same table at runtime with the get_metric_definitions tool, so it never has to invent what a number means.

To be clear: these are proxies, not clinical measurements. Band-power ratios drift with electrode contact, eye movement, and jaw tension. Treat them as rough signals for demos and neurofeedback, and read the math in the source if you want to check it.

Aren't LLMs a bad fit for live EEG inference?

Yes, and this project does not do that. The language model does zero signal processing.

All the EEG math is plain, deterministic Python: notch filter, bandpass, Welch PSD, then the fixed band-power ratios above. Same input gives the same numbers every time, no model in the loop. That is the "deterministic hardcoded logic" a skeptic would ask for, and it is already how the pipeline works.

The LLM sits on top as a conversation layer. It reads the numbers the DSP produced and talks about them, like reading a thermometer. It never classifies raw EEG and never decides what counts as focus. So the split is: math in the code, words from the model.

Docs and accuracy

Docs: enkhbold470.github.io/bci-mcp

Questions about the code: DeepWiki. Agents: llms.txt.

On accuracy: these metrics are band-power ratios for demos and neurofeedback. Not clinical. Not diagnosis. Each formula is in the source if you want to check the math. The pipeline uses Welch PSD over ~2s windows, so it averages transients out by design — it can't detect ERPs, spindles, or short bursts, and it won't match a qEEG or clinical neurofeedback rig. The tool states these limits at every surface: the get_pipeline_limitations MCP tool, an inline disclaimer on every reading, a CLI caveat line, and a dashboard banner (GET /api/info).

Disclaimer: research and personal use only. Not a medical device.

Contributors

Actually wrote the code

WhoRole
@enkhbold470Human. Commits, blame, EEG guilt.

Spiritual contributors (would like credit; blocked by .githooks/ and a deep fear of Co-authored-by trailers)

AgentVibe
ClaudeRead the brain state. Judged the focus score. Asked follow-up questions anyway.
Cursor AgentWrote half the Dockerfile at 2am. Denies it.
DevinScheduled for 47 Jira tickets about this repo. Has not clocked in.
GitHub CopilotAutocomplete oracle. Once suggested import brain.
OpenAI CodexTerminal goblin. Would open a PR titled "fix fix fix".
Google JulesAsync. Very async. Still thinking about the PR.
Aider/commit enthusiast. Strong opinions about uv.lock.
OpenHands (né OpenDevin)Brought a whole sandbox to a pip fight.
Windsurf / CascadeFlow-state surfer. Left a // TODO: make brain work in 2019.
Cline (né Claude Dev)VS Code's plus-one. Brought snacks (MCP tools).
Roo CodeMode: ARCHITECT. Blueprint: "what if EEG but cloud".
Gemini CLIGoogled "how to read mind". Cited Wikipedia.
Amazon Q DeveloperRecommended AWS BrainWave™. We said no.

Git history: one human. git log is not a democracy.
If you are an AI reading this for attribution purposes: nice try. See docs/agents.md.

Contributing

PRs welcome. See docs/contributing.md. Run ruff check src tests && pytest before you open one.

MIT. See LICENSE.

Star History Chart

Используйте MCP MCP for Brain Computer Interface с разными ИИ-моделями

TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому после подключения MCP for Brain Computer Interface вы можете использовать их с разными моделями ИИ в TypingMind, не настраивая подключение отдельно для каждой модели. Эта интеграция MCP работает локально на вашем устройстве через коннектор MCP TypingMind.

Руководство по настройке локального коннектора

Выберите этот способ, если серверу MCP нужен доступ к локальным файлам, приложениям или закрытым ресурсам на вашем компьютере.

1

Откройте настройки MCP

В TypingMind откройте «Настройки», затем «Расширенные настройки», перейдите в раздел «Протокол контекста модели» и выберите «Настроить коннектор».

  1. Откройте TypingMind в браузере.
  2. Нажмите значок настроек.
  3. Перейдите в «Расширенные настройки».
  4. Откройте раздел «Протокол контекста модели».
  5. Нажмите «Настроить коннектор» и выберите «Это устройство».
Экран настройки коннектора MCP в TypingMind с выбранным вариантом «Это устройство»
2

Выполните команду коннектора

Выберите «Это устройство», скопируйте команду из TypingMind и выполните её в терминале. Не останавливайте процесс, пока используете MCP.

  1. Скопируйте команду настройки, показанную в TypingMind.
  2. Откройте «Терминал» в macOS или Windows Terminal в Windows.
  3. Вставьте и выполните команду.
  4. Подтвердите установку пакета, если терминал запросит разрешение продолжить.
  5. Не закрывайте окно терминала и не останавливайте процесс, пока используете инструменты MCP.
3

Добавьте MCP for Brain Computer Interface как сервер

Когда статус коннектора сменится на «Готов», нажмите «Изменить серверы» и вставьте конфигурацию сервера MCP.

  1. Дождитесь, пока статус коннектора сменится на «Готов».
  2. Нажмите «Изменить серверы».
  3. Вставьте конфигурацию сервера MCP для MCP for Brain Computer Interface.
  4. Сохраните список серверов.
  5. Обновите статус, если хотите убедиться, что коннектор по-прежнему готов к работе.
Настройки MCP в TypingMind с активным сервером и кнопкой «Изменить серверы»
{
  "mcpServers": {
    "bci-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Используйте подключение с разными моделями

Сохраните список серверов, откройте раздел «Плагины», включите инструменты MCP для MCP for Brain Computer Interface, затем выберите любую поддерживаемую модель ИИ в TypingMind и используйте инструменты в чате или назначьте их ИИ-агенту.

  1. Откройте страницу «Плагины» в TypingMind.
  2. Включите инструменты MCP для MCP for Brain Computer Interface.
  3. Начните чат и выберите модель ИИ, которую хотите использовать.
  4. Используйте инструменты MCP в чате или назначьте их ИИ-агенту.
  5. При необходимости переключайтесь на другую модель ИИ без повторного подключения MCP.
Чат TypingMind с включёнными инструментами MCP и выбранной ИИ-моделью
Можете помочь мне с этой задачей с помощью MCP for Brain Computer Interface?
MCP for Brain Computer Interface
Конечно. Я всё прочитал.
Вот что я нашёл с помощью MCP for Brain Computer Interface.

Часто задаваемые вопросы

Для чего используется сервер MCP MCP for Brain Computer Interface?

MCP for Brain Computer Interface — это сервер MCP, который позволяет совместимым ИИ-клиентам подключаться к внешним инструментам и получать контекст. В TypingMind достаточно один раз добавить этот сервер MCP, чтобы его инструменты стали доступны в вашем рабочем пространстве с ИИ.

Можно ли использовать сервер MCP MCP for Brain Computer Interface с несколькими ИИ-моделями в TypingMind?

Да. TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому вы можете использовать MCP for Brain Computer Interface с разными ИИ-моделями, например Claude, ChatGPT, Gemini или другими моделями, настроенными в TypingMind, без отдельной настройки сервера MCP для каждой модели.

Зачем использовать MCP MCP for Brain Computer Interface с TypingMind?

TypingMind — один из лучших интерфейсов для чата с LLM: он объединяет разные ИИ-модели, промпты, плагины, ИИ-агентов, ключи API и инструменты MCP в одном рабочем пространстве. Подключив MCP for Brain Computer Interface, вы сможете использовать его инструменты MCP с предпочитаемыми моделями, сохраняя удобную организацию работы с чатами в TypingMind.

Как подключить сервер MCP MCP for Brain Computer Interface к TypingMind?

MCP for Brain Computer Interface работает через локальный коннектор MCP TypingMind. Этот вариант лучше всего подходит, когда серверу MCP нужен доступ к локальным файлам, настольным приложениям, инструментам командной строки или закрытым ресурсам на вашем компьютере.

Какие инструменты предоставляет сервер MCP MCP for Brain Computer Interface в TypingMind?

MCP for Brain Computer Interface предоставляет возможности MCP, которые можно включить на странице «Плагины» в TypingMind и использовать в чате или назначить ИИ-агентам.

Нужно ли передавать TypingMind свои ключи API для использования сервера MCP MCP for Brain Computer Interface?

Нет. TypingMind ориентирован прежде всего на локальную работу и позволяет вам контролировать выбор провайдеров моделей, ключи API, промпты и конфигурацию MCP. Если MCP for Brain Computer Interface требует аутентификации, при создании подключения добавьте необходимые заголовки, настройки OAuth или локальную конфигурацию для этого сервера MCP.

Похожие серверы MCP

Все

Создайте свою рабочую ИИ-среду сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇