Логотип MCP Perforce Server

MCP Perforce Server

Организация
Cocoon-AI

MCP Perforce Server

ИздательCocoon-AI
Репозиторийmcp-perforce
ЯзыкTypeScript
Форки
5
Звёзды
29
Доступные инструменты
24
Тип транспортаstdio
Категории
ЛицензияMIT
Ссылки
  • Подключайте инструменты к рабочим процессам с ИИ

    MCP Perforce Server предоставляет возможности MCP, доступные совместимым ИИ-клиентам и агентам.

  • Доступные инструменты: 24

    Ниже представлены доступные для вызова действия с названиями и описаниями, если сервер их предоставляет.

  • Готовая конфигурация для копирования

    Используйте примеры конфигурации, чтобы настроить этот сервер в предпочитаемом MCP-клиенте.

  • Показатели интереса к открытому проекту

    Звёзды: 29, форки: 5 — в связанном репозитории.

MCP Perforce Server

A Model Context Protocol (MCP) server that provides a clean interface for Perforce (P4) operations in Claude Desktop. This server wraps P4 commands to make them more reliable and easier for Claude to use, eliminating issues with interactive prompts and complex state management.

Features

  • Non-interactive operations: All commands are wrapped to avoid interactive prompts
  • Structured responses: Clean, parseable output instead of raw P4 output
  • Multi-project support: Automatically uses .p4config files for per-project settings
  • Common operations: Add, edit, delete, submit, revert, sync, and more
  • Changelist management: Create and submit changelists with explicit parameters
  • Error handling: Graceful error handling with clear error messages

Installation

Prerequisites

  • Node.js 18+ installed
  • Perforce command-line client (p4) installed and in your PATH
  • .p4config files in your project directories (recommended)

Quick Install with Claude Code

bash
# Install the package globally
npm install -g @cocoon-ai/mcp-perforce

# Add to Claude Code
claude mcp add perforce @cocoon-ai/mcp-perforce

That's it! Claude Code will automatically configure the server for you.

Manual Installation

Via NPM (when published)

bash
npm install -g @cocoon-ai/mcp-perforce

Install from Source

bash
git clone https://github.com/Cocoon-AI/mcp-perforce.git
cd mcp-perforce
npm install
npm run build
npm link  # Makes 'mcp-perforce' available globally

Configuration

Basic Setup

Add the server to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json

json
{
  "mcpServers": {
    "perforce": {
      "command": "npx",
      "args": ["-y", "@cocoon-ai/mcp-perforce"],
      "env": {
        "P4CONFIG": ".p4config"
      }
    }
  }
}

Setting Up .p4config Files

The server uses Perforce's built-in P4CONFIG mechanism to automatically switch between different Perforce servers based on your current directory. Create a .p4config file in each project root:

bash
# ~/projects/gamedev/.p4config
P4PORT=perforce-game.company.com:1666
P4CLIENT=gamedev-workspace
P4USER=your-username

# ~/projects/web/.p4config
P4PORT=perforce-web.company.com:1666
P4CLIENT=web-workspace
P4USER=your-username

Now the MCP server will automatically use the correct Perforce settings based on which project directory you're working in!

Available Commands

Once configured, you can ask Claude to use these P4 operations. All commands will automatically use the .p4config settings from your current project directory.

Basic File Operations

  • p4_status: Check workspace status and pending changes

    "Show me my pending P4 changes"
    "Check P4 status in the gamedev directory"
  • p4_add: Add files to Perforce

    "Add all .js files in the src directory to Perforce"
  • p4_edit: Open files for edit

    "Open config.json for editing in Perforce"
  • p4_delete: Mark files for deletion

    "Delete the old_module.py file from Perforce"
  • p4_sync: Sync files from depot

    "Sync all files in the project"
    "Force sync the src directory"
  • p4_revert: Revert files or entire changelists

    "Revert all files in changelist 12345"
    "Revert changes to config.json"
  • p4_diff: Show differences for files

    "Show me the diff for all my open files"

