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.
# Run directly with npx (no installation required)
npx @notalk-tech/stackoverflow-mcp
# Skip installation prompts (useful for automation)
npx -y @notalk-tech/stackoverflow-mcp
# Or install globally
npm install -g @notalk-tech/stackoverflow-mcp
stackoverflow-mcp# If you have the Python package installed
python -m stackoverflow_mcp
# Using uv (recommended for Python development)
uv run python -m stackoverflow_mcpTo add StackOverflow MCP as a Model Context Protocol server in Cursor, add the following configuration to your Cursor settings:
{
"mcp_servers": {
"stackoverflow": {
"command": "npx",
"args": [
"-y",
"@notalk-tech/stackoverflow-mcp",
"--api-key", "your_stackoverflow_api_key",
]
}
}
}- 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-fastmcp) - Handle environment setup and configuration
npx @notalk-tech/stackoverflow-mcp --helpnpm install -g @notalk-tech/stackoverflow-mcp
stackoverflow-mcp --helpgit clone https://github.com/NoTalkTech/stackoverflow-mcp.git
cd stackoverflow-mcp
npm install
node cli.js --help- π 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
This server is specifically designed to operate in Model Context Protocol (MCP) mode, which means:
- Communication occurs through standard input/output (stdio) rather than HTTP
- The server integrates seamlessly with AI assistants supporting the MCP standard
- No traditional server ports or network connections are used
- The server provides a consistent, structured interface for querying StackOverflow
MCP mode makes this tool ideal for integration with AI models, allowing them to search and retrieve programming knowledge programmatically.
# Start the MCP server with default settings
npx @notalk-tech/stackoverflow-mcp
# Auto-confirm installation (useful for scripts/CI)
npx -y @notalk-tech/stackoverflow-mcp
# Provide an API key directly
npx @notalk-tech/stackoverflow-mcp --api-key your_stackoverflow_api_key
# Specify a working directory
npx @notalk-tech/stackoverflow-mcp --working-dir /path/to/your/projectFor Python development, we recommend using uv for faster dependency management:
# Install dependencies with uv
uv sync
# Run the server with uv
uv run python -m stackoverflow_mcp
# Run with API key
uv run python -m stackoverflow_mcp --api-key your_stackoverflow_api_keyFastMCP 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
Create a .stackoverflow-mcp.json file in your project directory:
{
"stackoverflow_api_key": "your_api_key_here",
"log_level": "CRITICAL"
}Options:
--working-dir DIRECTORY Working directory (auto-detect if not specified)
--api-key TEXT StackOverflow API key
--version Show the version and exit.
--help Show this message and exit.
The server automatically discovers configuration files in the following order:
.stackoverflow-mcp.jsonstackoverflow-mcp.config.jsonconfig/stackoverflow-mcp.json.config/stackoverflow-mcp.json
Once running, the MCP server provides the following tools:
search_questions: Search StackOverflow questions by keywordssearch_by_tags: Find questions filtered by programming language tagsget_question: Get detailed information about a specific questionget_question_with_answers: Get comprehensive question details including answersget_rate_limit_status: Get current rate limiting status and quotasget_authentication_status: Get current API authentication statusget_queue_status: Get current request queue status and statistics
# Test the npm package
npm test
# Test npm packaging
npm run test:npm
# Test global installation
npm run test:install
# Test Python module directly
python -m pytest tests/ -v# Clone the repository
git clone https://github.com/NoTalkTech/stackoverflow-mcp.git
cd stackoverflow-mcp
# Install Node.js dependencies
npm install
# Install Python dependencies
pip install -e .
# Run in development mode
npm start@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
This package follows Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
- Python Package:
stackoverflow-fastmcpv0.2.6 - NPM Package:
@notalk-tech/stackoverflow-mcpv1.2.5
When publishing new versions, it's important to keep version numbers synchronized:
- Python Package Version: Defined in
src/stackoverflow_mcp/__init__.pyandpyproject.toml - NPM Package Version: Defined in
package.json - CLI Version Reference: Defined in
cli.js(expectedVersion variable)
All three should be updated together when making a release to ensure consistency.
This project provides a unified publishing script to simultaneously release both NPM and Python packages.
# Option 1: Using the publish script (recommended)
./publish.sh # Publish both NPM and Python packages
./publish.sh --npm-only # Publish only the NPM package
./publish.sh --pypi-only # Publish only the Python package
./publish.sh --dry-run # Test the publishing process without actual uploads
# Option 2: Manual process
# Update version
npm version patch|minor|major
# Publish to npm
npm publish
# Create GitHub release
git push --tags- PyPI API token (environment variable
PYPI_API_TOKENor configured in~/.pypirc) - NPM authentication (
npm loginor using automation tokens) - Git credentials for pushing tags
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
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