Pitch: Add MCP Support to AgentScript

Problem

Copilot Chat in VS Code now supports an open standard called the Model Context Protocol (MCP), which allows agents to expose tools that AI models can use via a consistent API. Currently, AgentScript has no way to participate in this ecosystem.

Appetite

2 weeks.

Solution

Rabbit Holes

No-Gos

Example

To integrate MCP support in AgentScript, follow these steps:

  1. Understand the architecture: MCP connects a client (VS Code) to a tool server (AgentScript).
  2. Implement AgentScript as an MCP server using stdio or sse.
  3. Expose tools like runModel, getWorldState, and setParameters.
  4. Emit tool list updates using the tools/listChanged event.
  5. Add this to your repo's .vscode/mcp.json:
    {
      "servers": [
        {
          "id": "agentscript-local",
          "command": "node ./agentscript/mcp-server.js"
        }
      ]
    }
  6. Alternatively, register the server globally in settings.json.

Helpful references: