Logo de MCP Perforce Server

MCP Perforce Server

Organização
Cocoon-AI

MCP Perforce Server

Publicado porCocoon-AI
Repositóriomcp-perforce
IdiomaTypeScript
Forks
5
Estrelas
29
Ferramentas disponíveis
24
Tipo de transportestdio
Categorias
LicençaMIT
Links
  • Conecte ferramentas a fluxos de trabalho de IA

    MCP Perforce Server disponibiliza recursos MCP que podem ser usados por clientes e agentes de IA compatíveis.

  • 24 ferramentas disponíveis

    Confira abaixo as ações que podem ser chamadas, incluindo nomes e descrições quando fornecidos pelo servidor.

  • Configuração pronta para copiar

    Use os exemplos de instalação para configurar este servidor no seu cliente MCP preferido.

  • Indicadores da comunidade de código aberto

    29 estrelas e 5 forks no repositório vinculado.

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

Instalação

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

Ferramentas disponíveis

  • 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

Use o MCP de MCP Perforce Server com vários modelos de IA

O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho. Assim, após conectar MCP Perforce Server, é possível usá-lo com diferentes modelos de IA no TypingMind, em vez de configurá-lo separadamente para cada modelo. Este MCP é executado localmente no seu dispositivo por meio do conector MCP do TypingMind.

Guia de configuração para usar o conector local

Use esta opção quando o servidor MCP precisar acessar arquivos locais, aplicativos ou recursos privados no seu computador.

1

Abra as configurações de MCP

No TypingMind, vá até Configurações, Configurações avançadas e depois Model Context Protocol e selecione Configurar conector.

  1. Abra o TypingMind no navegador.
  2. Clique no ícone de Ajustes.
  3. Acesse Configurações avançadas.
  4. Abra a seção Model Context Protocol.
  5. Clique em Configurar conector e selecione Este dispositivo.
Tela de configuração do conector MCP do TypingMind com a opção Este dispositivo selecionada
2

Execute o comando do conector

Selecione Este dispositivo, copie o comando do TypingMind e execute-o no Terminal. Mantenha o processo em execução enquanto usa o MCP.

  1. Copie o comando de configuração exibido pelo TypingMind.
  2. Abra o Terminal no macOS ou o Windows Terminal no Windows.
  3. Cole e execute o comando.
  4. Autorize a instalação do pacote se o Terminal pedir confirmação para continuar.
  5. Mantenha o processo em execução na janela do Terminal enquanto usa as ferramentas MCP.
3

Adicione MCP Perforce Server como servidor

Quando o status do conector for Pronto, clique em Editar e cole a configuração do servidor MCP.

  1. Aguarde até que o status do conector mostre Pronto.
  2. Clique em Editar.
  3. Cole a configuração do servidor MCP de MCP Perforce Server.
  4. Salve a lista de servidores.
  5. Atualize para confirmar se o conector ainda está pronto para uso.
Configurações de MCP do TypingMind mostrando um servidor ativo e o botão Editar
{
  "mcpServers": {
    "mcp-perforce": {
      "command": "npx",
      "args": [
        "-y",
        "@cocoon-ai/mcp-perforce"
      ]
    }
  }
}
4

Use a conexão com diferentes modelos

Salve a lista de servidores, abra Plugins, ative as ferramentas MCP de MCP Perforce Server, selecione qualquer modelo de IA compatível no TypingMind e use as ferramentas no chat ou atribua-as a um agente de IA.

  1. Abra a página Plugins no TypingMind.
  2. Ative as ferramentas MCP de MCP Perforce Server.
  3. Inicie um chat e escolha o modelo de IA que deseja usar.
  4. Use as ferramentas MCP no chat ou atribua-as a um agente de IA.
  5. Mude para outro modelo de IA sempre que necessário, sem reconectar o MCP.
Chat do TypingMind usando ferramentas MCP ativadas com um modelo de IA selecionado
Pode usar MCP Perforce Server para me ajudar nesta tarefa?
MCP Perforce Server
Claro. Já li.
Veja o que encontrei usando MCP Perforce Server.

Perguntas frequentes

Para que serve o servidor MCP MCP Perforce Server?

MCP Perforce Server é um servidor MCP que permite que aplicativos de IA compatíveis se conectem a ferramentas externas e informações de contexto. No TypingMind, basta adicionar esse servidor MCP uma vez para disponibilizar suas ferramentas no seu espaço de trabalho com IA.

Posso usar o MCP MCP Perforce Server com vários modelos de IA no TypingMind?

Sim. O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho, permitindo usar MCP Perforce Server com diferentes modelos de IA, como Claude, ChatGPT, Gemini ou outros modelos configurados no TypingMind, sem configurar o servidor MCP separadamente para cada modelo.

Por que usar o MCP MCP Perforce Server com o TypingMind?

O TypingMind é uma das melhores interfaces de chat com LLMs porque reúne vários modelos de IA, prompts, plugins, agentes de IA, chaves de API e ferramentas MCP em um só espaço de trabalho. Com MCP Perforce Server conectado, é possível usar suas ferramentas MCP nos seus modelos preferidos e manter seu fluxo de trabalho de chat organizado no TypingMind.

Como conecto o MCP MCP Perforce Server ao TypingMind?

MCP Perforce Server funciona por meio do conector MCP local do TypingMind. Essa é a melhor opção quando o servidor MCP precisa acessar arquivos locais, apps de desktop, ferramentas de linha de comando ou recursos privados no seu computador.

Quais ferramentas o MCP MCP Perforce Server oferece no TypingMind?

MCP Perforce Server disponibiliza 24 ferramentas MCP que podem ser ativadas na página Plugins do TypingMind e usadas no chat ou atribuídas a agentes de IA.

Preciso compartilhar minhas chaves de API com o TypingMind para usar o MCP MCP Perforce Server?

Não. O TypingMind prioriza o uso local e permite manter seus provedores de modelos, chaves de API, prompts e configuração MCP sob seu controle. Se MCP Perforce Server exigir autenticação, adicione os cabeçalhos, as configurações OAuth ou a configuração local exigidos por esse servidor MCP ao criar a conexão.

Servidores MCP relacionados

Ver todos

Crie seu próprio espaço de IA agora

Inscreva-se na nossa newsletter para receber novidades sobre recursos e futuros sorteios 👇