Design PCBs from Gemini CLI and Gemini agents
One entry in settings.json gives Gemini CLI PCBEditor’s 16 design tools. For your own Gemini agents, Google’s Agent Development Kit connects to the same server or its OpenAPI spec.
Gemini CLI with sign-in
Add the server for your user, so it is there in every project:
gemini mcp add --transport http --scope user pcbeditor https://api.robodib.com/mcpOr write the entry yourself. Use httpUrl, which is Gemini CLI’s key for Streamable HTTP:
{
"mcpServers": {
"pcbeditor": {
"httpUrl": "https://api.robodib.com/mcp"
}
}
}Start Gemini CLI and run /mcp auth pcbeditor. Gemini CLI discovers PCBEditor’s OAuth endpoints, registers itself and opens the consent page in your browser. Run /mcp to see the tools.
Gemini CLI with a personal access token
Create a token at pcbeditor.com/profile/ai-tools and keep it in an environment variable. Gemini CLI expands environment variables in settings.json string values, so the file holds only the variable name:
{
"mcpServers": {
"pcbeditor": {
"httpUrl": "https://api.robodib.com/mcp",
"headers": {
"Authorization": "Bearer $PCBEDITOR_TOKEN"
}
}
}
}export PCBEDITOR_TOKEN="pcbe_..."
geminiThe CLI form works too, but your shell expands the variable when you run it, so the token value is written into settings.json:
gemini mcp add --transport http --scope user \
--header "Authorization: Bearer $PCBEDITOR_TOKEN" pcbeditor https://api.robodib.com/mcpGemini agents with Google ADK
Connect to the MCP server
The Agent Development Kit’s McpToolset speaks Streamable HTTP. Pass the server URL and your token as a header:
import os
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams
pcbeditor = McpToolset(
connection_params=StreamableHTTPConnectionParams(
url="https://api.robodib.com/mcp",
headers={"Authorization": "Bearer " + os.environ["PCBEDITOR_TOKEN"]},
)
)
root_agent = LlmAgent(
name="pcb_designer",
model="gemini-flash-latest",
instruction="Design and check PCBs with the PCBEditor tools. Follow design jobs with get_job.",
tools=[pcbeditor],
)Or load the OpenAPI spec
ADK’s OpenAPIToolset turns every operation in the spec into a tool. The spec is at https://api.robodib.com/agent-api/openapi.json.
import os, urllib.request
from google.adk.tools.openapi_tool.auth.auth_helpers import token_to_scheme_credential
from google.adk.tools.openapi_tool.openapi_spec_parser.openapi_toolset import OpenAPIToolset
spec = urllib.request.urlopen("https://api.robodib.com/agent-api/openapi.json").read().decode()
auth_scheme, auth_credential = token_to_scheme_credential(
"apikey", "header", "Authorization", "Bearer " + os.environ["PCBEDITOR_TOKEN"]
)
pcbeditor = OpenAPIToolset(
spec_str=spec, spec_str_type="json",
auth_scheme=auth_scheme, auth_credential=auth_credential,
)Plain Gemini function calling
Without ADK, declare the tools you need as Gemini functions. Function declarations use a subset of the OpenAPI schema, so each operation’s request schema in the spec maps across. When the model returns a function call, your code sends it to PCBEditor as a REST request:
POST https://api.robodib.com/agent-api/v1/tools/{name}
Authorization: Bearer pcbe_...
Content-Type: application/jsonThe body and response for every tool are defined in the spec. Return the response to the model as the function result.
Common questions
- Can Gemini design a PCB?
- With PCBEditor's MCP server connected, Gemini CLI or a Gemini agent can ask PCBEditor for a complete board: parts, schematic, placement, autorouting and a design-rule check. Gemini runs the conversation; PCBEditor's engines do the wiring, routing and checks.
- Should I use httpUrl or url in settings.json?
- httpUrl. Gemini CLI uses httpUrl for Streamable HTTP servers, which is what PCBEditor's server speaks; url is for the older SSE transport.
- Why does /mcp auth fail over SSH?
- Gemini CLI's OAuth sign-in needs a local browser and a redirect to localhost. On a remote machine without one, use a personal access token in the headers instead.
- Does the Gemini API read OpenAPI specs?
- Gemini function declarations use a subset of the OpenAPI schema, and your code executes the calls. Google's Agent Development Kit can load PCBEditor's MCP server or its OpenAPI spec directly and turn each tool into a function the model can call.
The server needs a free PCBEditor account. Clients that support MCP sign-in open a consent page in your browser; for the rest, create a personal access token.