> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vers.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Mcp

# vers mcp

Run the MCP (Model Context Protocol) server to expose vers tools to AI agents.

## Usage

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers mcp serve                       # Start MCP server with stdio transport
vers mcp serve --transport http      # Start MCP server with HTTP transport
vers mcp serve --addr :8080          # Use custom address for HTTP transport
```

## Subcommands

### serve

Start the MCP server so agent clients can call vers operations as tools.

## Options

| Option                     | Default | Description                                     |
| -------------------------- | ------- | ----------------------------------------------- |
| `--transport`              | "stdio" | Transport type: `stdio` or `http`               |
| `--addr`                   | ":3920" | Listen address for HTTP transport               |
| `--allow-insecure-set-key` | false   | Allow setting API key via tool (local dev only) |

## Examples

### Start with stdio transport (default)

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers mcp serve
```

This is the standard mode for use with AI agents that communicate via stdin/stdout.

### Start with HTTP transport

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers mcp serve --transport http
Starting MCP server on :3920...
```

### Use custom port

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers mcp serve --transport http --addr :8080
Starting MCP server on :8080...
```

### Local development mode

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
vers mcp serve --allow-insecure-set-key
```

<Warning>
  Only use `--allow-insecure-set-key` for local development. This flag allows the API key to be set via the MCP tool interface, which is insecure in production environments.
</Warning>

## How it works

The MCP server exposes vers CLI operations as tools that AI agents can call:

1. **Server startup**: Initializes the MCP server with the specified transport
2. **Tool registration**: Exposes vers commands as callable tools
3. **Request handling**: Processes tool calls from connected agents
4. **Response formatting**: Returns results in MCP-compatible format

## Transport types

### stdio (default)

* Communicates via standard input/output
* Best for integration with AI agents that spawn the server as a subprocess
* No network exposure

### http

* Listens on a network port for HTTP requests
* Useful for remote agents or testing
* Requires specifying a listen address

## Use cases

### AI agent integration

Configure your AI agent to use vers as an MCP tool provider:

```json theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  "mcpServers": {
    "vers": {
      "command": "vers",
      "args": ["mcp", "serve"]
    }
  }
}
```

### Testing MCP tools

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
# Start server in HTTP mode for testing
vers mcp serve --transport http --addr :3920

# Test with curl or an HTTP client
```

## Prerequisites

* Authenticated with Vers platform (unless using `--allow-insecure-set-key`)
* For HTTP transport: Available network port

## Common Patterns

### Claude Desktop (stdio)

```json theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  "mcpServers": {
    "vers": {
      "command": "vers",
      "args": ["mcp", "serve", "--transport", "stdio"],
      "env": {
        "VERS_URL": "https://api.vers.sh",
        "VERS_API_KEY": "your-api-key"
      }
    }
  }
}
```

### Remote agents over HTTP

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
VERS_MCP_HTTP_TOKEN=$(openssl rand -hex 32) \
VERS_URL=https://api.vers.sh \
VERS_API_KEY=... \
vers mcp serve --transport http --addr :3920
```

Then, in your agent config:

```
URL:   http://host:3920
Token: <VERS_MCP_HTTP_TOKEN from above>
```

### Claude Code (stdio)

```bash theme={"theme":{"light":"min-light","dark":"min-dark"}}
claude mcp add --transport stdio vers-platform -- vers mcp serve --transport stdio
```

## See Also

* [vers login](/cli-reference/login) - Authenticate before using MCP server
