Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

stackoverflow-mcp

MCP.Pizza Chef: gscalzo

Stackoverflow-mcp is a Model Context Protocol server that enables AI models to query Stack Overflow for programming solutions. It supports searching by error messages, tags, and stack traces, filtering by votes, and returns results in JSON or Markdown. This server helps integrate real-time, relevant programming knowledge into AI workflows.

Use This MCP server To

Search Stack Overflow for error message solutions Filter programming Q&A by language and technology tags Analyze stack traces to find related Stack Overflow posts Retrieve high-vote answers and comments for coding issues Provide JSON or Markdown formatted programming help Integrate Stack Overflow knowledge into AI coding assistants Enable AI models to access real-time developer community insights

README

Stackoverflow MCP Server

A Model Context Protocol server for querying Stack Overflow. This server helps AI models find solutions to programming problems by searching Stack Overflow questions and answers.

Features

  • Search by error messages
  • Search by programming language and technology tags
  • Stack trace analysis
  • Filter results by score/votes
  • Include question and answer comments
  • Output in JSON or Markdown format

Installation

You can run the server directly using npx:

npx -y @gscalzo/stackoverflow-mcp

Or install it globally:

npm install -g @gscalzo/stackoverflow-mcp

Configure the Server

Create or modify your MCP settings file:

  • For Claude.app: ~/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  • For Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json

Add the following configuration:

{
  "mcpServers": {
    "stackoverflow": {
      "command": "npx",
      "args": ["-y", "@gscalzo/stackoverflow-mcp"],
      "env": {
        "STACKOVERFLOW_API_KEY": "your-api-key-optional"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

Optional: Stack Overflow API Authentication

The server works without authentication but has rate limits. To increase the rate limits:

  1. Get an API key from Stack Apps
  2. Add the API key to your MCP settings configuration

Usage

The server provides three main tools:

1. search_by_error

Searches Stack Overflow for error-related questions:

interface SearchByErrorInput {
  errorMessage: string;          // Required: Error message to search for
  language?: string;            // Optional: Programming language
  technologies?: string[];      // Optional: Related technologies
  minScore?: number;           // Optional: Minimum score threshold
  includeComments?: boolean;    // Optional: Include comments in results
  responseFormat?: "json" | "markdown"; // Optional: Response format
  limit?: number;              // Optional: Maximum number of results
}

2. search_by_tags

Searches Stack Overflow questions by tags:

interface SearchByTagsInput {
  tags: string[];              // Required: Tags to search for
  minScore?: number;          // Optional: Minimum score threshold
  includeComments?: boolean;   // Optional: Include comments in results
  responseFormat?: "json" | "markdown"; // Optional: Response format
  limit?: number;             // Optional: Maximum number of results
}

3. analyze_stack_trace

Analyzes stack traces to find relevant solutions:

interface StackTraceInput {
  stackTrace: string;          // Required: Stack trace to analyze
  language: string;           // Required: Programming language
  includeComments?: boolean;   // Optional: Include comments in results
  responseFormat?: "json" | "markdown"; // Optional: Response format
  limit?: number;             // Optional: Maximum number of results
}

Examples

Searching by Error Message

{
  "name": "search_by_error",
  "arguments": {
    "errorMessage": "TypeError: Cannot read property 'length' of undefined",
    "language": "javascript",
    "technologies": ["react"],
    "minScore": 5,
    "includeComments": true,
    "responseFormat": "markdown",
    "limit": 3
  }
}

Searching by Tags

{
  "name": "search_by_tags",
  "arguments": {
    "tags": ["python", "pandas", "dataframe"],
    "minScore": 10,
    "includeComments": true,
    "responseFormat": "json",
    "limit": 5
  }
}

Analyzing Stack Trace

{
  "name": "analyze_stack_trace",
  "arguments": {
    "stackTrace": "Error: ENOENT: no such file or directory, open 'config.json'\n    at Object.openSync (fs.js:476:3)\n    at Object.readFileSync (fs.js:377:35)",
    "language": "javascript",
    "includeComments": true,
    "responseFormat": "markdown",
    "limit": 3
  }
}

Response Format

JSON Output

Responses include:

  • Question details (title, body, score, tags, etc.)
  • Answers (sorted by votes)
  • Optional comments for both questions and answers
  • Links to the original Stack Overflow posts

Markdown Output

The markdown format provides a nicely formatted view with:

  • Question title and score
  • Question body
  • Comments (if requested)
  • Answers with acceptance status and score
  • Answer comments (if requested)
  • Links to the original posts

Development

  1. Build in watch mode:
npm run watch
  1. Run tests:
npm test

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT

stackoverflow-mcp FAQ

How do I install the stackoverflow-mcp server?
You can install it globally via npm with 'npm install -g @gscalzo/stackoverflow-mcp' or run it directly using 'npx -y @gscalzo/stackoverflow-mcp'.
How can I configure the stackoverflow-mcp server for use with Claude.app?
Modify the MCP settings file at '~/Library/Application Support/Cursor/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json' to include the stackoverflow server configuration.
What output formats does stackoverflow-mcp support?
It supports JSON and Markdown output formats for flexible integration with various AI workflows.
Can stackoverflow-mcp filter search results?
Yes, it can filter results by score/votes to prioritize high-quality answers.
Does stackoverflow-mcp support searching by stack trace?
Yes, it includes stack trace analysis to find relevant Stack Overflow posts related to the error.
Is stackoverflow-mcp limited to specific programming languages?
No, it supports searching by multiple programming languages and technology tags to cover a wide range of developer queries.
Can I include comments from questions and answers in the results?
Yes, the server can include comments to provide additional context from the Stack Overflow community.
How does stackoverflow-mcp enhance AI coding assistants?
By providing real-time access to community-vetted programming solutions, it helps AI models generate more accurate and context-aware code suggestions.