VELADocsvelab.si ↗

MCP servers

Vela connects to Model Context Protocol servers over stdio or streamable HTTP and makes their tools available to the model. Support comes from the built-in mcp extension, modeled on pi’s: it loads by default in the CLI, -builtin:mcp in extensions turns it off, and an SDK app adds mcp() itself (see SDK). The client is the official MCP TypeScript SDK.

Configure servers

Vela reads servers from mcpServers in ~/.vela/config.json and, when the project is trusted, from <project>/.vela/config.json. The structure matches the mcpServers object of Claude Desktop, Claude Code and pi, so an existing entry can be copied over:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
    },
    "docs": {
      "url": "https://example.com/mcp",
      "headers": { "Authorization": "Bearer ${DOCS_TOKEN}" },
      "description": "Search and read the product documentation"
    }
  }
}

A project entry replaces the user entry of the same name. A project entry without command, url or type only overrides enabled, exposure and toolExposure of the user entry and keeps the rest (any other key is an error, so a project cannot add headers or variables to your server), so this turns off a user-level server in one project:

{ "mcpServers": { "internal-tools": { "enabled": false } } }

Keep servers with credentials in the user file, and use the project file only for servers the project needs.

Field Servers Description
command, args stdio One executable and its arguments, not a shell command line. A leading ~/ names the home directory
env stdio Extra environment variables. The server also inherits Vela’s environment, as bash does
cwd stdio Working directory, relative to the owning instance’s directory: selected project for configuration-driven MCP, host directory for explicit host MCP
url HTTP The streamable HTTP endpoint
headers HTTP Request headers, for example Authorization
type both Optional: stdio, http or streamable-http. A command means stdio and a url means HTTP
timeout both Seconds to wait for a request (default 60). Progress notifications from the server restart it
enabled both false keeps the entry without connecting
exposure, toolExposure both How the model reaches the tools (see Tool exposure)
description both What the server offers, in a sentence. It is shown with the server in the system prompt and searched by tool_search. Default: the first line of the server’s instructions

Rules, the same as pi’s:

  • Server names may contain only letters, digits, _ and -. Names that differ only in - and _ are the same server, and the second one is an error.
  • ${NAME} and $NAME in command, args, cwd, url, env and headers are replaced with environment variables ($$ is a literal $). Unlike other sections in config.json, a variable that is not set is an error for that server instead of an empty string.
  • The legacy SSE transport is not supported. Servers that offer SSE usually also offer streamable HTTP, often at /mcp instead of /sse.
  • An invalid entry is reported and skipped; the other servers still connect.
  • exposure: "codemode" is rejected for now: Vela has no codemode yet.
  • OAuth sign-in is not supported yet. For a server that needs it, put a token in an Authorization header if the server accepts one.

Connections

Configuration-driven CLI MCP connections belong to the selected session project’s location and configuration snapshot. Sessions sharing that snapshot share connections; A and B can use the same server name with different definitions without changing each other’s tools. A denied project uses only the user server definitions. Editing config.json affects a newly prepared session, not an existing one. Connections start when the instance first handles a session, remain warm for up to 5 minutes after the last session releases that bucket (so newly opened sessions reuse them), and close immediately when the host disposes. Closing a stdio server closes its stdin, then sends SIGTERM, then SIGKILL.

An explicit SDK mcp() factory or CLI -e builtin:mcp remains host-owned and shared by that host’s sessions; it is not recreated as configuration-driven project MCP. Non-local project MCP is unsupported: neither its stdio command nor its HTTP endpoint is silently executed from the host. This slice does not add E3 or remote MCP transport support.

  • The first prompt waits up to 10 seconds only for servers with direct tools, which must be in its request. Configured deferred servers declare their mcp__<server> namespace statically in <deferred_tools> (without transient <mcp_servers> sections or post-connect prompt mutations), and tool_search waits for connecting servers before searching live tools.
  • Connecting to an HTTP server is retried twice after a network error or a 408, 429 or 5xx status. Tool calls are never retried, because the server may already have acted.
  • When a connection drops (for example the stdio process exits), the next call to one of its tools connects again.
  • When a server announces that its tool list changed, new tools are registered and removed tools are unregistered.
  • Configuration errors and servers that failed to connect are logged via logger and visible to sessions via tool_search diagnostics (the error includes the end of a stdio server’s stderr); mcp.ts does not register a /mcp command on Runtime sessions.

Tool exposure

Each tool is registered as mcp__<server>__<tool>, with every character other than letters, digits and _ replaced by _; names longer than 64 characters, or two tools whose names become the same, get a hash suffix. Its namespace is mcp__<server>, and the server’s instructions are the namespace instructions.

exposure What the model gets
deferred (default) <deferred_tools> lists the configured mcp__<server> namespace (plus static description if configured) without waiting for async connects. The model loads live tools with tool_search, which returns the server instructions with them
direct The tools are declared to the model like built-in tools. Use it for small, often-used servers
hidden Registered but unreachable

toolExposure overrides the server’s exposure for single tools. Keys are the server’s own tool names, or patterns where * matches anything; an exact name wins over patterns, and among patterns the first match wins:

{
  "mcpServers": {
    "github": {
      "url": "https://api.githubcopilot.com/mcp/",
      "headers": { "Authorization": "Bearer ${GITHUB_TOKEN}" },
      "exposure": "deferred",
      "toolExposure": { "search_code": "direct", "delete_*": "hidden" }
    }
  }
}

pi’s default is codemode, where the model writes a script that calls the tools. Vela will follow once it has codemode; until then deferred keeps large servers out of the context until they are needed.

Results

Text content reaches the model as text. Image blocks reach the model as normalized canonical images. Audio and binary resources remain one-line placeholders with their type and size; embedded text resources are shown in full, and resource links show their URI, name and description. A result without content blocks shows its structuredContent as JSON. A result with isError is an error result for the model. Text longer than 20,000 characters is saved to a file and the model gets the beginning and end with the file’s path, like other large tool results (see Tools). The tool history keeps the whole CallToolResult (without transport _meta); oversized multimodal captions are stored separately as text-only files. Images in error results are retained while the model still receives an explicit tool error. Progress notifications become tool_execution_update events.

Permissions

MCP tools go through the same pipeline as every tool: the session’s tool selection, extensions’ tool_call and tool_result handlers (including user-defined confirmation), and the tool history. The server’s readOnlyHint, destructiveHint, idempotentHint and openWorldHint annotations are on each tool’s annotations for user extensions to inspect; Vela itself does not act on them.

All sessions can use MCP tools. Remove them from the session’s tools selection (see Security): an unavailable tool is not listed, tool_search does not find it, a call is rejected, and the system prompt does not name the server.

An MCP server runs with your permissions (stdio) or acts with the credentials you give it (HTTP), and its tool descriptions and results are text the model reads. Add only servers you trust.

SDK

createRuntime() automatically connects to user servers configured under top-level mcpServers in <agentDir>/config.json (skipped when ephemeral: true is set) and trusted <cwd>/.vela/config.json servers unless mcp: false is passed:

import { createRuntime } from '@glows777/vela'

const runtime = createRuntime({
  defaultModel: 'anthropic/<model-id>',
  hostEnv: process.env,
})

Pass mcp: false to disable all MCP connections (including trusted project .vela/config.json servers). Call await runtime.dispose() to close pooled MCP connections and stop stdio servers.

Not supported yet

OAuth sign-in, MCP resources (list_mcp_resources, read_mcp_resource), vela mcp add/list shell commands, registering servers from other extensions, and codemode. pi has all of these.