Building a Multi-Agent Orchestra with Antigravity IDE and Discord MCP

When automating development pipelines with AI agents, you often run into situations where it is difficult to tell at a glance what each agent is currently doing.

Especially in a multi-agent architecture where specification writing, implementation, testing, and verification are delegated to multiple sub-agents, tracking the execution flow and failure points using only IDE terminal logs is no easy task.

In this post, I will walk through how to integrate Antigravity IDE with a local Discord MCP (Model Context Protocol) server so that all collaboration logs between the main orchestrator and sub-agents are recorded in real time on a dedicated Discord channel.

Overall Architecture and Workflow

Instead of relying on a single agent for everything, the pipeline is divided into four isolated sub-agents with distinct roles, overseen by a main orchestrator.

Start and completion logs for each phase are automatically sent to the #agent-logs channel, while critical verification failure alerts are dispatched to the #dev-alerts channel.

Plain Text

1

2

3

4

5

6

7

8

[User Requirements]
       ➔ Main Orchestrator (AGENTS.md)
             ├── 1. spec-writer   (Specification)       ──➔ Report to #agent-logs
             ├── 2. implementer   (Implementation)      ──➔ Report to #agent-logs
             ├── 3. test-runner   (Testing / Docker)    ──➔ Report to #agent-logs
             └── 4. spec-verifier (Spec Audit)          ──➔ Pass: Complete
                                                        ──➔ Defect: Rework loop (up to 3 times)
                                                        ──➔ Critical Error: #dev-alerts (@here)

Agent Roles and Model Allocation

  • Orchestration (Main Orchestrator) — Default Session Model

    • Controls the entire pipeline, invokes sub-agents, issues rework instructions, and handles real-time Discord reporting.

  • Design (spec-writer)

    • Restricted from modifying source code; dedicated to writing technical specifications and verification checklists under docs/specs/.

    • Model: gemini-4-neon

  • Implementation (implementer)

    • Writes production code and fixes defects based on finalized specifications.

    • Model: gemini-4-hydrogen

  • Testing & Execution (test-runner)

    • Writes unit and integration tests, spins up Docker containers directly, and collects execution logs.

    • Model: gemini-4-hydrogen

  • Audit (spec-verifier)

    • Read-only permissions; audits implementation fidelity against initial specifications as well as security and code quality.

    • Model: gemini-4-neon

Step 1: Create a Dedicated Discord Server and Isolate the Bot

Because agent logs may contain project structures or internal error messages, you should first set up a private, isolated environment so external users cannot invite your bot to other servers.

  • Security Notice: The bot token (DISCORDBOTTOKEN) acts like an administrator password for your bot. Never hardcode it into public GitHub repositories or source files—store it strictly in local environment variables or configuration files excluded via .gitignore.

1) Create a Private Server for Agents

  1. Click '+ (Add a Server)' at the bottom of the server list on the left sidebar in the Discord app or web client.

  2. Select 'Create My Own ➔ For me and my friends' to create a new server (e.g., Antigravity-Logs).

  3. Once created, add two text channels in advance: #agent-logs and #dev-alerts.

2) Create an App and Issue a Bot Token in the Discord Developer Portal

  1. Log in to the Discord Developer Portal and click 'New Application' in the top right to create an app.

  2. Navigate to the 'Bot' tab in the left sidebar, configure the following items in order, and click 'Save Changes':

  • Reset Token: Click 'Reset Token' and copy the generated token string to a safe place. (You will not be able to view it again once you leave the page.)

  • Disable Public Invites: Toggle 'Authorization Flow ➔ Public Bot' to 'Off'.

  • Enable Privileged Gateway Intents: Toggle all three of the following intents to 'On':

    • Presence Intent

    • Server Members Intent

    • Message Content Intent

3) Invite the Bot to Your Dedicated Server

  1. Go to 'OAuth2 ➔ OAuth2 URL Generator' in the left sidebar.

  2. Under 'Scopes', check the 'bot' checkbox.

  3. In the 'Bot Permissions' section that appears below, select these four required permissions:

    1. General Permissions: 'Manage Channels' (required if agents create channels automatically), 'View Channels'

    2. Text Permissions: 'Send Messages', 'Read Message History'

  4. Click the copy button next to 'Generated URL' at the bottom, paste it into a new browser tab, select the dedicated server you created earlier, and click 'Authorize'.

Once the newly created bot appears in the member list on the right side of your dedicated server, Step 1 is complete.

Step 2: Run the Local Discord MCP Server and Connect to Antigravity

Without any separate cloud hosting, you can run the Node.js-based open-source package (mcp-discord) locally over stdio.

