# 04-fix-mcp-server

04-fix-mcp-server — a Claude prompt that runs the TypeScript build in mcp-server/, repairs compiler errors in server.ts and index.ts, then checks the server starts.

- prompt · `type=prompt` · Claude Code, ChatGPT · ★ 3444 repo stars
- Author: codeaashu
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/codeaashu/claude-code/tree/HEAD/prompts/04-fix-mcp-server.md
- Updated: 2026-10-14
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/prompts/04-fix-mcp-server

## What it does

Point it at a checkout that has the `mcp-server/` subproject, the small TypeScript project behind the MCP server for reading Claude sources. The prompt begins with `npm run build` to collect `tsc` output, then works through what broke in `mcp-server/src/server.ts` and `mcp-server/src/index.ts`. Expect duplicated function bodies, imports nobody added, and types that do not line up with the MCP SDK.

A second build should finish clean and leave `.js` files in `mcp-server/dist/`. Starting `node dist/index.js --help` is the smoke test. A process that sits there waiting on stdio input behaves normally, so the only thing to watch for is an immediate crash.

The tail of the file handles a rejected `git push`. A GitHub OAuth token sits in `.mcpregistry_github_token` inside commits `5e99ad6` and `7adaa5d`, and deleting the file from disk does nothing while those commits remain. Two routes are spelled out: a `git filter-branch` pass with `--index-filter` over `HEAD~5..HEAD`, or an interactive rebase you stop at each commit. Both finish by adding the token filenames to `.gitignore`.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/04-fix-mcp-server.md`

### ChatGPT

**How to use**
- Paste the text at the start of a chat or into project instructions

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/codeaashu/claude-code/tree/HEAD/prompts/04-fix-mcp-server.md

## When to use it
- get `npm run build` passing in `mcp-server/`
- clear duplicate functions and missing imports in `server.ts`
- confirm the compiled MCP server boots without crashing
- strip a leaked OAuth token out of git history
- keep token files out of later commits with `.gitignore`

## Example prompts
- \`/04-fix-mcp-server` the build in `mcp-server/` is red, sort out the TypeScript errors and get `npm run build` clean.
- Run `/04-fix-mcp-server` and check that `node mcp-server/dist/index.js` starts without crashing.
- \`/04-fix-mcp-server` my push is blocked by a token in old commits, rewrite them.

## Similar
- [om-auto-fix-issue](https://affpapa.org/en/nevibecode/skills/om-auto-fix-issue.md) — skill · 4700 installs
- [om-fix](https://affpapa.org/en/nevibecode/skills/om-fix.md) — skill · 3800 installs
- [review-fix-address-bots](https://affpapa.org/en/nevibecode/skills/review-fix-address-bots.md) — skill · 1200 installs
- [github-fix-issue](https://affpapa.org/en/nevibecode/skills/github-fix-issue.md) — skill · 205 installs
- [team-knowledge-mapper](https://affpapa.org/en/nevibecode/commands/team-knowledge-mapper.md) — command · 235 installs
- [fix-sync](https://affpapa.org/en/nevibecode/skills/fix-sync.md) — skill · ★ 51058 repo stars

From the same set: [codeaashu/claude-code](https://affpapa.org/en/nevibecode/by/codeaashu/claude-code.md) — 17 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