Changelist Operations

  • p4_changelist_create: Create a new changelist

    "Create a new changelist with description 'Fix login bug'"
  • p4_changelist_submit: Submit a changelist

    "Submit changelist 12345"
  • p4_move_to_changelist: Move files between changelists

    "Move all my open files to changelist 12345"

Stream Operations

  • p4_stream_list: List streams in a depot

    "List all streams in //depot"
    "Show me development streams matching 'feature'"
  • p4_stream_info: Get detailed stream information

    "Show me details about //depot/main stream"
  • p4_stream_switch: Switch workspace to a different stream

    "Switch to the //depot/dev stream"
    "Force switch to //depot/release-2.0"
  • p4_stream_create: Create a new stream

    "Create a development stream //depot/feature-xyz from //depot/main"
  • p4_stream_edit: Edit stream specification

    "Edit the //depot/feature-xyz stream spec"
  • p4_stream_graph: Show stream hierarchy

    "Show the stream hierarchy for //depot"

Client/Workspace Operations

  • p4_client_list: List all clients/workspaces

    "List all my Perforce workspaces"
    "Show clients for user jsmith"
  • p4_client_info: Get client/workspace details

    "Show me details about my current workspace"
    "Show info for client gamedev-workspace"
  • p4_client_create: Create a new client/workspace

    "Create a new workspace called dev-feature in /home/user/p4/feature"
    "Create a stream client for //depot/main-stream"
  • p4_client_edit: Edit client specification

    "Edit the view mappings for client dev-workspace"
  • p4_client_delete: Delete a client/workspace

    "Delete the old-feature workspace"
    "Force delete the broken-client workspace"
  • p4_client_switch: Switch to a different client

    "Switch to the production-client workspace"

Information Operations

  • p4_info: Show current Perforce configuration

    "Show me which P4 server and workspace I'm using"
  • mcp_perforce_version: Show MCP Perforce server version

    "What version of mcp-perforce is running?"

Example Usage in Claude

Here are some example conversations with Claude:

Example 1: Creating and submitting a change

You: "I've modified server.js and config.json. Create a changelist for these fixes"
Claude: I'll help you create a changelist for your changes. Let me first check the status...
[Uses p4_status, p4_changelist_create, p4_submit]

Example 2: Syncing and reviewing changes

You: "Sync the latest changes and show me what files I have open"
Claude: I'll sync your workspace and check your open files...
[Uses p4_sync, p4_status]

Troubleshooting

Server not appearing in Claude

  1. Restart Claude Desktop after modifying the configuration
  2. Check that the configuration file is valid JSON
  3. Verify the MCP server is installed: npm list -g @cocoon-ai/mcp-perforce

Perforce authentication errors

  1. Check your .p4config file exists and has the correct settings
  2. Test your connection outside Claude: p4 info
  3. Make sure you're logged in: p4 login
  4. Verify P4CONFIG is being recognized: p4 set P4CONFIG

Wrong Perforce server being used

  1. Check which directory you're in - the server uses .p4config from the current or parent directories
  2. Run p4 info to see which config is being used
  3. Use the p4_info command in Claude to debug: "Show me my P4 configuration"

Command not working as expected

  1. Check Claude's response for error messages
  2. Verify the P4 command works in your terminal from the same directory
  3. Enable debug logging (see below)

Debug Logging

To enable debug output, add to your configuration:

json
{
  "mcpServers": {
    "perforce": {
      "command": "npx",
      "args": ["-y", "@cocoon-ai/mcp-perforce"],
      "env": {
        "P4CONFIG": ".p4config",
        "DEBUG": "mcp:*"
      }
    }
  }
}

Development

Building from source

bash
git clone https://github.com/Cocoon-AI/mcp-perforce.git
cd mcp-perforce
npm install
npm run build