1) Check Prerequisites and Copy the Server ID

  1. Run node -v and npm -v in your terminal to verify that Node.js (v18 or higher recommended) is installed.

  2. In the Discord app, go to 'User Settings (gear icon) ➔ Advanced ➔ Developer Mode' and turn it on.

  3. Right-click your dedicated server icon on the left sidebar and click 'Copy Server ID' to obtain your Guild ID.

2) Register the Antigravity MCP Configuration File

To apply the configuration globally, open ~/.gemini/antigravity/mcp_config.json (or .agents/mcp.json in your project root for project-specific use) and add the following:

~/.gemini/antigravity/mcp_config.json

JSON

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

{
  "mcpServers": {
    "discord": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-discord",
        "--config",
        "ENTER_BOT_TOKEN_FROM_STEP_1"
      ],
      "env": {
        "DISCORD_GUILD_ID": "ENTER_DEDICATED_SERVER_ID"
      }
    }
  }
}

3) Reload the MCP Server and Verify the Connection

After saving the configuration, open the Command Palette in Antigravity IDE (Cmd + Shift + P or Ctrl + Shift + P), open 'Manage MCP servers', and click the 'Refresh' button to restart the MCP server.

Next, start a new agent session and enter a prompt like:

Please list the channels in the Discord server.

Please list the channels in the Discord server.

Step 3: Build the Multi-Agent Orchestra

Now, separate and configure the main orchestrator instructions (AGENTS.md) and role-specific custom sub-agents (agent.md).

Create the following directory structure under .agents/ in your project root for a single project, or under ~/.gemini/config/ to apply it globally across all projects:

Plain Text

1

2

3

4

5

6

7

8

9

10

11

project_root/ (or under ~/.gemini/config/ for global use)
├── AGENTS.md                           # Main orchestrator instructions & Discord reporting rules
└── agents/
    ├── spec-writer/
    │   └── agent.md                    # Specification writer agent
    ├── implementer/
    │   └── agent.md                    # Code implementation agent
    ├── test-runner/
    │   └── agent.md                    # Test authoring & container runner agent
    └── spec-verifier/
        └── agent.md                    # Specification compliance verifier agent

1) Main Orchestrator Configuration (AGENTS.md)

AGENTS.md does not require a YAML frontmatter header and is automatically loaded as the default instruction set whenever a main session starts.

Plain Text

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

# Main Orchestrator Instructions

You are the **Main Orchestrator** overseeing the software development pipeline.
When you receive user requirements, do not write all the code directly. Instead, delegate tasks to the sub-agents following the 4-stage pipeline below and review their outputs.

## 1. Execution Pipeline
1. **Invoke `spec-writer`:** Analyze the requirements and write a detailed implementation specification and checklist under `docs/specs/`.
2. **Invoke `implementer`:** Implement the production code based on the finalized specification.
3. **Invoke `test-runner`:** Write unit/integration tests, spin up Docker containers directly if needed, run the tests, and collect the results.
4. **Invoke `spec-verifier`:** Audit the actual implementation and test execution logs against the initial specification to ensure there are no omissions or defects.
5. **Rework Loop:** If `spec-verifier` uncovers defects or critical errors, summarize the corrective instructions and re-run `implementer` → `test-runner` → `spec-verifier` in order (up to 3 iterations).

## 2. Real-Time Discord Reporting Rules (Mandatory)
- Use the Discord MCP tools to log progress. At the start of a session, list the channels first to retrieve the channel IDs for `#agent-logs` and `#dev-alerts`.
- **Stage Progress Reports:** Whenever a stage (`spec-writer`, `implementer`, `test-runner`, `spec-verifier`) starts or finishes, post a message to **`#agent-logs`** in the following format:
  > **[Stage Name | Status]** (e.g., `[Spec Writer | Completed]`)
  > - **Summary:** (2–3 lines covering key details)
  > - **Artifacts / Results:** (Generated file paths or test pass rate)
- **Critical Error Alerts:** If `spec-verifier` detects a **critical error (security vulnerability, data integrity breakage, missing core specification, or 3 consecutive verification failures)**, immediately report the root cause and impact scope to **`#dev-alerts`** with an `@here` mention and wait for user approval:
  > `@here` 🚨 **[Critical Error Detected - Spec Verifier]**
  > - **Error Summary:** (Description of the issue)
  > - **Related Files:** (File paths)
  > - **Action Required:** (Items requiring user confirmation)

2) Role-Specific Sub-Agent Configurations (agent.md)

Define the model and allowed tools in the YAML frontmatter of each agent file to enforce privilege isolation and optimize token consumption.

① Specification Writer Agent (agents/spec-writer/agent.md)

Restricts file modification tools so it cannot touch source code, and assigns gemini-4-neon for high architectural accuracy.

