MCP Server

The MCP (Model Context Protocol) server exposes SpikeLab’s core analysis methods as tools that can be called programmatically by LLM-based analysis agents. It provides a JSON-based interface to load data, run analyses, and retrieve results.

Main MCP server implementation for spike data analysis.

Registers all tools and handles transport (stdio or SSE).

spikelab.mcp_server.server.MAX_INLINE_ARRAY_SIZE = 10000

Soft cap on the number of elements in a numpy array that the MCP result sanitiser will inline into the JSON response. Arrays whose .size exceeds this raise a ValueError from _sanitize_for_json() rather than being silently materialised into a Python list (which can blow up the JSON payload and slow the protocol layer to a crawl). Adjustable at runtime by writing to spikelab.mcp_server.server.MAX_INLINE_ARRAY_SIZE after import — e.g. for embedded callers that know the protocol can handle larger payloads, or for tests that want to exercise the threshold branch with a small cap.

async spikelab.mcp_server.server.main()[source]

Run the MCP server with the selected transport.