Running tests

bash
npm test

Adding new commands

  1. Add the tool definition in the appropriate file under src/tools/
  2. Add the handler function in the corresponding file under src/handlers/
  3. Update the switch statement in src/handlers/index.ts
  4. Follow the existing pattern for parameter validation and error handling

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/new-command)
  3. Commit your changes (git commit -am 'Add new P4 command')
  4. Push to the branch (git push origin feature/new-command)
  5. Create a Pull Request

License

MIT License - see LICENSE file for details

Acknowledgments

Support


Made with ❤️ for AIs struggling with P4 command-line operations

Установка

TypingMind
{
  "mcpServers": {
    "mcp-perforce": {
      "command": "npx",
      "args": [
        "-y",
        "@cocoon-ai/mcp-perforce"
      ],
      "env": {
        "P4CONFIG": "<P4CONFIG>"
      }
    }
  }
}

Доступные инструменты

  • p4_add

    Add files to Perforce

  • p4_edit

    Open files for edit in Perforce

  • p4_delete

    Mark files for deletion in Perforce

  • p4_revert

    Revert files or changelist

  • p4_sync

    Sync files from the depot

  • p4_diff

    Show differences for files

  • p4_changelist_create

    Create a new changelist with a description

  • p4_changelist_submit

    Submit a changelist

  • p4_move_to_changelist

    Move files to a specific changelist

  • p4_status

    Get current P4 workspace status and pending changes

  • p4_info

    Show Perforce configuration info for current directory

  • mcp_perforce_version

    Show MCP Perforce server version

  • p4_stream_list

    List all streams or streams matching a pattern

  • p4_stream_info

    Get detailed information about a specific stream

  • p4_stream_switch

    Switch workspace to a different stream

  • p4_stream_create

    Create a new stream

  • p4_stream_edit

    Edit stream specification

  • p4_stream_graph

    Show stream hierarchy graph

  • p4_client_list

    List all clients/workspaces for the current user

  • p4_client_info

    Get detailed information about a specific client/workspace

  • p4_client_create

    Create a new client/workspace

  • p4_client_edit

    Edit an existing client/workspace specification

  • p4_client_delete

    Delete a client/workspace

  • p4_client_switch

    Switch to a different client/workspace

Используйте MCP MCP Perforce Server с разными ИИ-моделями

TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому после подключения MCP Perforce Server вы можете использовать их с разными моделями ИИ в TypingMind, не настраивая подключение отдельно для каждой модели. Эта интеграция MCP работает локально на вашем устройстве через коннектор MCP TypingMind.

Руководство по настройке локального коннектора

Выберите этот способ, если серверу MCP нужен доступ к локальным файлам, приложениям или закрытым ресурсам на вашем компьютере.

1

Откройте настройки MCP

В TypingMind откройте «Настройки», затем «Расширенные настройки», перейдите в раздел «Протокол контекста модели» и выберите «Настроить коннектор».

  1. Откройте TypingMind в браузере.
  2. Нажмите значок настроек.
  3. Перейдите в «Расширенные настройки».
  4. Откройте раздел «Протокол контекста модели».
  5. Нажмите «Настроить коннектор» и выберите «Это устройство».
Экран настройки коннектора MCP в TypingMind с выбранным вариантом «Это устройство»
2

Выполните команду коннектора

Выберите «Это устройство», скопируйте команду из TypingMind и выполните её в терминале. Не останавливайте процесс, пока используете MCP.

  1. Скопируйте команду настройки, показанную в TypingMind.
  2. Откройте «Терминал» в macOS или Windows Terminal в Windows.
  3. Вставьте и выполните команду.
  4. Подтвердите установку пакета, если терминал запросит разрешение продолжить.
  5. Не закрывайте окно терминала и не останавливайте процесс, пока используете инструменты MCP.
3

Добавьте MCP Perforce Server как сервер

