MCP

Runtime MCP

The Runtime MCP endpoint runs inside each workspace on port 9990. It provides 23 tools for file operations, search, command execution, terminal sessions, and filesystem watchers — the same operations available through the Runtime API REST endpoints.

This is a pure JSON-RPC 2.0 implementation with zero external dependencies. It dispatches tool calls internally to the same handlers that serve the REST API.

Connection

The MCP endpoint lives on the same server as the Runtime API REST endpoints — same access paths, same auth, just a different URL path (/mcp instead of /files, /exec, etc.).

Access methodMCP URLAuthSetup guide
Gatewayhttps://workspace.oblien.com/mcpGateway JWTRuntime API — Gateway access
Directhttp://10.x.x.x:9990/mcpRaw connection tokenRuntime API — Direct access

For how to enable the server, get tokens, and configure network access, see the Runtime API Access API reference.

Example — Gateway

Once you have a Gateway JWT (how to get one):

curl -X POST https://workspace.oblien.com/mcp \
  -H "Authorization: Bearer $GATEWAY_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list",
    "params": {}
  }'

Example — Direct

Once you have a raw connection token (how to get one) and a private link:

curl -X POST http://10.x.x.x:9990/mcp \
  -H "Authorization: Bearer $RAW_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list",
    "params": {}
  }'

Request format

Standard JSON-RPC 2.0:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list",
  "params": {}
}

Supported methods

MethodDescription
initializeMCP handshake (returns server info and capabilities)
tools/listList all available tools
tools/callCall a tool

Debug endpoint

A GET /mcp endpoint is available for quick verification:

# Via gateway
curl https://workspace.oblien.com/mcp \
  -H "Authorization: Bearer $GATEWAY_JWT"

# Direct
curl http://10.x.x.x:9990/mcp \
  -H "Authorization: Bearer $RAW_TOKEN"

Returns the tool count and server version.

Tool reference

All 23 tools are listed below. Each tool maps to a REST endpoint documented in the Runtime API Reference.

Files (6 tools)

Read, write, and manage files inside the workspace.

ToolDescriptionREST equivalent
file_listList directory contents with metadata. Supports recursion, gitignore filtering, inline content, and hash computation.GET /files
file_readRead file content as UTF-8 text. Supports line ranges and line numbers. Max 10 MiB.GET /files/read
file_writeWrite content to a file. Creates parent directories if needed. Supports append mode.POST /files/write
file_mkdirCreate a directory (with parents).POST /files/mkdir
file_statGet file metadata: size, type, permissions, modified time, symlink target.GET /files/stat
file_deleteDelete a file or directory.DELETE /files/delete

file_list parameters

ParameterTypeDescription
pathstringDirectory path (default: /)
nestedbooleanRecurse into subdirectories
lightbooleanMinimal output (names only)
include_hashbooleanInclude SHA-256 hash per file
include_contentbooleanInline file content
code_files_onlybooleanFilter to code files
flattenbooleanFlat list instead of tree
use_gitignorebooleanRespect .gitignore rules
max_depthnumberMaximum recursion depth
ignore_patternsstring[]Glob patterns to exclude
path_filterstringFilter paths by substring
include_extstring[]Only include these extensions

file_read parameters

ParameterTypeRequiredDescription
pathstringyesFile path
start_linenumbernoFirst line to read (1-based)
end_linenumbernoLast line to read (1-based)
with_line_numbersbooleannoPrefix lines with numbers

file_write parameters

ParameterTypeRequiredDescription
pathstringyesFile path
contentstringyesFile content
create_dirsbooleannoCreate parent directories
appendbooleannoAppend instead of overwrite
modestringnoFile permissions (e.g. "0644")

Search (3 tools)

Full-text content search and file name search.

ToolDescriptionREST equivalent
search_contentSearch file contents using ripgrep. Returns matches grouped by file with line, column, and text.GET /files/search
search_filesSearch for files by name. Pure Go implementation, no ripgrep needed. Respects .gitignore.GET /files/search/files
search_initCheck if ripgrep is installed, or trigger installation.POST /files/search/init

