code-failures-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@code-failures-mcpsearch for past bugs with 'connection timeout'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
code-failures-mcp
MCP server that indexes your code_failures/ knowledge base and makes it searchable from Claude Code (or any MCP client). Uses BM25 via MiniSearch for fast, relevant keyword search with fuzzy matching.
Why
Every bug you debug for hours becomes institutional knowledge. This MCP server makes that knowledge automatically available to Claude Code so it searches your past fixes before attempting a new solution.
Related MCP server: conversation-history-mcp
Tools
Tool | Purpose |
| Search bugs by symptom, error message, or library name |
| Search canonical working patterns and version guides |
| Search everything with relevance scores |
| Retrieve full content of a specific document |
| List all indexed documents |
Setup
cd /Users/tk/Desktop/code-failures-mcp
npm install
npm run buildConfigure Claude Code
CLI + Manual Config (recommended)
The claude mcp add CLI doesn't support environment variables via flags, so you need to add the server first, then manually edit the config:
# Step 1: Add the server (global)
claude mcp add code-failures -- node /Users/tk/Desktop/code-failures-mcp/dist/index.js
# Step 2: Edit ~/.claude.json and add the env object to the code-failures server config:
# "env": {
# "BRAIN_PATH": "/Users/tk/Desktop/brain/code_failures"
# }
# For project-scoped:
claude mcp add -s project code-failures -- node /Users/tk/Desktop/code-failures-mcp/dist/index.js
# Then edit the project's section in ~/.claude.jsonVerify with:
claude mcp listJSON config (alternative)
Manually add to ~/.claude.json (find your project section):
{
"projects": {
"/your/project/path": {
"mcpServers": {
"code-failures": {
"type": "stdio",
"command": "node",
"args": ["/Users/tk/Desktop/code-failures-mcp/dist/index.js"],
"env": {
"BRAIN_PATH": "/Users/tk/Desktop/brain/code_failures"
}
}
}
}
}
}Or for Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"code-failures": {
"command": "node",
"args": ["/Users/tk/Desktop/code-failures-mcp/dist/index.js"],
"env": {
"BRAIN_PATH": "/Users/tk/Desktop/brain/code_failures"
}
}
}
}CLAUDE.md Integration
Add this to your project's CLAUDE.md to make Claude Code automatically use the knowledge base:
# Global Preferences
- Implement only what's explicitly requested. Prefer minimal changes. No unnecessary features, files, or abstractions.
- Check all related functionality before modifying code — update or verify dependents.
- Before writing a script, check what tools are available via MCP or plugins. Prefer existing tools over bash scripts.
- Always use Context7 MCP (resolve-library-id → get-library-docs) before writing code involving external libraries or frameworks.
- ALWAYS call `search_past_bugs` before debugging any error. Call `search_references` before writing integration code. These check your verified fixes first — prioritize over Context7 and web search.
- After solving a bug that took >15 min: draft Symptom/Root Cause/Fix/Prevention, show me for review, then call `file_bug` to save it.
## Git Workflow
- Commit after each logical unit of work with conventional commit messages (feat:, fix:, refactor:, chore:).
- Do not push unless explicitly asked.
- Work on feature branches, never commit directly to main.
## Self-Improving Project CLAUDE.md
When I correct you on something that represents a recurring pattern or architectural decision (not a one-off typo), propose an update to the project's CLAUDE.md. Follow these rules:
**Before writing, check the existing file.** If a similar rule exists, replace or refine it — never duplicate. If the file exceeds 80 lines, identify a lower-value rule to remove before adding.
**How to write rules:**
1. Use absolute directives — start with NEVER or ALWAYS when appropriate
2. Lead with why (1 sentence max), then the concrete rule
3. Include actual commands or file:line references, not abstract descriptions
4. One code example max per rule. No example if the rule is obvious
5. Bullets over paragraphs. No "Warning Signs" sections for trivial rules
**When to update:** Only for corrections that would apply to future sessions — patterns, conventions, architectural decisions, recurring tool preferences. Not for one-off fixes, typos, or task-specific context.
**Two-tier structure:** If the project CLAUDE.md has a summary section at the top, add a one-line summary there and the detailed rule in the appropriate section below.
If the correction is about a library bug or integration pattern (not project-specific), use `file_bug` or `file_reference` instead of updating CLAUDE.md.
After proposing the update, wait for my approval before writing to the file.Test with MCP Inspector
npm run inspectThis opens the MCP Inspector UI where you can test each tool interactively.
How Indexing Works
On startup, the server:
Recursively finds all
.mdfiles underBRAIN_PATHParses YAML frontmatter for metadata (type, library, tags, severity, status)
Extracts structured sections (Symptom, Root Cause, Fix, Prevention) from bug files
Builds a BM25 index with field boosting:
symptom× 3.0 (highest — you search by what you see)title× 2.5library× 2.0rootCause× 1.5tags× 1.5fix× 1.0fullText× 1.0 (fallback for anything else)
Enables fuzzy matching (0.2 edit distance) and prefix search
Watches the directory for changes and auto-rebuilds
Adding New Bugs
Follow the format in your existing knowledge base:
# Create a new bug file
touch /Users/tk/Desktop/brain/code_failures/bugs/<library>-<short-description>.mdTemplate:
---
type: bug
library: <library name>
versions_affected: "<version range>"
status: confirmed
severity: critical|high|medium|low
tags:
- tag1
- tag2
---
# BUG: Short Description
## Symptom
What you see (error messages, behavior)
## Root Cause
Why it happens
## Fix
Working code
## Prevention
How to avoid itThe index auto-rebuilds when files change.
Available Tools
4 toolsfile_bugA
Save a newly discovered bug to the knowledge base. Call this AFTER solving a hard bug to capture the knowledge for future sessions. The file is written to code_failures/bugs/ and auto-indexed.
IMPORTANT: Show the user the generated content and get confirmation before calling.
| Name | Required | Description | Default |
|---|---|---|---|
| fix | Yes | Working solution with code examples | |
| tags | No | Tags for searchability | |
| title | Yes | Bug title (e.g. 'useCopilotChat returns undefined visibleMessages') | |
| library | Yes | Library/package name (e.g. 'copilotkit', 'starlette') | |
| symptom | Yes | What you observe — error messages, broken behavior | |
| severity | No | Bug severity | |
| rootCause | Yes | Why it happens — the underlying mechanism | |
| shortName | Yes | Kebab-case short description for filename (e.g. 'useCopilotChat-undefined-messages') | |
| prevention | No | How to avoid this in the future | |
| versionsAffected | No | Version range (e.g. '1.50.0 – 1.52.1') |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are present, so the description carries the full weight. It discloses the file write location ('code_failures/bugs/'), auto-indexing behavior, and the important user-confirmation requirement. However, it does not mention potential overwrite behavior for an existing shortName filename or any other edge-case side effects, so there is a slight gap for a write operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact yet informative: a clear purpose, a timing directive, storage details, and a crucial safety warning. Each sentence adds value without redundancy. The formatting with 'IMPORTANT' draws appropriate attention to the confirmation requirement, and the total length is appropriate for the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 10 parameters, all documented in the schema, and no output schema, the description provides all necessary context: what it does, when to use it, where it writes, and a critical user-confirmation step. The absence of return-value details is acceptable given there is no output schema, and the usage context is fully covered.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the base score is 3. The description adds no parameter-specific insights beyond what are already in the schema, but it also does not need to since every parameter has a clear description. The tool-level details like file location and confirmation are separate from parameter semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb-resource pair: 'Save a newly discovered bug to the knowledge base.' It clearly distinguishes from siblings like search_past_bugs and file_reference by targeting bug reports specifically. The mention of writing to 'code_failures/bugs/' and auto-indexing further clarifies its unique purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicit guidance is given: 'Call this AFTER solving a hard bug to capture the knowledge for future sessions.' It also includes a critical timing/consent directive: 'IMPORTANT: Show the user the generated content and get confirmation before calling.' This clearly indicates when to use the tool and the required prerequisite before invocation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
file_referenceA
Save a reference document (canonical pattern, version guide, architecture notes) to the knowledge base. Use this for working integration patterns, version compatibility matrices, and architectural decisions.
| Name | Required | Description | Default |
|---|---|---|---|
| tags | No | Tags for searchability | |
| title | Yes | Document title | |
| content | Yes | Full markdown content (without frontmatter — it will be generated) | |
| filename | Yes | Filename without extension (e.g. 'copilotkit-agui-langgraph-reference') |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must communicate behavior. It states 'Save' which indicates a write operation, but does not disclose side effects such as overwriting, duplicate handling, or permission requirements. The description is not misleading, but lacks depth beyond the core action.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two focused sentences. The first sentence states the purpose with examples, and the second lists specific use cases. Every sentence adds value, with no repetition or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has a simple 4-parameter schema and no output schema. The description covers the main purpose and use cases. However, it could be more complete by explicitly contrasting with sibling tools (e.g., 'for searching, use search_references') or clarifying what happens after saving (e.g., success message). Overall, it's sufficient for this low-complexity tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so all four parameters (tags, title, content, filename) are already documented in the schema. The description adds no extra parameter semantics beyond what the schema provides, so the baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Save' and the resource 'reference document' to the knowledge base, with examples of content types (canonical pattern, version guide, architecture notes). This distinguishes it from sibling tools like search_references (read) and file_bug (bug-specific write).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The second sentence provides explicit use cases: 'working integration patterns, version compatibility matrices, and architectural decisions.' It does not explicitly name alternatives, but the 'save' vs. 'search' contrast with siblings implies when to use this tool. A brief exclusion (e.g., 'for bugs use file_bug') would elevate it to a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_past_bugsA
Search your code_failures knowledge base for bugs you've already solved. Query with error messages, symptoms, library names, or keywords. Currently indexing 8 documents.
USE THIS TOOL BEFORE debugging any integration issue — your past self may have already spent hours finding the fix.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Error message, symptom description, or keywords (e.g. 'useCopilotChat undefined', 'SSE streaming broken FastAPI', 'BaseHTTPMiddleware') | |
| maxResults | No | Max results to return (default: 3) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must convey behavioral traits. It discloses that the knowledge base currently indexes 8 documents, giving a sense of coverage. It does not describe return format, error behavior, or performance characteristics, but for a read-only search tool, this is a minor gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is four sentences, each with a purpose: purpose, query guidance, indexing status, and usage recommendation. No redundant or vague phrases; front-loaded with the core function.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple two-parameter search tool with no output schema, the description covers purpose, query construction, and when to use it. The lack of return format details is not critical given the simplicity, but a bit more about result format would help.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with query and maxResults both having descriptive text including examples. The description adds context about what to query but does not add meaning beyond the schema; baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool searches a 'code_failures knowledge base' for bugs already solved, using the specific verb 'search' and naming the resource. It distinguishes itself from sibling tools like search_references and file_bug by focusing specifically on past bug fixes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly instructs to use this tool before debugging any integration issue, providing strong when-to-use guidance. It also lists appropriate query types (error messages, symptoms, library names, keywords). It does not explicitly contrast with sibling tools, but the directive is clear enough.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_referencesA
Search your code_failures knowledge base for canonical working patterns, version guides, and integration references.
USE THIS for questions like 'what's the correct CopilotKit + AG-UI setup?' or 'which versions are compatible?'
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Library name, concept, or integration pattern (e.g. 'copilotkit langgraph agui setup', 'version compatibility') | |
| maxResults | No | Max results to return (default: 3) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It explains the content scope (canonical patterns, version guides, integration references) but does not explicitly state that it is a read-only operation, what the response format is, or any potential limitations. The description adds some behavioral context but misses explicit safety/return disclosures expected without annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (two sentences) and front-loaded with the core action and resource. The 'USE THIS' section adds practical guidance without extraneous wording. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple search tool with two fully documented parameters and no output schema, the description provides sufficient context: what it searches, what kind of content, and example use cases. It could be more complete by mentioning the result format (e.g., list of reference snippets), but the named tool and examples make expectations reasonably clear.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already fully documents the 'query' and 'maxResults' parameters. The description's example queries align with the schema's parameter examples but do not add new semantic details beyond what is already in the input schema. Baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool's function: searching a 'code_failures knowledge base' for canonical working patterns, version guides, and integration references. This specific verb+resource combination distinguishes it from sibling tools like search_past_bugs (which targets bugs) and file_reference (which files references).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes 'USE THIS' with concrete example queries ('what's the correct CopilotKit + AG-UI setup?', 'which versions are compatible?'), providing clear context on when to use the tool. However, it does not explicitly state when NOT to use it or mention alternatives, leaving the differentiation to inference.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v1.0.0- First observed
file_bug - First observed
file_reference - First observed
search_past_bugs - First observed
search_references
TDQS
Each tool has a clearly distinct purpose: search_past_bugs targets bug records, search_references targets reference documents, and the two file tools similarly split between bugs and references. The descriptions explicitly define the boundary, so an agent should not confuse them.
All tools follow a verb_noun snake_case pattern with 'search' and 'file' as verbs. Minor inconsistency exists between 'past_bugs' (with modifier) and 'bug'/'reference' without modifiers, but the pattern is predictable.
Four tools is well-scoped for a knowledge base MCP: two search operations and two save operations covering the two content types. Each tool earns its place without redundancy or bloat.
The tool surface covers the core lifecycle: saving and searching both bugs and references. Missing update/delete operations are minor gaps that agents can work around by filing new entries, and the domain is simple enough that this does not cause failures.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
An MCP server that gives your AI access to the source code and docs of all public github repos
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that makes Claude Code conversation history searchable and proactively useful by indexing past sessions with hybrid BM25+TF-IDF search, extracting decisions and solutions, and auto-injecting relevant project context at session start.91265MIT
- AlicenseNot gradedqualityDmaintenanceA local MCP server that indexes and searches your Claude Code conversation history with both keyword and semantic search, fully private and running locally.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server providing RAG context and failure capture for Claude Code, enabling semantic search across project knowledge and storing/analyzing failures.1MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that provides persistent long-term memory for Claude Code, enabling storage, search, and retrieval of project knowledge across sessions.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/blueif16/code-failures-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server