Initial commit: MCP Hub Community Edition v3.0.0

Community edition generated from private repo via sync pipeline.
Includes 9 plugins (WordPress, WooCommerce, WP Advanced, Gitea, n8n,
Supabase, OpenPanel, Appwrite, Directus) with ~587 tools.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
airano
2026-02-17 08:34:44 +03:30
commit cf62e65c55
237 changed files with 87596 additions and 0 deletions

40
core/context.py Normal file
View File

@@ -0,0 +1,40 @@
"""
Request Context Storage
Stores request-level information using contextvars for thread-safe access
across async operations.
"""
from contextvars import ContextVar
from typing import Any
# Context variable for storing API key info during request processing
# This allows unified handlers to check project access permissions
_api_key_context: ContextVar[dict[str, Any] | None] = ContextVar("api_key_context", default=None)
def set_api_key_context(key_id: str, project_id: str, scope: str, is_global: bool) -> None:
"""
Store API key information in request context.
Args:
key_id: API key identifier
project_id: Project the key belongs to ('*' for global)
scope: Access scope (read/write/admin)
is_global: Whether this is a global key
"""
_api_key_context.set(
{"key_id": key_id, "project_id": project_id, "scope": scope, "is_global": is_global}
)
def get_api_key_context() -> dict[str, Any] | None:
"""
Retrieve API key information from request context.
Returns:
Dict with key_id, project_id, scope, is_global or None
"""
return _api_key_context.get()
def clear_api_key_context() -> None:
"""Clear API key context (for cleanup)."""
_api_key_context.set(None)