ICP Coder: AI Assistant for Motoko code generation

Project highlights

ICP Coder is an AI-powered coding assistant specialized in Motoko for the Internet Computer (ICP). It lowers entry barriers for new developers and accelerates productivity for experienced ones by providing context-aware code generation, search, and explanations directly inside IDEs like Cursor and VS Code.

Target users include ICP developers, students, and teams looking to onboard quickly to the Motoko language while leveraging modern AI workflows.


Features

  • Retrieval-Augmented Generation (RAG) pipeline for Motoko code search and generation

  • Full MCP (Model Context Protocol) server to stream Motoko context into IDEs (Cursor, Claude Desktop, VS Code, etc.)

  • Vector embeddings stored in ChromaDB for fast context retrieval

  • Google Gemini integration for context-aware code completions

  • REST API with authentication and key management

  • CLI and direct API examples for quick prototyping

  • Automated ingestion job to refresh Motoko docs and project samples monthly


How to install

git clone https://github.com/Quantum3-Labs/icp-coder
cd icp-coder
python -m venv venv
source venv/bin/activate   # On Windows: venv\Scripts\activate
pip install -r requirements.txt

Create a .env file with your Gemini API key:

GEMINI_API_KEY=your-gemini-api-key
SECRET_KEY=change-me


Usage Example

Run MCP Server

set PYTHONPATH=.
python MCP_Server/server.py --port 3000

Connect from Cursor/VS Code

{
  "mcpServers": {
    "icp-coder": {
      "url": "http://localhost:3000/mcp",
      "headers": {
        "API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Available tools:

  • get_motoko_context: retrieves relevant Motoko examples

  • generate_motoko_code: generates Motoko code with RAG context


Documentation

  • System Architecture: RAG_PIPELINE_DIAGRAM.md

  • RAG Approach: RAG_APPROACH_DIAGRAM.md

  • API Documentation: API/README.md

  • MCP Specification: API/MCP_SPECIFICATION.md


Dependencies


License

Apache 2.0


Resources


Future Plans

  • Rust support. Extend ICP Coder to generate, debug, and explain Rust-based canisters.

  • Full DApp support. Expand beyond single canisters to full-stack apps (canister + frontend + integrations).

  • Sustainable free tier. Explore support from the DFINITY Foundation to help sustain the free base model, ensuring developers always have access to core features.


:high_voltage: ICP Coder = AI superpowers for Motoko developers.

11 Likes

Hi
@Gianm Nice work, quick question why Gemini, interested to know your thought process on selecting it

Hi @MalithHatananchchige

I picked Gemini mainly because of its long context window. Many Gemini models support up to 1M tokens, which is a game-changer for Motoko development since it allows ICP Coder to load:

  • Entire Motoko docs

  • Multiple code samples

  • Developer queries

…all in one shot, without having to aggressively trim context.

With other providers (like OpenAI), context is much smaller and API usage costs are higher, which makes continuous RAG-powered coding less sustainable.

That said, ICP Coder is model-agnostic — Gemini is just the best fit right now for long-context coding support.

if you check our `env.example` fileb on github, we also show other providers:

OPENAI_API_KEY=your-openai-key-here
GEMINI_API_KEY=your-gemini-key-here
CLAUDE_API_KEY=your-claude-key-here
1 Like

I could’ve used something like this for my initial development :grinning_face_with_smiling_eyes:

1 Like

Well I used Cline daily, I did try Gemini vs anthropic. Gemini just blows through budget very quickly compared the anthropic. I do understand the context length issue. So your saying 1 Million context length is easier to deal with even though Gemini Pro is around 10 - 15 USD a million token. I’m very new to RAG so context triming and budgeting I have no idea.

In other cases I have used GLM 4.5 air and the big guy. They performed much better than anthropic to be honest and very budget friendly. Just my personal usage opinion. I’m curious to why tools pick closed source models over opensource model, In your experience why is it ?

Well… when Gian and me started this project we thought to make the project accessible to the most amount of developers. The problems with dealing with open source models is that you have to sometimes run them locally or rely on a service that provides their API. Hence, its a bit more practical for everyone to get a free API key like Gemini and other services provide and just use that for a given LLM to pass through our RAG + MCP repurposing when vibe-coding with our framework. Gemini’s free API use is quite generous. That way many people have access to it.

2 Likes

Very cool project!

You forgot to put the license text in GitHub, but otherwise well done.

2 Likes

Thanks mate, will add MIT licence on next PR :grin:

2 Likes

:rocket: ICP Coder is officially live!

Hi everyone — excited to share that ICP Coder is now live and ready to use!

ICP Coder is an AI assistant for Motoko developers that provides context-aware code generation, search, and explanations right inside IDEs (Cursor, VS Code).

The team has launched a public service with user registration, API keys, and an NPM package for easier IDE setup — so you no longer need to run the project from localhost.
Just follow the Quickstart in the repo README and start using the tool right away.

:link: Resources

:hammer_and_wrench: What’s next
We’re migrating the MCP server to use the Rust SDK for ICP — check it out here: https://github.com/ByteSmithLabs/ic-rmcp

If you’re interested in contributing or testing the Rust version, feel free to open an issue or drop a comment below.

Thanks — give it a try and let us know what you think!
— Gian / Q3 Labs

3 Likes