Plain Text

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

---
name: spec-writer
description: Analyzes user requirements and writes technical specifications including APIs, DB schemas, exception handling, and acceptance criteria.
model: gemini-4-neon
tools:
  - view_file
  - list_dir
  - write_to_file
---

You are a Senior Software Architect.
Analyze the requirements received from the Main Orchestrator along with the existing codebase, and write an actionable, detailed specification in Markdown under `docs/specs/`.

## Required Sections
1. **Feature Overview and Scope**
2. **Data Model / DB Schema Changes**
3. **API Endpoints and Input/Output Specs (including error codes)**
4. **Core Business Logic and Edge Case Handling Rules**
5. **Verification Checklist (objective criteria for `spec-verifier` to evaluate pass/fail)**

Upon completion, return the path of the generated specification file along with a summary of the key design decisions.

② Implementation Agent (agents/implementer/agent.md)

Focuses on rapidly writing code according to an already finalized specification, making the cost-effective gemini-4-hydrogen an ideal fit.

Plain Text

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

---
name: implementer
description: Implements and refactors application source code based on finalized technical specifications.
model: gemini-4-hydrogen
tools:
  - view_file
  - list_dir
  - write_to_file
  - replace_file_content
---

You are an experienced Backend/Full-Stack Developer.
Implement the code strictly following the specification in `docs/specs/` and the instructions from the Main Orchestrator.

## Working Principles
- Do not make arbitrary spec changes or add unnecessary libraries not defined in the specification.
- If re-invoked due to feedback from `spec-verifier`, prioritize fixing the reported defects first.
- Upon completion, return the list of created/modified files and a summary of the main changes.

③ Test & Container Runner Agent (agents/test-runner/agent.md)

Grants terminal command execution (run_command) so it can spin up Docker containers directly and run test suites.

Plain Text

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

---
name: test-runner
description: Writes unit/integration tests and spins up Docker container environments to execute and verify tests.
model: gemini-4-hydrogen
tools:
  - view_file
  - list_dir
  - write_to_file
  - replace_file_content
  - run_command
---

You are a QA and Test Automation Engineer.
Write test code and gather actual execution results to verify that the implemented code works as intended.

## Workflow
1. Write unit and integration tests covering all edge cases defined in the specification.
2. If external dependencies such as a DB, Redis, or message queue are required, spin up test containers directly using `docker compose up -d` and verify health checks.
3. Run the test suite and collect full execution logs.
4. Clean up any temporary resources after testing completes, and return the **passed/failed test counts along with exact stack traces for any failures**.

④ Specification Verifier Agent (agents/spec-verifier/agent.md)

Acts as a read-only auditor that never modifies code, using gemini-4-neon for thorough inspection.

Plain Text

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

---
name: spec-verifier
description: Audits whether the implemented code and test results meet all requirements and security/quality standards in the initial specification.
model: gemini-4-neon
tools:
  - view_file
  - list_dir
  - grep_search
---

You are a strict Code Auditor (Spec Verifier).
Do not modify any code directly. Compare the specification in `docs/specs/`, the actual implementation, and the execution results from `test-runner` to determine whether the implementation passes.

## Evaluation Criteria and Output Format
You must issue a final verdict using one of the following three statuses:

1. **`PASS`**: All checklist items in the specification are implemented and all tests pass.
2. **`MINOR_FAIL`**: Minor logic omissions, code convention violations, or slight edge-case gaps that can be resolved through rework.
3. **`CRITICAL_FAIL`**: Critical security vulnerabilities (auth bypass, SQLi, sensitive data exposure), data loss/integrity risks, or core architectural violations requiring an immediate `#dev-alerts` warning.

Your output must explicitly include `[Verdict: PASS | MINOR_FAIL | CRITICAL_FAIL]`, `List of Defects Found (including file names and line numbers)`, and `Rework Recommendations`.

Conclusion

When introducing AI agents into a development workflow, the most important factor is not simply generating code quickly, but designing a pipeline that keeps the execution process observable and verifiable

By combining privilege-isolated sub-agents with real-time Discord logging, you can enjoy the benefits of automation while maintaining system stability, code quality, and full visibility across your development environment.

This post was structured and refined with the assistance of AI (Gemini), based on an environment personally built and tested by the author.

References

Discord Developer Portal Documentation

Model Context Protocol (MCP) Specification

민갤

Back-End Developer

백엔드 개발자입니다.

Building Your Own MCP Server with TypeScript and Bun

Learn the core architecture of MCP (Model Context Protocol) and build your own lightweight custom MCP server from scratch using TypeScript and Bun to connect AI agents with local files and internal workflows.

Java Script

v5.0