StackOverflow MCP server for querying programming Q&A using FastMCP - npx wrapper for Python package
npm install @notalk-tech/stackoverflow-mcp

A Model Context Protocol (MCP) server that provides seamless access to StackOverflow's programming Q&A database using the FastMCP framework. This package serves as an NPX-compatible wrapper for the Python-based StackOverflow MCP server.
``bashRun directly with npx (no installation required)
npx @notalk/stackoverflow-mcp
$3
`bash
If you have the Python package installed
python -m stackoverflow_mcpUsing uv (recommended for Python development)
uv run python -m stackoverflow_mcp
`๐ Prerequisites
- Node.js 14.0.0 or higher
- Python 3.12 or higher
- uv (recommended) or pip (Python package manager)
The NPX wrapper will automatically:
- Detect your Python installation
- Install the required Python package (
stackoverflow-mcp)
- Handle environment setup and configurationInstallation
$3
`bash
npx @notalk/stackoverflow-mcp --help
`$3
`bash
npm install -g @notalk/stackoverflow-mcp
stackoverflow-mcp --help
`$3
`bash
git clone https://github.com/NoTalkTech/stackoverflow-mcp.git
cd stackoverflow-mcp
npm install
node cli.js --help
`๐ฏ Features
- ๐ Question Search: Search StackOverflow questions by keywords
- ๐ Question Details: Get detailed question content, answers, and metadata
- ๐ท๏ธ Tag-based Search: Find questions by programming language tags
- โก Rate Limit Management: Automatic detection and handling of API limits
- ๐ API Authentication: Support for StackOverflow API keys
- ๐ Auto-deployment: NPX-compatible with automatic Python environment setup
- ๐ Smart Configuration: Auto-discovery of config files and working directories
- ๐ง Development Mode: Enhanced logging and debugging features
- โก FastMCP Implementation: Simplified, elegant server using FastMCP framework (only implementation)
Usage
$3
`bash
Start the MCP server with default settings
npx @notalk/stackoverflow-mcpAuto-confirm installation (useful for scripts/CI)
npx -y @notalk/stackoverflow-mcpStart on a specific port
npx @notalk/stackoverflow-mcp --port 8080Development mode with debug logging
npx @notalk/stackoverflow-mcp --dev --log-level DEBUGUse custom configuration file
npx @notalk/stackoverflow-mcp --config-file ./my-config.json
`$3
For Python development, we recommend using uv for faster dependency management:
`bash
Install dependencies with uv
uv syncRun the server with uv
uv run python -m stackoverflow_mcpDevelopment mode with uv
uv run python -m stackoverflow_mcp --log-level DEBUG
`FastMCP Benefits:
- ๐ฅ Simplified Code: Clean, maintainable implementation
- ๐ฏ Decorator-based: Clean tool registration with
@mcp.tool()
- ๐ Auto-schema: Type hints automatically generate schemas
- ๐ก๏ธ Built-in Error Handling: Consistent error responses
- ๐ฆ Better Separation: Clean architecture with focused responsibilities$3
Create a
.stackoverflow-mcp.json file in your project directory:`json
{
"host": "localhost",
"port": 3000,
"log_level": "INFO",
"stackoverflow_api_key": "your_api_key_here"
}
`$3
`
Options:
--host TEXT Host to bind the server to
--port INTEGER Port to bind the server to (auto-detect if not specified)
--log-level [DEBUG|INFO|WARNING|ERROR]
Logging level
--config-file PATH Path to configuration file (auto-discover if not specified)
--working-dir DIRECTORY Working directory (auto-detect if not specified)
--auto-port / --no-auto-port Automatically find an available port if specified port is in use
--dev / --prod Run in development mode (more verbose logging, auto-reload)
--health-check / --no-health-check
Enable startup health checks
--version Show the version and exit.
--help Show this message and exit.
`๐ง Configuration Files
The server automatically discovers configuration files in the following order:
1.
.stackoverflow-mcp.json
2. stackoverflow-mcp.config.json
3. config/stackoverflow-mcp.json
4. .config/stackoverflow-mcp.json$3
`json
{
"host": "localhost",
"port": 3000,
"log_level": "INFO",
"stackoverflow_api_key": "your_optional_api_key",
"max_requests_per_minute": 30,
"enable_caching": true
}
`๐ API Endpoints
Once running, the MCP server provides the following tools:
-
search_questions: Search StackOverflow questions by keywords
- get_question_details: Get detailed information about a specific question
- search_by_tags: Find questions filtered by programming language tags
- get_user_info: Get information about StackOverflow users๐งช Testing
`bash
Test the npm package
npm testTest npm packaging
npm run test:npmTest global installation
npm run test:installTest Python module directly
python -m pytest tests/ -v
`๐ Development
$3
`bash
Clone the repository
git clone https://github.com/NoTalkTech/stackoverflow-mcp.git
cd stackoverflow-mcpInstall Node.js dependencies
npm installInstall Python dependencies
pip install -e .Run in development mode
npm start -- --dev
`$3
`
@notalk/stackoverflow-mcp/
โโโ cli.js # NPX wrapper (Node.js)
โโโ package.json # NPM package configuration
โโโ src/stackoverflow_mcp/ # Python MCP server
โ โโโ __main__.py # Python module entry point
โ โโโ main.py # CLI and server management
โ โโโ server.py # MCP server implementation
โ โโโ stackoverflow_client.py # StackOverflow API client
โโโ tests/ # Test files
โโโ README.md # This file
`๐ฆ Publishing
$3
This package follows Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
$3
`bash
Update version
npm version patch|minor|majorPublish to npm
npm publishCreate GitHub release
git push --tags
`๐ค Contributing
1. Fork the repository
2. Create a feature branch (
git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'Add amazing feature')
4. Push to the branch (git push origin feature/amazing-feature`)This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Documentation: GitHub Wiki
- Discussions: GitHub Discussions
- Model Context Protocol for the MCP specification
- StackOverflow for providing the API
- The open-source community for inspiration and contributions
---
Made with โค๏ธ for the developer community