# Koma Gate MCP

Screens untrusted user prompts for jailbreaks and out-of-scope instructions before an agent executes tools.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 13
- Author: swnotmetal
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/swnotmetal/Project-Koma/tree/HEAD/packages/koma-gate-mcp
- Updated: 2026-10-13
- HTML: https://affpapa.org/en/nevibecode/mcp/koma-gate-mcp

## What it does

The server provides a single tool called `classify_input`. It inspects incoming text to verify whether an input is permissible. The response contains safety status alongside a descriptive reason.

Classification accepts an optional preset: `general`, `code`, `support`, or `reference`. By default, it runs the `general` profile. Backend options include `google`, `openai`, `anthropic`, `deepseek`, and `ollama`, with `google` enabled by default.

Because this filter relies on an underlying language model, it provides heuristic screening rather than a cryptographic security perimeter. You must pass a valid API key for the chosen provider in the environment variables, or tool execution will fail.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `KOMA_PROVIDER`, `KOMA_MODEL`, `GEMINI_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `DEEPSEEK_API_KEY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env KOMA_PROVIDER=<KOMA_PROVIDER> --env KOMA_MODEL=<KOMA_MODEL> --env GEMINI_API_KEY=<GEMINI_API_KEY> --env OPENAI_API_KEY=<OPENAI_API_KEY> --env ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> --transport stdio koma-gate-mcp -- npx -y koma-gate-mcp
```
Replace <…> with your own values. 1 more environment variable is in the server README

### Codex

**Platform CLI**
```bash
codex mcp add koma-gate-mcp --env KOMA_PROVIDER=<KOMA_PROVIDER> --env KOMA_MODEL=<KOMA_MODEL> --env GEMINI_API_KEY=<GEMINI_API_KEY> --env OPENAI_API_KEY=<OPENAI_API_KEY> --env ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> -- npx -y koma-gate-mcp
```
Replace <…> with your own values. 1 more environment variable is in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "koma-gate-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "koma-gate-mcp"
            ],
            "env": {
                "KOMA_PROVIDER": "<KOMA_PROVIDER>",
                "KOMA_MODEL": "<KOMA_MODEL>",
                "GEMINI_API_KEY": "<GEMINI_API_KEY>",
                "OPENAI_API_KEY": "<OPENAI_API_KEY>",
                "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values. 1 more environment variable is in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "koma-gate-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "koma-gate-mcp"
            ],
            "env": {
                "KOMA_PROVIDER": "<KOMA_PROVIDER>",
                "KOMA_MODEL": "<KOMA_MODEL>",
                "GEMINI_API_KEY": "<GEMINI_API_KEY>",
                "OPENAI_API_KEY": "<OPENAI_API_KEY>",
                "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values. 1 more environment variable is in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e KOMA_PROVIDER=<KOMA_PROVIDER> -e KOMA_MODEL=<KOMA_MODEL> -e GEMINI_API_KEY=<GEMINI_API_KEY> -e OPENAI_API_KEY=<OPENAI_API_KEY> -e ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> koma-gate-mcp npx -y koma-gate-mcp
```
Replace <…> with your own values. 1 more environment variable is in the server README

## When to use it
- screen untrusted user text for prompt injection attempts
- validate code-related inputs using the code preset before running scripts
- filter out off-topic requests before agents trigger sensitive actions

## Example prompts
- Use `classify_input` on this user prompt to confirm it is safe before continuing.
- Check the ticket description with the `support` preset to spot jailbreak attempts.
- Inspect the latest incoming payload to verify whether it stays in scope.

## Similar
- [safety-scan](https://affpapa.org/en/nevibecode/skills/safety-scan.md) — skill · 743 installs
- [ai-red-teaming](https://affpapa.org/en/nevibecode/skills/ai-red-teaming.md) — skill · 353 installs
- [aig-scanner](https://affpapa.org/en/nevibecode/skills/aig-scanner.md) — skill · ★ 7121
- [skill-scanner](https://affpapa.org/en/nevibecode/skills/skill-scanner.md) — skill · 3800 installs
- [skill-security-auditor](https://affpapa.org/en/nevibecode/skills/skill-security-auditor.md) — skill · 785 installs
- [skills-qa](https://affpapa.org/en/nevibecode/skills/skills-qa.md) — skill · 605 installs

From the same set: [swnotmetal/project-koma](https://affpapa.org/en/nevibecode/by/swnotmetal/project-koma.md) — 2 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
