MCP Server Internals
MCP Server Internals
The MCP server built into OpenL Studio is the TypeScript program of STUDIO/studio-mcp. This page maps its sources,
the path of a request from /mcp to the OpenL Studio REST API, and where the server keeps state. How OpenL Studio
runs and secures the server is in Built-in MCP Server; how users
connect agents is in the OpenL Studio MCP Server Guide; the conventions for
changing the server are in STUDIO/studio-mcp/AGENTS.md.
Sources
All paths are under STUDIO/studio-mcp/src.
index.ts— the entry point, which starts the HTTP transport; the server has no other mode.http-server.ts— thenode:httprequest listener with/mcp: the body limit and the routing of a request to its transport.mcp-core.ts— oneMcpServerwith every tool of the registry and the skills registered on it; the server offers no prompts.skills.ts— the OpenL skills, which the skills extension of the MCP SDK serves.handlers/— the tools, one module per category.handlers/common.tsholds the registry, argument validation, the answer of a tool and error mapping;handlers/wait.tsthe wait for Studio’s background work;handlers/table-edit.tsthe end of every table edit: the id Studio answers for a renamed table, and the read that compiles the table again.client.ts,auth.ts—OpenLClient, the client of the Studio REST API, and theAuthorizationheader it sends.http.ts— the HTTP client underOpenLClient, on thefetchof Node.js: query strings, JSON and multipart bodies, timeouts and the errors of a call. It ignoresHTTP_PROXY, asfetchdoes unlessNODE_USE_ENV_PROXYor--use-env-proxyturns the proxy of the environment on.schemas.ts,types.ts,formatters.ts— the Zod schemas of the tool arguments, the Studio REST types, and the rendering of a result as JSON or Markdown;markdown-list.tsrenders a list as a Markdown table,json-cut.tscuts a JSON answer over the limit in its structure,table-grid.tsconverts between Studio’s matrix of cells and the rows, merges and formulas the table tools read and write, andtext.tsholds the text helpers both renderings share.guides-registry.ts— the specifications and the Reference Guide OpenL Studio serves at/docs.transfer-links.ts— the links a file tool answers instead of the bytes of a file: a transfer link Studio issues where it authenticates, the address of the REST API in single-user mode, with where the file lives in its repository and acurlcommand (MCP File Transfer Links).telemetry.ts,tool-telemetry.ts— OpenTelemetry.index.tsloadstelemetry.ts, the OpenTelemetry SDK for Node.js with the instrumentation ofnode:httpand offetch, only whenOTEL_SDK_DISABLEDisfalse, and stops it onSIGTERM, so the buffered telemetry is sent. A failure to start it is logged, and the server runs without telemetry.tool-telemetry.tswraps every tool call in a spantools/call <tool>and recordsmcp.server.operation.duration, through the OpenTelemetry API, which does nothing without the SDK.- Build time —
rolldown.config.jsof the module bundles the server and its dependencies into minified ES modules:dist/index.mjs, and beside it a chunk for each module the server imports only when it needs it, such as the OpenTelemetry SDK;build-requires.ts, a plugin of the bundler, bundles the packages a dependency loads with arequireof its own instead of leaving them to anode_modulesfolder the war does not carry;build-licenses.ts, a plugin of the bundler, lists the libraries the bundle ships indist/mcp-licenses.json, andbuild-skills.ts, another, embeds the files of the skills ofSTUDIO/studio-mcp/skillsas the modulevirtual:skills, which the tests import through the same plugin.
The Path of a Request
McpProxyServletof OpenL Studio gets the request once the security of Studio has checked its credentials, as for a REST call. It passes the request to127.0.0.1at the port of the server with its path, query, headers and body, and adds two addresses of Studio: the one to call it at, the local address and port the request came in through, inOpenL-Base-Url, and the one the client opened inOpenL-Public-Url. A virtual thread streams the answer back, so no thread of the servlet container waits for the server.- A JSON body is read up to 5 MB; a larger one answers
413, and one that is not JSON answers400, both with a JSON-RPC error. - A 2026-07-28 request goes to the stateless handler, which builds a fresh
McpServerand a freshOpenLClientwith theAuthorizationheader of the request. A 2025 client gets a sessionful transport perMcp-Session-Id, with a client of its own. The client also knows the address of OpenL Studio the caller opened, foropenl_get_server_info, fromOpenL-Public-Url. - The server registers every tool; an unknown one answers with the
InvalidParamserrorTool <name> not foundof the SDK. Each tool is registered with a schema that publishes its JSON Schema and passes the arguments on. The published schema leaves out the dialect, the bounds of a safe integer Zod puts on every integer and the length of 1 of a non-empty string, which every agent would load in every session and which tell it nothing;executeToolvalidates the arguments against the strict schema of the tool, nested keys included, with the hints of the tool, and the handler runs. OpenLClientcalls/restof the address inOpenL-Base-Url, with a fixed timeout of 30 seconds per call. TheAuthorizationheader of the request, which Studio has checked at/mcp, goes to Studio as it is. The client keeps no cookie: Studio keeps the state of a client for its credential.
Tool names are bare inside the registry (get_table); the openl_ prefix is added and stripped on the wire only.
Where the State Lives
- Per request — a 2026-07-28 request has its own client: its cache of repositories, nothing more.
- Per legacy session — one transport, one
McpServerand one client for the life of the session. The session ends when the client closes it. Most clients never do, so opening a session closes the others no request has used for 30 minutes, the HTTP session timeout of Studio. A session with a request in progress, its stream of server messages included, is in use. - Per process — the tool registry, which all callers share. Table ids need no state of the server: Studio keeps a table’s id when the table moves and serves an id from before a rename (Stable Table Ids).
- In OpenL Studio — the compiled project, test and run results, the debug session and merge conflicts live in the client scope of Studio (Client Sessions), kept per credential: per personal access token, per sign-in of the identity provider, or per user. In single-user mode they are kept for the one user, so stateless requests without a token find them too.
Waiting for Studio
- Background results —
waitForResultofhandlers/wait.tsreads a result Studio answers with202 {"status":"notReady"}until it is ready: test results and merges. It reads again after a pause that grows from 250 ms to 2 s, sendsnotifications/progressmeanwhile, and stops on theAbortSignalof the call. - Table runs —
openl_run_tablestarts the run and polls its result within the same call. - Compilation —
openl_project_statusswitches the project to a requested branch, taking its dependencies of the same repository along as Studio does, then compiles an idle project through a table read, which Studio answers once the compilation ends, and waits for a compilation already running, such as the one an edit starts, reading the short status as a refresh from disk does (untilCompiledofhandlers/freshness.ts). One that outlaststimeoutMs(30 seconds by default) is answered ascompiling, without counts of messages or tests, with a note to call again. The server opens no WebSocket. - Trace —
openl_resume_tracepolls the trace status every 250 ms, 30 s by default.
Responses and Errors
- Results — a list and test results are Markdown tables in a text content block (
markdown-list.ts), whose header names each field once; anything else is JSON without indentation: the agent reads it as well as indented JSON, and indentation alone would take more of its context than the data, 60% of a table read. A result over 25,000 characters is cut by whole items: a list by rows, with the offset of the next page in its first line moved to match, a table read by rows, withtotalRowsand theoffsetto continue from. The note on a cut result names only a way to continue that the tool has. A JSON answer that has no items to cut by, or whose one item does not fit, is cut in its structure (json-cut.ts): texts longer than 200 characters are shortened, then the largest array loses items from its middle, keeping its first and last ones, then the largest object is replaced by the count of its keys, and the note names each cut by its path. A page ofopenl_get_test_resultsis cut by whole test tables, and the tests of one test table by whole tests. Guides and the AGENTS.md guidance of a project are never cut. A file read answers a text of up to 5,000 bytes inline, and any other file by a link the agent runscurlwith (MCP File Transfer Links). - Errors — a failed tool answers with an
isErrorresult; only an unknown tool is a protocol error. A Studio status maps to a code:400and404toInvalidParams,401and403toInvalidRequest,405toMethodNotFound, the rest toInternalError. Validation errors of Studio are folded into the message, up to 20 lines; the REST address stays in the log.
Guides
- Source — OpenL Studio serves the specifications at
/docs/ref, the Reference Guide at/docs/reference-guideand the migration notes of the releases since 5.25 at/docs/migration-notes, with its other user guides. Every guide tool reads the table of contents,/docs/toc.json, which gives the title and the size of each page, andopenl_get_guidesreads the pages it is asked for. Theindex.mdpage of a folder stays out. - Ids —
spec/…andguide/…: the path in the folder without.mdand number prefixes. Renaming a page changes its id. The migration notes of a release aremigration/<version>, such asmigration/7.0.0. - Migration notes — a guide tool gives the
## Rules Authorssection of the notes, up to the next section of its level, under the titleOpenL Tablets <version> Migration Notes, so an agent migrating a project reads only what concerns its rules. The index reads every listed note to give the size of that section, and leaves out a release whose notes have none, soopenl_get_guidestakes its id for unknown. The index lists the releases oldest first, the order a project is migrated in, while the table of contents shows them newest first. - Paths —
pathis the address of a document relative to the address of OpenL Studio. Bodies come as Studio serves them, so their links and images are relative to that address too.
Skills
- Source — one folder per skill in
STUDIO/studio-mcp/skills, in the layout of the Agent Skills specification. Each holds only what the tools, the server instructions and the guides Studio serves do not say. - Build — the bundler loads
skills/with the skills extension of the MCP SDK and embeds the text of every file it serves; hidden files and folders, such as.DS_Store, are left out. A skill the extension refuses — one against the specification, such as anameother than its folder or a description over 1024 characters, or over the limits of 512 files or 16 MiB — or a file that is not UTF-8 text fails the build. - Protocol — the SDK serves the embedded files (
SkillsExtensionof@modelcontextprotocol/server/ext/skills) and declaresio.modelcontextprotocol/skillsin the capabilities, withdirectoryRead. Every file is a resourceskill://<skill>/<path>, which the templateskill://{+path}reads;resources/listnames eachSKILL.mdby the name and description of its frontmatter.skills/listanswers the skills,skills/getone by the URI of itsSKILL.md, andresources/directory/readthe files of a folder of a skill. An entry carries the frontmatter as JSON and every file with its SHA-256 digest and size. - Clients without the extension — the
instructionsof the server, which a client gives its agent when it connects, tell the agent how to work through the tools and list the skills with their URIs and descriptions and the tool that reads them, so an agent reads the skill that matches its task as resources.
Coupling with OpenL Studio
McpServerProcessstartsWEB-INF/mcp/index.mjswith--max-semi-space-size=1, which keeps the young generation of V8 at 1 MB per semi-space, and waits for the line the server logs once it listens: its end,listening on <host>, port <port>, names the free port the server took, and must stay as it is, as the entry point.- Studio sets
PORTto0,HOSTandOPENL_VERSION, the version the server reports inserverInfo, and removesNODE_USE_ENV_PROXY, which would send the calls to Studio through the proxy of the environment; every other variable,NODE_OPTIONSincluded, comes from the environment of Studio. - Studio sets
OTEL_SDK_DISABLEDtofalsewhen it sends traces or metrics itself, by the rule ofOtelEnvironment, and totrueotherwise, andOTEL_SERVICE_NAMEto its own service name with the suffix-mcp. The otherOTEL_*variables of its environment reach the server as they are. - The output of the server lands in the
org.openl.studio.mcp.nodelogger: standard output as INFO, standard error as WARN.
Known Limitations
- Concurrent table runs —
openl_run_tablerefuses a second run only within one client. Over 2026-07-28 every request has a client of its own, so two runs with one token share the single run slot Studio keeps for it. - Legacy sessions have no idle timeout and no limit, and keep the credential sent with
initialize. tools/listcarries nottlMsorcacheScope.Hostis not validated.- A text write travels in the MCP request, whose whole body — JSON escaping included — is limited to 5 MB, so a text well under that size may already need an upload link; a binary file always goes by one.
- The REST timeout of 30 seconds cannot be changed.
openl_open_projectwith a branch ignores a failed branch switch and opens the project again, and ignoresrevisionfor a project that is already open.openl_deploy_projectfinds the deployment repository by its exact name, case included.openl_watch_trace_cellsdrops the status of the run, so a failed run returns part of the series with no error.