Skip to main content

MCP server for FPGA hardware design in C⏚ — drive the open-source C⏚ Verilog compiler from an AI agent.

Project description

cg-agent-kit - an MCP server for FPGA design in C⏚

ci License: MIT

Give an AI agent the ability to design real hardware. cg-agent-kit is a Model Context Protocol server that drives the open-source C⏚ Verilog compiler - so an agent writes a C-like HDL, and the server compiles, checks, generates Verilog, and synthesis-checks it against the real toolchain instead of hallucinating Verilog that doesn't build.

C⏚ ("C-Ground") is a hardware description language with C-like syntax that compiles to clean, standard Verilog. The compiler is open source at github.com/Neosyn-Logic/cg-compiler.

Tools

Tool What it does
cg_check Compile + validate C⏚; structured diagnostics (file:line, the fix)
cg_generate_verilog Emit synthesizable Verilog
cg_simulate Simulate a design (iverilog backend, or the commercial fast sim)
cg_synth Yosys-synthesize the Verilog: REAL / FOLDED / SUSPECT verdict + cell count
cg_example Scored lookup into a curated, validated-code dictionary (18 entries)
cg_suggest_for_error Map a compiler error to the recipe with the fix pattern
cg_fsm / cg_graph A task's compiled state machine / a network's graph
cg_docs C⏚ language + patterns reference

The kit's organizing idea: agents seed-and-adapt from validated code and verify against the real compiler at every step - not invent-from-scratch.

Open vs commercial

This kit and the compiler it drives are open. The fast (bytecode) cycle-accurate simulator is part of the commercial Neosyn SDK - so cg_simulate's default bytecode backend asks you to upgrade, while the iverilog backend works fully (generate Verilog + run Icarus Verilog). Everything else - check, generate, synth, the dictionary, docs - runs entirely on the open compiler. More at neosyn.io/open.

Install

pip install cg-agent-kit

Then point it at a built C⏚ compiler jar (download the prebuilt jar from cg-compiler releases, or build from source):

export CG_JAR=/path/to/cg-language-server.jar

(Optional, for cg_synth and the iverilog sim backend, install yosys and iverilog.)

Run

As an MCP server (for Claude Desktop, Cursor, Windsurf, or any MCP client):

cg-mcp-server

Add it to your MCP client config, e.g.:

{
  "mcpServers": {
    "cg": { "command": "cg-mcp-server", "env": { "CG_JAR": "/path/to/cg-language-server.jar" } }
  }
}

Or call the verification functions directly from Python:

from cg_agent_kit import cg_mcp_server as cg
print(cg.check(open("Counter.cg").read()))
print(cg.generate(open("Counter.cg").read()))

The kit bundles 18 validated C⏚ designs and the language + CPU-pattern references the cg_docs tool serves.

License

MIT - see LICENSE. C⏚ began as the Synflow Cx toolchain.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cg_agent_kit-0.1.1.tar.gz (47.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cg_agent_kit-0.1.1-py3-none-any.whl (55.1 kB view details)

Uploaded Python 3

File details

Details for the file cg_agent_kit-0.1.1.tar.gz.

File metadata

  • Download URL: cg_agent_kit-0.1.1.tar.gz
  • Upload date:
  • Size: 47.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cg_agent_kit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ea01e95ecd1e18c8208fbe095ad48c570c58f19e49c2ba1383cbd361bb5a5ede
MD5 d9883a02235b44b686c2b757f0273cd8
BLAKE2b-256 d4fa08897d91c2dafeb1f77b799baa2fa3d8346185a0cad01f67e0e6cc2a5971

See more details on using hashes here.

File details

Details for the file cg_agent_kit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cg_agent_kit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 55.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cg_agent_kit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55ded397b2321629c5ce3c23debb14a5af5b350cb3b265f2938744ebed3be3dd
MD5 d4ef8890b4265fd44d585b395a539aff
BLAKE2b-256 8093ea9a45722f43165a9b99289d203f9e66b7d348b3733c989ab148c59a75a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page