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

# MCP Playground

# MCP Playground API Documentation

Welcome to the MCP Playground API documentation. The Playground APIs let you test and debug MCP servers directly — verifying connectivity, listing the tools an MCP server exposes, and invoking those tools with arbitrary arguments.

## Base URL

The MCP Playground APIs are served from a different host than the rest of the Enkrypt AI APIs:

```
https://mcp.enkryptai.com
```

Authentication still uses the same `apikey` header — your existing Enkrypt AI API key works against this host without any additional setup.

## Purpose

Use the Playground APIs to validate a registered MCP server end-to-end before wiring it into a gateway. They are ideal for:

* Verifying that a server's configuration (command, args, OAuth) actually connects.
* Discovering which tools a server exposes and inspecting their input schemas.
* Invoking specific tools with custom arguments to debug behavior.

The Playground operates on registry servers — so the server must already be registered via the MCP Registry Servers API before it can be exercised here.

## Offered APIs

Our API suite includes the following endpoints:

* **test-server**: Connect to an MCP server and confirm it responds. Returns the count of tools available on success.

* **get-tools**: Connect to an MCP server and return the full list of tools it exposes, including each tool's input JSON Schema.

* **call-tool**: Invoke a specific tool on an MCP server with the provided arguments. Returns the tool's result content (or any error details).

## Required Headers

* **`apikey`** (or `api_key`): API key for authentication. Required on every call.
* **`X-Enkrypt-MCP-Registry-Server`**: Required on every Playground call. Set to the registry server's `saved_name`.
* **`X-Enkrypt-MCP-Registry-Server-Version`**: Optional. Defaults to `v1`.
* **`X-Enkrypt-Project`**: Optional. Project context; defaults to `default`.

## Authentication flow

When you call a Playground endpoint, the gateway uses your `apikey` header to fetch the requested registry server via `GET /mcp-registry/get-server`. A `200` from that lookup means your `apikey` is valid and you have access to the server; a `401` or `403` is propagated back to your Playground request. There is no separate apikey allow-list — your existing Enkrypt AI key is the sole credential.

The registry response is cached in-process for 10 seconds, so dashboard double-fires and rapid retries don't double-hit the registry. Different `apikey` values are cached separately.

## Server environment variables

A registry server's `mcp_config.config.env` map (set when you register the server) is passed to the MCP process at spawn time and is honored by every Playground endpoint. Use it for secrets the server needs (`OPENAI_API_KEY`, `GITHUB_TOKEN`, etc.). Values are strings.

## Obtaining an API Key

To get started with the MCP Playground API, you need to obtain an API key. Follow these steps:

1. **Login**: Access your account at [app.enkryptai.com](https://app.enkryptai.com).
2. **Get API Key**: Navigate to the API section to get your unique API key.
3. **Authentication**: Use this API key in the `apikey` header of your API calls.

Let's ensure safer AI together!
