---
title: "Configure the Local MCP Server"
description: "Connect a local MCP client to Y2 documentation and API tools"
canonical: https://y2.dev/docs/api/mcp-local/
---

# Configure the Local MCP Server

Connect a local MCP client to Y2 documentation and API tools

Run `@y2-intel/mcp` on your machine to give a coding agent or MCP client Y2's documentation and API tools. This guide uses version `0.4.0`. To connect Claude or ChatGPT without an API key, use [the hosted connection](https://y2.dev/docs/api/mcp).

## Before you begin

- Node.js 24.22.1 or later. Earlier releases have known security vulnerabilities. Check your version with `node -v`.
- An MCP client that supports local stdio servers.
- A Y2 API key for authenticated tools. [Create a key](https://y2.dev/docs/api/create-key) with only the scopes you need. Documentation and OpenAPI tools work without a key.

## Add the server

**Codex**

Run this from a shell where `Y2_API_KEY` is set:

```
codex mcp add y2 --env Y2_API_KEY="$Y2_API_KEY" -- npx -y @y2-intel/mcp@0.4.0
```

Run `codex mcp list` to confirm. Codex saves the key in its configuration file, so protect that file.

**Claude Code**

Run this from a shell where `Y2_API_KEY` is set:

```
claude mcp add --transport stdio --env Y2_API_KEY="$Y2_API_KEY" y2 \
  -- npx -y @y2-intel/mcp@0.4.0
```

Run `claude mcp get y2` to confirm.

**Claude Desktop**

Add the server to the client's MCP configuration, then restart the client:

```
{
  "mcpServers": {
    "y2": {
      "command": "npx",
      "args": ["-y", "@y2-intel/mcp@0.4.0"],
      "env": {
        "Y2_API_KEY": "y2_..."
      }
    }
  }
}
```

This file stores the key in plain text. Restrict access to it.

Launch the server as a local stdio process:

```
Y2_API_KEY="$Y2_API_KEY" npx -y @y2-intel/mcp@0.4.0
```

Provide `Y2_API_KEY` through the client's environment or secret settings. The client must keep stdin and stdout connected to the process.

Omit `Y2_API_KEY` to use only documentation and OpenAPI tools. Keep credentials out of prompts and tool arguments.

## Check the connection

Ask your client to call `y2_list_reports`. With a `reports:read` key, it returns a report list, which can be empty.

To test the server outside a client, list its tools with the MCP Inspector:

```
npx -y @modelcontextprotocol/inspector --cli npx -y @y2-intel/mcp@0.4.0 \
  -- \
  --method tools/list
```

Version 0.4.0 exposes 62 tools by default.

## Call any API operation

Use `y2_call_api` for operations without a dedicated tool:

1. Call `y2_list_api_operations` to find the `operationId`.
2. Call `y2_get_openapi_operation` to read its parameters and schema.
3. Call `y2_call_api` with the operation ID and inputs.

Example `y2_call_api` arguments:

```
{
  "operationId": "listReports",
  "parameters": {
    "limit": 10
  }
}
```

The API key must include the operation's scopes.

Write operations are off by default

The server hides write tools and `y2_call_api` rejects write operations unless `Y2_MCP_ENABLE_WRITE_TOOLS=true`. Once enabled, the key's scopes are the only limit, so use a read-only key for read-only work.

See [MCP reference](https://y2.dev/docs/api/mcp-reference) for configuration, optional tools, and troubleshooting.
