OpenCode MCP Server
Servidor MCP OpenCode para Antigravity
Este repositorio contiene el Servidor MCP OpenCode, un servidor basado en el Model Context Protocol (MCP) diseñado para actuar como asistente de mano derecha para Antigravity en tareas de desarrollo y arquitectura de software.
El objetivo principal de este MCP es ahorrar tokens en tareas complejas de Antigravity permitiendo que OpenCode refine los prompts y realice un análisis preliminar antes de enviar las instrucciones finales al modelo principal.
Características
Refinamiento de Prompts: Transforma prompts vagos en instrucciones detalladas y técnicas.
Soporte de Desarrollo: Asiste en la corrección de errores y la implementación de nuevas funcionalidades con un enfoque en la eficiencia.
Memoria Semántica: Almacena y recupera contexto técnico para enriquecer los prompts.
Related MCP server: Mem0 MCP Server
Requisitos previos
Antes de comenzar, necesitas configurar el entorno de desarrollo. Recomendamos usar NVM (Node Version Manager) para gestionar las versiones de Node.js en Windows.
1. Instalación de NVM y Node.js (Windows)
Descarga el instalador
nvm-setup.exedesde nvm-windows.Sigue las instrucciones de instalación.
Abre una nueva terminal de PowerShell e instala la versión recomendada de Node.js:
nvm install 22 nvm use 22
2. Instalación de Ollama (Para Memoria Semántica)
Ollama es necesario para generar embeddings locales.
Abre PowerShell como Administrador y ejecuta:
winget install ollamaDespués de la instalación, reinicia la terminal y descarga el modelo de memoria:
ollama pull nomic-embed-text
3. Verificar la instalación
Comprueba si las herramientas están listas en PowerShell:
node -v # Should return v22.x.x or higher
ollama --versionInstalación y configuración del proyecto
Sigue los pasos a continuación para configurar el Servidor MCP OpenCode usando PowerShell:
Clonar el repositorio:
git clone <repository-url> cd open-code-as-mcpInstalar dependencias:
npm installCompilar el proyecto:
npm run build
Configuración de Antigravity
Para integrar este servidor MCP con Antigravity, debes elegir entre el modo Local (ejecutándose en la misma máquina) o el modo Remoto (ejecutándose en un servidor/nube).
Opción A: Configuración Local (Stdio)
Usa esta opción si el servidor está en la misma máquina que el cliente.
Memoria Global (Predeterminado)
La memoria se compartirá entre todos los proyectos y se almacenará en la carpeta del servidor.
{
"mcpServers": {
"opencode": {
"command": "node",
"args": ["D:/IA/MCP/open-code-as-mcp/build/index.js"]
}
}
}Memoria por Proyecto (Recomendado)
Para que cada proyecto tenga su propia memoria aislada dentro de la carpeta .mcp_memory del proyecto:
{
"mcpServers": {
"opencode": {
"command": "node",
"args": ["D:/IA/MCP/open-code-as-mcp/build/index.js"],
"env": {
"MCP_MEMORY_PATH": ".mcp_memory/vectors"
}
}
}
}Nota: Asegúrate de añadir .mcp_memory/ a tu .gitignore si no deseas versionar la base de datos.
Opción B: Configuración Remota (SSE)
Usa esta opción si el servidor se está ejecutando de forma remota. El servidor debe iniciarse con el modo SSE activo.
{
"mcpServers": {
"opencode": {
"url": "http://your-remote-server:3000/sse"
}
}
}Nota: Asegúrate de que el puerto y la IP sean accesibles si usas el modo remoto.
Uso automático en Antigravity
Para asegurar que Antigravity use este MCP correctamente, configura las siguientes reglas en tu System Prompt:
Reglas Globales de Antigravity
Refinamiento de Prompts: Siempre que el usuario envíe una solicitud, usa primero
opencode:refine_prompt.Enriquecimiento de Contexto: Al recibir el prompt refinado, valida si hay términos técnicos que requieran una búsqueda adicional en la memoria semántica.
Aprendizaje Continuo: Después de implementar con éxito una funcionalidad compleja o una corrección de errores no obvia, usa
opencode:learn_contextpara persistir el conocimiento técnico.
Herramientas disponibles
El MCP de OpenCode proporciona las siguientes herramientas:
1. refine_prompt
Refina un prompt de desarrollo para hacerlo más claro y eficiente.
Argumentos:
prompt: (string) El prompt original que necesita refinamiento.
2. learn_context
Memoriza información importante (preferencia, regla técnica, contexto) para su uso futuro en la memoria semántica.
Argumentos:
information: (string) La información a recordar.category: (string, opcional) Categoría de la información (ej. 'preference', 'architecture', 'style').
Acceso Remoto (SSE)
El servidor admite acceso remoto a través de SSE (Server-Sent Events). Para ejecutar en modo remoto en PowerShell, usa:
Ejecución en modo remoto:
$env:MCP_MODE="sse"; $env:PORT="3000"; npm startDesarrollo
Para ejecutar el servidor en modo de desarrollo con recarga en caliente en PowerShell:
npm run devDepuración
Puedes probar el servidor localmente ejecutando en PowerShell:
node build/test-mcp.jsBeneficios de OpenCode MCP
Ahorro de Tokens: Al refinar los prompts localmente, reducimos la carga de contexto enviada a Antigravity.
Contexto Enriquecido: OpenCode puede acceder a archivos locales y proporcionar un contexto más rico para Antigravity.
Agilidad: Respuestas rápidas para tareas de refinamiento.
Desarrollado con el soporte de Gemini CLI.
Available Tools
2 toolslearn_contextB
Memorizes important information (preference, technical rule, context) for future use.
| Name | Required | Description | Default |
|---|---|---|---|
| information | Yes | The information to be remembered. | |
| category | No | Information category (e.g., 'preference', 'architecture', 'style'). |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must fully disclose behavior. It says 'memorizes... for future use' but lacks details on persistence, scope, or retrieval, leaving significant ambiguity about the tool's behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence with no redundant words. Every part serves to define the tool's purpose efficiently.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with two parameters and no output schema, the description covers the core functionality. However, it lacks context about when to prefer this over the sibling tool, which slightly reduces completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% (both parameters have descriptions). The description adds minimal value beyond the schema, citing examples like 'preference, technical rule, context', which weakly maps to the 'category' parameter. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'memorizes' and the resource 'important information', listing examples like preferences and technical rules. It effectively distinguishes from the sibling tool 'refine_prompt' which has a different purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives no guidance on when to use this tool versus alternatives, nor does it specify when not to use it. It only implies usage for storing information without context about trade-offs.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
refine_promptB
Refines a prompt using semantic memory to make it more contextual and efficient.
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | The original prompt that needs refinement. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It mentions 'using semantic memory' but does not explain side effects (e.g., memory updates), performance implications, or whether the operation is read-only or modifying. This leaves the agent uncertain about expectations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that starts with the verb. No unnecessary words or structure.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and simple input, the description should explain what 'refinement' means and how semantic memory is used. It does not specify the output format or any side effects, leaving the agent without enough context to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% for the single parameter, so baseline is 3. The description does not add any meaning beyond the schema's description of 'The original prompt that needs refinement.' No additional constraints, formats, or examples are given.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'refines' and the resource 'prompt', and uses 'semantic memory' to add specificity. It distinguishes from sibling 'learn_context' by focusing on prompt refinement rather than context learning.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus 'learn_context' or other alternatives. The description implies it is for making prompts more contextual and efficient, but does not specify prerequisites, exclusions, or when refinement is appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.0.0- First observed
learn_context - First observed
refine_prompt
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one stores information and the other uses it to refine prompts. There is no overlap or ambiguity.
Both tool names follow the verb_noun pattern consistently ('learn_context' and 'refine_prompt'), making them predictable and easy to understand.
With only 2 tools, the server feels thin for its scope. While the core functionality is covered, a typical server would include more tools (e.g., for updating or deleting context).
The server covers the basic workflow of storing and using context for prompt refinement. However, it lacks operations to update or delete learned context, which is a minor gap.
Maintenance
Related MCP Connectors
Project memory, semantic code search, and grounded agent context.
InfoLang semantic memory MCP — investigate, memorize, and recall compressed agent context.
- memoryOAuthcom.humaux
Persistent long-term memory for AI agents: semantic search, knowledge graph, and task canvas.
Persistent AI memory with semantic search, conflict detection, and ticketing.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables persistent memory and semantic search for development workflows with hierarchical compression. Store and retrieve development knowledge across IDE sessions using natural language queries, circumventing context window limitations.3AGPL 3.0
- FlicenseNot gradedqualityNot gradedmaintenanceEnables persistent storage and semantic search of coding preferences, patterns, and implementations using Mem0, allowing AI agents to remember and retrieve development best practices across sessions.3-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to store, retrieve, and self-improve procedural memories (lessons learned) based on relevance to the current task, pruning unused memories to reduce context load and prevent repetition of past mistakes.MIT
- AlicenseNot gradedqualityAmaintenanceProvides persistent long-term memory (semantic RAG) for AI coding assistants, enabling them to store and semantically search code and documentation across chat sessions without token limits.5MIT