Skip to content

BrainAPI is a knowledge graph–powered AI memory layer that transforms unstructured data into structured knowledge, enabling intelligent search, recommendations, and contextual memory for AI agents and applications.

fix(mcp): pat bearer header column parsing

Christian9d42a0dd8d24
diff --git a/README.md b/README.md
index 34f1d0c..6bbafc9 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://discord.gg/VTngQTaeDf"><img src="https://img.shields.io/badge/Discord-Join%20Lumen%20Brain-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord"/></a>
- <img src="https://img.shields.io/badge/version-2.11.11--dev-blue?style=for-the-badge" alt="Version"/>
+ <img src="https://img.shields.io/badge/version-2.11.12--dev-blue?style=for-the-badge" alt="Version"/>
<img src="https://img.shields.io/badge/python-3.11+-green?style=for-the-badge&logo=python&logoColor=white" alt="Python"/>
<img src="https://img.shields.io/badge/license-AGPLv3%20%2B%20Commons%20Clause-purple?style=for-the-badge" alt="License"/>
</p>
diff --git a/pyproject.toml b/pyproject.toml
index c932aba..418c804 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "brainapi2"
-version = "2.11.11-dev"
+version = "2.11.12-dev"
description = "Version 2.x.x of the BrainAPI memory layer."
authors = [
{name = "Christian",email = "[email protected]"}
diff --git a/src/services/mcp/app.py b/src/services/mcp/app.py
index d7c1221..1a55df6 100644
--- a/src/services/mcp/app.py
+++ b/src/services/mcp/app.py
@@ -114,6 +114,14 @@ class AuthContextMiddleware:
bearer = None
if raw.startswith("Bearer: "):
bearer = raw.removeprefix("Bearer: ").strip() or None
+ if bearer:
+ raw_headers = [
+ (name, value)
+ for name, value in raw_headers
+ if name.lower() != b"authorization"
+ ]
+ raw_headers.append((b"authorization", f"Bearer {bearer}".encode()))
+ scope = {**scope, "headers": raw_headers}
elif raw.startswith("Bearer "):
bearer = raw.removeprefix("Bearer ").strip() or None
if bearer: