SmartGPT is a TypeScript framework for building AI agents using a dual model pipeline. It can run as a library or as a REST server and integrates directly with the Cursor IDE.
- Dual reasoning and context models
- ThoughtChain multi-step reasoning
- Web search with content extraction
- Neo4j or in-memory memory store
- Optional Memvid (.mv2) memory backend
- Tool system with shell and file access
- Codex SDK + Claude Code/Agent SDK for all model calls
npm installimport { SmartGPT } from './src/index.js';
const smart = new SmartGPT({
agentProvider: "codex", // or "claude"
deep: true,
});
const answer = await smart.ask('What is quantum computing?');npm run serverThe server exposes endpoints like /api/ask and /mcp/invoke on port 4141.
Install the SDK:
npm install @memvid/sdkConfigure SmartGPT to use a Memvid .mv2 file for retrieval:
import { SmartGPT } from './src/index.js';
const smart = new SmartGPT({
agentProvider: "codex",
memvid: {
path: "./memory.mv2",
adapter: "basic",
mode: "auto",
createIfMissing: true,
},
});If the file already exists, SmartGPT opens it via the Memvid adapter. If not, it creates it when createIfMissing is true.
SmartGPT MCP exposes two additional agent tools:
codex_sdkfor the OpenAI Codex SDKclaude_code_sdkfor the Claude Code (Claude Agent) SDK
Install the SDKs:
npm install @openai/codex-sdk @anthropic-ai/claude-agent-sdkAuthentication:
- Codex: sign in with your ChatGPT subscription or an OpenAI API key (Codex CLI/IDE login).
- Claude Code: sign in with a Claude subscription or use an Anthropic Console API key.
Model selection:
- Codex models are configured via Codex (or pass
modelto thecodex_sdktool). If you omitreasoningModel/contextModel, SmartGPT lets the Codex SDK choose its default. - Claude Code supports model aliases and full model names. You can set the model via
/model,claude --model,ANTHROPIC_MODEL, or your settings file. If you omitreasoningModel/contextModel, SmartGPT lets the Claude SDK choose its default.
Note: The Claude Code SDK was renamed to the Claude Agent SDK. This repo uses the new package name but still supports the old one if you have it installed.
Start SmartGPT in stdio mode and configure Cursor to call it:
npx tsx smartgpt_mcp_server.ts --stdioSee examples/ for additional demonstrations and src/README.md for an overview of the source layout.