search_content parameters

ParameterTypeRequiredDescription
qstringyesSearch query
pathstringnoDirectory to search in
case_sensitivebooleannoCase-sensitive matching
regexbooleannoTreat query as regex
whole_wordbooleannoMatch whole words only
max_resultsnumbernoLimit number of results
timeoutnumbernoTimeout in seconds
context_linesnumbernoLines of context around matches
ignore_patternsstring[]noPatterns to exclude
file_typesstring[]noFile extensions to include
include_hiddenbooleannoInclude hidden files

Exec (6 tools)

Execute commands and manage task lifecycles.

ToolDescriptionREST equivalent
exec_runExecute a command synchronously. Returns stdout, stderr, exit code.POST /exec
exec_listList all exec tasks.GET /exec
exec_getGet task details by ID.GET /exec/:id
exec_inputSend stdin to a running task.POST /exec/:id/input
exec_deleteDelete a task.DELETE /exec/:id
exec_delete_allDelete all tasks.DELETE /exec

exec_run parameters

ParameterTypeRequiredDescription
commandstring[]yesCommand as array (exec'd directly, no shell)
timeout_secondsnumbernoKill after N seconds
keep_logsbooleannoRetain stdout/stderr after completion
exec_modestringnoExecution mode

Commands are executed directly without a shell. To use shell features (pipes, redirects), pass ["sh", "-c", "your command | here"].

Terminals (4 tools)

Create and manage PTY terminal sessions. Terminal I/O flows over WebSocket at /ws.

ToolDescriptionREST equivalent
terminal_createCreate a new PTY session.POST /terminals
terminal_listList active sessions.GET /terminals
terminal_scrollbackGet terminal output history (base64-encoded).GET /terminals/:id/scrollback
terminal_deleteKill and close a session.DELETE /terminals/:id

terminal_create parameters

ParameterTypeDescription
commandstring[]Shell command (default: system shell)
colsnumberTerminal width
rowsnumberTerminal height
scrollback_sizenumberScrollback buffer size in bytes

Watchers (4 tools)

Recursive filesystem watchers using inotify. Events are delivered over WebSocket.

ToolDescriptionREST equivalent
watcher_createCreate a recursive file watcher.POST /watchers
watcher_listList active watchers.GET /watchers
watcher_getGet watcher details.GET /watchers/:id
watcher_deleteStop and remove a watcher.DELETE /watchers/:id

watcher_create parameters

ParameterTypeRequiredDescription
pathstringyesDirectory to watch
excludesstring[]noPatterns to exclude from watching

Example: full workflow

Create a file, verify it exists, then search its content — all through MCP tool calls:

// 1. Write a file
{
  "jsonrpc": "2.0", "id": 1,
  "method": "tools/call",
  "params": {
    "name": "file_write",
    "arguments": {
      "path": "/home/user/hello.py",
      "content": "print('hello world')\n",
      "create_dirs": true
    }
  }
}

// 2. Verify it exists
{
  "jsonrpc": "2.0", "id": 2,
  "method": "tools/call",
  "params": {
    "name": "file_stat",
    "arguments": { "path": "/home/user/hello.py" }
  }
}

// 3. Run it
{
  "jsonrpc": "2.0", "id": 3,
  "method": "tools/call",
  "params": {
    "name": "exec_run",
    "arguments": {
      "command": ["python3", "/home/user/hello.py"]
    }
  }
}

Limits

LimitValue
Max request body4 MiB
Max file read10 MiB
Session headerMcp-Session-Id (optional, echoed back)

Error handling

Errors follow JSON-RPC 2.0 conventions:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "unknown tool: foo_bar"
  }
}
CodeMeaning
-32700Parse error (invalid JSON)
-32601Method not found
-32602Invalid params / unknown tool
-32603Internal error (tool execution failed)