Custom MCP servers

CoAgent can be expanded to include custom MCP servers. Enter project-specific servers in .coagent/mcp.json in the TwinCAT Solution folder (see the “Project Workspace” chapter). Create the file if necessary. It is loaded for the open solution; changes are applied automatically (hot reload). A project-specific entry takes precedence over a global entry with the same server name.

Use valid JSON with double quotes, without comments or trailing commas. Windows paths can be specified using / or by using two backslashes ( \\ ).

Example of an MCP server configuration:

{
  "mcpServers": {
    "mein-server": {
      "type": "stdio",
      "command": "C:/Pfad/zur/python.exe",
      "args": ["C:/Pfad/zum/server.py"],
      "env": {
        "MEINE_VARIABLE": "wert"
      }
    }
  }
}

Adjust the executable program path and the script path to match your local installation. For a remote server using Streamable HTTP, specify its MCP endpoint instead:

{
  "mcpServers": {
    "mein-http-server": {
      "type": "http",
      "url": "https://mcp.example.com/mcp"
    }
  }
}

The URL is a placeholder. If necessary, include the authentication headers required by the server. The following table describes the parameters for these connection types:

Parameter

Required

Meaning

type

For HTTP

"stdio" starts a local process (default if not specified), "http" uses Streamable HTTP. A URL alone does not determine the connection type.

command

For stdio

Executable file for starting the server. Arguments are specified separately.

args

No

List of individual arguments, such as the script path.
Default: empty list.

env

No

Additional environment variables for the stdio process as key/value pairs with strings.

cwd

No

Working directory for the stdio process. It is best to use an absolute path.

url

For HTTP

The full URL of the MCP endpoint, not a web page or an older SSE endpoint.

headers

No

HTTP headers as key/value pairs containing strings, such as for authentication.

timeout_in_seconds

No

Timeout in seconds for establishing a connection and for requests to the server (default: 15). The abbreviation timeout is also accepted. On stdio servers, a set value also applies to tool calls, unless tool_call_timeout_in_seconds is specified.

tool_call_timeout_in_seconds

No

Time limit in seconds for a tool call to this server. If not specified, the MCP Tool Call Timeout from the general settings applies.

mcp_config

No

Additional options as an object: active_solution (true = the server receives the folder of the open solution as an argument when it starts --active_solution, stdio only) and trust_annotations (true = the read-only flag of this server’s tools is used to classify it as a read-only tool; default false).

Tool approvals are managed as described in the Tool Approvals chapter. Also select the tools required for the agent.

To create an MCP server, use the Python package mcp ( pip install mcp ) or a compatible SDK. The specification is available at https://modelcontextprotocol.io/.