Turbo C MCP Server
๐พ What is this?
Turbo C MCP Server hands your AI assistant a genuine Borland Turbo C 3.0 toolchain over the Model Context Protocol. Your LLM doesn't simulate C anymore โ it compiles and runs the real thing on the same 16-bit compiler a generation of programmers grew up on, and gets back true output, real Borland diagnostics, and cycle-accurate timing.
Ask Claude to "write a prime sieve in C and run it" โ and it actually does, on
TCC.EXE. Errors are real.exit 0is earned.
flowchart LR
A["๐ง LLM / Claude"] -- MCP stdio --> B["โ๏ธ turboc-mcp-server"]
B -- TCC.EXE --> C["๐ Borland Turbo C 3.0"]
C -- .EXE --> D["๐ฅ๏ธ DOS runtime / DOSBox"]
D -- stdout ยท exit code ยท timing --> B
B -- structured result --> A
style A fill:#00c853,stroke:#eafff3,color:#04150d
style B fill:#0b3d2e,stroke:#00e5ff,color:#eafff3
style C fill:#ffb300,stroke:#0b0f14,color:#0b0f14
style D fill:#37474f,stroke:#00e5ff,color:#eafff3โจ Why it goes further than "run my C"
๐ It's a studio, not a button
Twelve composable tools: compile-only checks, a static analyzer that runs without a compiler, an error explainer, an assembly disassembler, a benchmark harness, and a self-healing doctor.
๐ง Structured, model-friendly output
Every compile is parsed into error/warning objects with file + line, so
your LLM can fix code surgically instead of squinting at raw logs.
๐ฎ Batteries + nostalgia included
A built-in library of 12 classic programs โ Fibonacci, prime sieve, Towers
of Hanoi, BGI graphics, conio colors โ exposed as MCP resources.
๐ฆ Runs on modern Windows
16-bit TCC.EXE can't run on 64-bit Windows? The included DOSBox bridge
wrappers make compile and run work anywhere. One env var each.
๐ Quick Start
1 ยท Prerequisites
Node.js โฅ 18
Borland Turbo C 3.0 at
C:\TURBOC3(or setTURBOC_ROOT)64-bit Windows? Also grab DOSBox โ see DOSBox setup
2 ยท Install & build
git clone https://github.com/BBSRguy/turboc-mcp-server.git
cd turboc-mcp-server
npm install
npm run build3 ยท Wire it into your MCP client
{
"mcpServers": {
"turboc": {
"command": "node",
"args": ["C:/path/to/turboc-mcp-server/build/server.js"],
"env": {
"TURBOC_ROOT": "C:\\TURBOC3"
// On 64-bit Windows, add the DOSBox bridge (see docs/DOSBOX.md):
// "TCC_COMMAND": "C:\\TURBOC3\\wrappers\\dosbox-tcc.bat",
// "MCP_C_RUN_COMMAND": "C:\\TURBOC3\\wrappers\\dosbox-run.bat"
}
}
}
}claude mcp add turboc -- node C:/path/to/turboc-mcp-server/build/server.js4 ยท Say hello
You: "Use turboc to run the
helloexample." AI: callsrun_exampleโHello, Turbo C! Compiled on real DOS iron.โexit 0
Not sure it's wired up? Ask it to run environment_doctor โ it verifies your
whole toolchain and tells you exactly what's missing.
๐งฐ The toolbox (12 tools)
# | Tool | What it does |
1 | ๐ข | Compile with |
2 | ๐ | Compile-only syntax/semantic check โ fast, no execution |
3 | ๐งช | Static analysis without compiling: |
4 | ๐ | Plain-English cause + fix for any Turbo C compiler / linker / runtime message |
5 | โ๏ธ | Emit the 16-bit x86 assembly listing ( |
6 | ๐ | Browse the classic-program library (filter by category) |
7 | ๐ | Fetch the full source of any example |
8 | โถ๏ธ | Compile and run an example in one shot |
9 | โฑ๏ธ | Run the program N times; report min / avg / max ms |
10 | ๐จ | Re-indent by brace depth, tidy whitespace โ zero deps |
11 | ๐ฉบ | Verify |
12 | ๐งน | Sweep old scratch sessions; keep the N most recent |
Plus MCP resources (turboc://environment, turboc://examples/*) and
prompts (debug-c-error, optimize-c, explain-program).
๐ฎ Examples
The bundled library (list_examples) covers every corner of the DOS C world:
Category | Programs |
๐ฉ basics |
|
๐งฎ algorithms |
|
๐จ graphics |
|
๐ฝ dos |
|
๐ data |
|
๐น fun |
|
โถ run_example { "id": "prime-sieve" }
Compile: โ success (312 ms, exit 0)
=== Run phase ===
Result: โ exit 0 (44 ms)
--- program stdout ---
Primes up to 100:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97โ๏ธ Configuration
Everything is environment-driven, so one build works on every setup.
Variable | Default | Purpose |
|
| Turbo C install root |
|
| Compiler entry point (or a DOSBox |
| (unset) | Wrapper to launch the compiled |
|
| Header search path |
|
| Library search path |
|
| BGI graphics drivers |
|
| Scratch directory for sessions |
|
| Per-run execution timeout |
|
| Per-compile timeout |
|
| Output cap returned to the model |
๐ Architecture
graph TD
S[server.ts<br/>tools ยท resources ยท prompts] --> T[turboc.ts<br/>compile ยท run ยท asm ยท doctor]
S --> A[analyze.ts<br/>heuristic linter]
S --> E[errors-db.ts<br/>error knowledge base]
S --> X[examples.ts<br/>classic programs]
S --> F[format.ts<br/>C reformatter]
T --> D[diagnostics.ts<br/>parse TCC output]
T --> U[util.ts<br/>spawn ยท timeout ยท shell bridge]
T --> C[config.ts<br/>env-driven paths]
style S fill:#00c853,stroke:#04150d,color:#04150d
style T fill:#0b3d2e,stroke:#00e5ff,color:#eafff3Clean, single-responsibility modules โ easy to read, easy to extend.
๐บ Roadmap
Multi-file / project compilation
BGI graphics โ PNG capture via DOSBox screenshots
Turbo Assembler (
TASM) round-tripMemory-model presets (
tiny/small/large) as first-class optionsnpm one-line install (
npx turboc-mcp-server)Watch mode + hot examples gallery on the website
Ideas welcome โ open an issue or PR.
๐ค Contributing
PRs are warmly welcome. Fork โ branch โ npm run build โ PR. New examples and
error-DB entries are especially appreciated; see CONTRIBUTING.md.
โญ Star history
If this brought a little 1992 magic to your AI, drop a โญ โ it genuinely helps.
๐ค Author
BBSRguy ยท @BBSRguy ยท rasran90@yahoo.com
Built for everyone who still hears the clrscr() flicker in their dreams. ๐น๏ธ