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
- Implement an MCP server endpoint within AgentScript.
- Expose key AgentScript functionality as MCP "tools" (e.g. run model, inspect world, list turtles, etc.).
- Support communication via
stdio
or sse
protocols.
- Emit
tools/listChanged
events when available tools are updated.
- Document how to connect AgentScript to Copilot Chat by adding a
.vscode/mcp.json
file or VS Code user settings entry.
Rabbit Holes
- Optional: Support dynamic tool loading based on model context or project.
- Optional: Build a frontend UI to configure AgentScript tool availability.
No-Gos
- We won’t build a general-purpose command router for MCP.
- We won’t expose the entire AgentScript API—only a curated set of tools.
Example
To integrate MCP support in AgentScript, follow these steps:
- Understand the architecture: MCP connects a client (VS Code) to a tool server (AgentScript).
- Implement AgentScript as an MCP server using
stdio
or sse
.
- Expose tools like
runModel
, getWorldState
, and setParameters
.
- Emit tool list updates using the
tools/listChanged
event.
- Add this to your repo's
.vscode/mcp.json
:
{
"servers": [
{
"id": "agentscript-local",
"command": "node ./agentscript/mcp-server.js"
}
]
}
- Alternatively, register the server globally in
settings.json
.
Helpful references: