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

# MCP Gateway

> Create and manage MCP gateways to expose capabilities to MCP clients like Claude Desktop.

MCP Gateways are the primary interface for exposing Noorle capabilities to MCP clients. Each gateway runs as a separate instance with its own configuration, capabilities, and authentication.

## What is an MCP Gateway?

An MCP (Model Context Protocol) Gateway is a hosted endpoint that:

* Exposes tools from attached capabilities (built-in, plugins, and connectors)
* Implements the MCP protocol for seamless client integration
* Provides SSE (Server-Sent Events) and HTTP transports
* Supports authentication via API keys or JWT tokens
* Manages request routing and tool execution

Think of it as your personal AI tool server.

## Creating an MCP Gateway

<Steps>
  <Step title="Navigate to Gateways">
    In the Console, click **Gateways** in the left sidebar.
  </Step>

  <Step title="Click Create Gateway">
    Click the **Create Gateway** button in the top right.
  </Step>

  <Step title="Configure Basic Settings">
    Fill in the form:

    * **Name** - Unique identifier for your gateway (e.g., "Claude Desktop")
    * **Description** - Optional human-readable notes
    * **Enable Authentication** - Require API key or JWT for access (recommended for production)

    Click **Create Gateway**.
  </Step>

  <Step title="Note Your Endpoint URL">
    Your gateway is now created with a unique ID. The MCP Endpoint URL is:

    ```
    https://mcp-{gateway-id}.noorle.com
    ```

    Use this to configure your MCP client.
  </Step>
</Steps>

## Attaching Capabilities

Capabilities define what tools your gateway exposes. You can attach:

* **Built-in Capabilities** - Pre-configured services (Web Search, Code Runner, etc.)
* **Plugins** - Custom WebAssembly tools you've created
* **Connectors** - REST APIs, MCP registry services, or custom MCP servers

### To Attach a Capability

1. Open your gateway settings
2. Click the **Capabilities** tab
3. Click **Attach Capability**
4. Choose capability type (Built-in, Plugin, or Connector)
5. Select from available options
6. Configure optional per-gateway settings
7. Click **Save**

<Note>
  Some capabilities like **Computer** are Agent-only and cannot be attached to MCP gateways. These are restricted to agent execution.
</Note>

## Gateway Specifications

Gateway specifications control advanced behavior through a JSON configuration. Access these in **Gateway Settings** > **Specifications**.

### Key Specification Fields

| Field                     | Type    | Description                                                  |
| ------------------------- | ------- | ------------------------------------------------------------ |
| `omni_tool`               | Object  | Omni Tool configuration for unified tool discovery           |
| `tool_visibility`         | String  | How tools are presented to clients (Omni, Smart, Individual) |
| `max_requests_per_minute` | Number  | Rate limiting (optional)                                     |
| `timeout_seconds`         | Number  | Request timeout (default: 300)                               |
| `request_logging`         | Boolean | Log all requests for debugging                               |

## Omni Tool Configuration

Omni Tool uses LLM-based analysis to automatically discover the right tool from your attached capabilities. Users make natural language requests instead of choosing specific tools.

### Visibility Modes

| Mode           | Tools Exposed                           | Best For                                    |
| -------------- | --------------------------------------- | ------------------------------------------- |
| **Omni**       | Single `omni_tool`                      | Clean UX, maximum simplicity                |
| **Smart**      | 3 meta-tools (Discover, Execute, Learn) | Agentic exploration, progressive disclosure |
| **Individual** | All individual tools                    | Power users who know exact tools            |

### Configuration Example

```json theme={null}
{
  "omni_tool": {
    "visibility": "Omni"
  }
}
```

## Authentication

### Requiring Authentication

By default, MCP gateways are public. To restrict access:

1. Open gateway settings
2. Toggle **Require Authentication**
3. Choose authentication method:
   * **API Key** - Static key (easiest for development)
   * **JWT Token** - Time-bound tokens (better for production)
   * **Both** - Accept either method

### Using API Keys

1. In your gateway settings, click **API Keys**
2. Click **Generate API Key**
3. Store the key safely (shown only once)
4. Pass in requests via `X-API-Key: ak-...` header

### Using JWT Tokens

1. In your gateway settings, click **JWT Configuration**
2. Configure issuer, audience, and public key
3. Your MCP client will validate tokens using the public key

## Gateway Endpoints

### MCP Protocol Endpoint

```
https://mcp-{gateway-id}.noorle.com
```

Supports:

* **SSE Transport** - Server-Sent Events (recommended for browsers)
* **HTTP Transport** - Standard HTTP requests with `/tools`, `/resources`, `/prompts` endpoints

### Status & Health

```
GET https://mcp-{gateway-id}.noorle.com/health
```

Returns gateway health and configuration metadata.

## Best Practices

### Development

* Use public gateways for early testing
* Enable request logging to debug issues
* Attach only capabilities you need

### Production

* Enable authentication (API Key or JWT)
* Set reasonable rate limits
* Monitor request patterns in usage dashboard
* Use meaningful names for easy identification
* Document attached capabilities in the description

### Security

* Rotate API keys regularly
* Use JWT tokens with short expiration times
* Audit attached capabilities for permissions
* Restrict sensitive connectors to trusted clients
* Monitor for unusual activity via request logs

## Monitoring & Troubleshooting

### Check Gateway Status

1. Go to gateway settings
2. View **Status** section
3. See recent request metrics and error rates

### Debug Issues

1. Enable **Request Logging** in specifications
2. Check logs in **Activity** tab
3. Verify capabilities are properly attached
4. Test endpoint directly with curl:

```bash theme={null}
curl https://mcp-{gateway-id}.noorle.com/health \
  -H "X-API-Key: ak-..."
```

### Common Issues

| Issue                   | Solution                                                  |
| ----------------------- | --------------------------------------------------------- |
| "Gateway not found"     | Verify gateway ID in URL                                  |
| "Authentication failed" | Check API key or JWT token format                         |
| "Tool not found"        | Ensure capability is attached and enabled                 |
| "Request timeout"       | Increase timeout in specifications or reduce payload size |

## Advanced Configuration

### Custom Headers

Set global headers applied to all outbound requests from this gateway:

```json theme={null}
{
  "custom_headers": {
    "X-Custom-Header": "value"
  }
}
```

### Request/Response Transformation

Transform tool requests and responses using JSONPath:

```json theme={null}
{
  "request_transform": {
    "input_mapping": {"user_input": "prompt"}
  },
  "response_transform": {
    "output_path": "$.result"
  }
}
```

## API Access

Create or manage gateways programmatically using the Admin API:

```bash theme={null}
# Create gateway
curl -X POST https://api.noorle.com/v1/mcp-gateways \
  -H "Authorization: Bearer {jwt_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Gateway",
    "description": "Testing"
  }'

# Attach capability
curl -X POST https://api.noorle.com/v1/mcp-gateways/{gateway_id}/capabilities \
  -H "Authorization: Bearer {jwt_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "capability_id": "{capability_id}",
    "metadata": {}
  }'
```

See [API Documentation](/docs/reference/introduction) for complete reference.

## Next Steps

* [Attach Built-in Capabilities](/docs/use/capabilities/overview)
* [Create REST Connectors](/docs/use/connectors/rest-connectors)
* [Configure Authentication](/docs/use/platform/api-keys)
* [Connect MCP Client](/docs/reference/mcp/overview)
* [MCP gateway platform overview](https://noorle.com/platform/mcp-gateways/)