Когда статус коннектора сменится на «Готов», нажмите «Изменить серверы» и вставьте конфигурацию сервера MCP.

  1. Дождитесь, пока статус коннектора сменится на «Готов».
  2. Нажмите «Изменить серверы».
  3. Вставьте конфигурацию сервера MCP для MCP Perforce Server.
  4. Сохраните список серверов.
  5. Обновите статус, если хотите убедиться, что коннектор по-прежнему готов к работе.
Настройки MCP в TypingMind с активным сервером и кнопкой «Изменить серверы»
{
  "mcpServers": {
    "mcp-perforce": {
      "command": "npx",
      "args": [
        "-y",
        "@cocoon-ai/mcp-perforce"
      ]
    }
  }
}
4

Используйте подключение с разными моделями

Сохраните список серверов, откройте раздел «Плагины», включите инструменты MCP для MCP Perforce Server, затем выберите любую поддерживаемую модель ИИ в TypingMind и используйте инструменты в чате или назначьте их ИИ-агенту.

  1. Откройте страницу «Плагины» в TypingMind.
  2. Включите инструменты MCP для MCP Perforce Server.
  3. Начните чат и выберите модель ИИ, которую хотите использовать.
  4. Используйте инструменты MCP в чате или назначьте их ИИ-агенту.
  5. При необходимости переключайтесь на другую модель ИИ без повторного подключения MCP.
Чат TypingMind с включёнными инструментами MCP и выбранной ИИ-моделью
Можете помочь мне с этой задачей с помощью MCP Perforce Server?
MCP Perforce Server
Конечно. Я всё прочитал.
Вот что я нашёл с помощью MCP Perforce Server.

Часто задаваемые вопросы

Для чего используется сервер MCP MCP Perforce Server?

MCP Perforce Server — это сервер MCP, который позволяет совместимым ИИ-клиентам подключаться к внешним инструментам и получать контекст. В TypingMind достаточно один раз добавить этот сервер MCP, чтобы его инструменты стали доступны в вашем рабочем пространстве с ИИ.

Можно ли использовать сервер MCP MCP Perforce Server с несколькими ИИ-моделями в TypingMind?

Да. TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому вы можете использовать MCP Perforce Server с разными ИИ-моделями, например Claude, ChatGPT, Gemini или другими моделями, настроенными в TypingMind, без отдельной настройки сервера MCP для каждой модели.

Зачем использовать MCP MCP Perforce Server с TypingMind?

TypingMind — один из лучших интерфейсов для чата с LLM: он объединяет разные ИИ-модели, промпты, плагины, ИИ-агентов, ключи API и инструменты MCP в одном рабочем пространстве. Подключив MCP Perforce Server, вы сможете использовать его инструменты MCP с предпочитаемыми моделями, сохраняя удобную организацию работы с чатами в TypingMind.

Как подключить сервер MCP MCP Perforce Server к TypingMind?

MCP Perforce Server работает через локальный коннектор MCP TypingMind. Этот вариант лучше всего подходит, когда серверу MCP нужен доступ к локальным файлам, настольным приложениям, инструментам командной строки или закрытым ресурсам на вашем компьютере.

Какие инструменты предоставляет сервер MCP MCP Perforce Server в TypingMind?

MCP Perforce Server предоставляет инструменты MCP (24), которые можно включить на странице «Плагины» в TypingMind и использовать в чате или назначить ИИ-агентам.

Нужно ли передавать TypingMind свои ключи API для использования сервера MCP MCP Perforce Server?

Нет. TypingMind ориентирован прежде всего на локальную работу и позволяет вам контролировать выбор провайдеров моделей, ключи API, промпты и конфигурацию MCP. Если MCP Perforce Server требует аутентификации, при создании подключения добавьте необходимые заголовки, настройки OAuth или локальную конфигурацию для этого сервера MCP.

Похожие серверы MCP

Все

Создайте свою рабочую ИИ-среду сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