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

# MCP Server CLI

> CLI commands for running PraisonAI as an MCP server

# MCP Server CLI Commands

PraisonAI provides comprehensive CLI commands for running and managing MCP servers.

## Primary Command

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp <subcommand> [options]
```

## Subcommands

### serve

Start the MCP server.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# STDIO transport (default, for Claude Desktop)
praisonai mcp serve

# HTTP Stream transport
praisonai mcp serve --transport http-stream

# With all options
praisonai mcp serve \
  --transport http-stream \
  --host 127.0.0.1 \
  --port 8080 \
  --endpoint /mcp \
  --api-key YOUR_KEY \
  --name praisonai \
  --response-mode batch \
  --session-ttl 3600 \
  --log-level info
```

**Options:**

| Option              | Description                         | Default     |
| ------------------- | ----------------------------------- | ----------- |
| `--transport`       | `stdio` or `http-stream`            | `stdio`     |
| `--host`            | Server host                         | `127.0.0.1` |
| `--port`            | Server port                         | `8080`      |
| `--endpoint`        | MCP endpoint path                   | `/mcp`      |
| `--api-key`         | API key for authentication          | None        |
| `--name`            | Server name                         | `praisonai` |
| `--response-mode`   | `batch` or `stream`                 | `batch`     |
| `--cors-origins`    | Comma-separated CORS origins        | `*`         |
| `--allowed-origins` | Comma-separated allowed origins     | localhost   |
| `--session-ttl`     | Session TTL in seconds              | `3600`      |
| `--no-termination`  | Disable client session termination  | False       |
| `--resumability`    | Enable SSE resumability             | True        |
| `--log-level`       | `debug`, `info`, `warning`, `error` | `warning`   |
| `--json`            | Output in JSON format               | False       |
| `--debug`           | Enable debug mode                   | False       |

### list-tools

List all available MCP tools.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp list-tools
```

**Example Output:**

```
Available MCP Tools (75):

  • praisonai.chat.completion
    Generate chat completion.

  • praisonai.agent.chat
    Chat with a PraisonAI agent.

  • praisonai.images.generate
    Generate images from text prompt.
  ...
```

### list-resources

List all available MCP resources.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp list-resources
```

**Example Output:**

```
Available MCP Resources (7):

  • praisonai://memory/sessions
    List all memory sessions.

  • praisonai://workflows
    List available workflows in current directory.
  ...
```

### list-prompts

List all available MCP prompts.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp list-prompts
```

**Example Output:**

```
Available MCP Prompts (7):

  • deep-research
    Generate a deep research prompt for comprehensive topic analysis

  • code-review
    Generate a code review prompt for analyzing code quality
  ...
```

### config-generate

Generate client configuration for MCP clients.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Claude Desktop config
praisonai mcp config-generate --client claude-desktop

# Cursor config
praisonai mcp config-generate --client cursor

# VSCode config
praisonai mcp config-generate --client vscode

# Windsurf config
praisonai mcp config-generate --client windsurf

# Save to file
praisonai mcp config-generate --client claude-desktop --output config.json

# HTTP Stream config
praisonai mcp config-generate --client claude-desktop --transport http-stream --port 8080
```

**Options:**

| Option        | Description                   | Default          |
| ------------- | ----------------------------- | ---------------- |
| `--client`    | Client type                   | `claude-desktop` |
| `--output`    | Output file path              | stdout           |
| `--transport` | Transport type                | `stdio`          |
| `--host`      | Server host (for http-stream) | `127.0.0.1`      |
| `--port`      | Server port (for http-stream) | `8080`           |

### doctor

Check MCP server health and configuration.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp doctor
```

**Example Output:**

```
PraisonAI MCP Server Health Check

Protocol Version: 2025-11-25
Supported Versions: 2025-11-25, 2025-03-26, 2024-11-05

Registered Components:
  • Tools: 75
  • Resources: 7
  • Prompts: 7

Environment:
  ✓ OPENAI_API_KEY
  ○ ANTHROPIC_API_KEY
  ○ GOOGLE_API_KEY

Dependencies:
  ✓ starlette
  ✓ uvicorn
  ✓ praisonaiagents

✓ MCP server is ready to run
```

## Deprecated Commands

The following commands are deprecated and will be removed in a future version:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# DEPRECATED - use 'praisonai mcp serve' instead
praisonai serve mcp

# DEPRECATED - use 'praisonai mcp serve' instead
praisonai serve tools
```

These commands will show a deprecation warning and redirect to `praisonai mcp serve`.

## Examples

### Start STDIO Server for Claude Desktop

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp serve --transport stdio
```

### Start HTTP Server with Authentication

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp serve \
  --transport http-stream \
  --port 8080 \
  --api-key mysecretkey
```

### Start Server with Custom Origins

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp serve \
  --transport http-stream \
  --allowed-origins "http://localhost:3000,https://myapp.com"
```

### Generate and Apply Claude Desktop Config

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Generate config
praisonai mcp config-generate --client claude-desktop --output ~/Library/Application\ Support/Claude/claude_desktop_config.json

# Or manually copy the output
praisonai mcp config-generate --client claude-desktop
```

### Debug Mode

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai mcp serve --transport http-stream --debug --log-level debug
```

## Environment Variables

| Variable            | Description                         |
| ------------------- | ----------------------------------- |
| `OPENAI_API_KEY`    | OpenAI API key for chat/image tools |
| `ANTHROPIC_API_KEY` | Anthropic API key                   |
| `GOOGLE_API_KEY`    | Google API key                      |

## Exit Codes

| Code | Description |
| ---- | ----------- |
| 0    | Success     |
| 1    | Error       |

## See Also

* [PraisonAI MCP Server](/mcp/praisonai-mcp-server) - Full MCP server documentation
* [MCP Transports](/mcp/transports) - Transport protocol details
* [Custom MCP Server](/mcp/custom-python-server) - Building custom MCP servers
