FreshStack MCP
Verifies FastAPI code against the project's resolved dependency version, detecting deprecated patterns such as lifespan handlers and Pydantic v2 schema usage with authoritative evidence.
Detects deprecated Pydantic v1 APIs and provides version-correct replacements such as model_dump, model_validate, ConfigDict, and field/model validators based on the project's actual Pydantic version.
Audits SQLAlchemy usage against the resolved version, promoting 2.0-style queries, DeclarativeBase, mapped_column, and session.execute(select(...)) while flagging incompatible or deprecated patterns.
Click on "Deploy 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., "@FreshStack MCP Audit our codebase for deprecated Pydantic v1 APIs."
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.
FreshStack MCP
Evidence-backed technology intelligence layer for AI coding agents.
Prevents AI coding assistants from generating outdated, deprecated, or version-incompatible code.
The Problem
AI coding assistants frequently generate code using outdated syntax, deprecated methods, or incompatible library versions because their parametric memory lacks real-time awareness of:
The project's actual, resolved dependency versions in lockfiles.
Official deprecation cycles and migration guides (e.g., Pydantic v1 vs. v2, SQLAlchemy 1.4 vs. 2.0, FastAPI lifespan vs.
@app.on_event).Exact version compatibility boundaries.
Related MCP server: closeread-verify
Core Principle: Evidence Priority
FreshStack does NOT guess or decide what is "modern" from parametric memory.
It verifies technology information strictly against authoritative sources according to an explicit hierarchy:
Actual project state and resolved dependency versions (
uv.lock, pinnedrequirements.txt,pyproject.toml)Official version-specific documentation
Official migration guides
Official changelogs
Official package registry metadata (PyPI)
Other authoritative sources
LLM knowledge only when no stronger evidence exists
The Golden Rule: The project's resolved dependency version has absolute priority over the latest available package version. If a project is pinned to FastAPI
0.115.x, FreshStack never blindly enforces documentation from an incompatible newer release.
MVP Scope (Python)
Supported Project Manifests & Lockfiles
uv.lockpyproject.toml(PEP 621 & Poetry)requirements.txt
Supported Target Packages
FastAPI (Lifespan handlers, Pydantic v2 schemas)
Pydantic (
model_dump,model_validate,model_config = ConfigDict,@field_validator,@model_validator)SQLAlchemy (2.0 style queries,
DeclarativeBase,mapped_column,session.execute(select(...)))Alembic (1.12+ connection context migrations)
Architecture & Module Structure
freshstack-mcp/
├── freshstack/
│ ├── __init__.py # Package entry and version
│ ├── config.py # Environment variables, logging, cache path configuration
│ ├── models.py # Pydantic v2 schemas (StackInfo, EvidenceSource, AuditViolation)
│ ├── cache.py # Local SQLite database abstraction with TTL
│ ├── inspect.py # Stack inspection (uv.lock, pyproject.toml, requirements.txt)
│ ├── pypi.py # PyPI registry metadata client with local caching
│ ├── knowledge.py # Authoritative version rules & official documentation citations
│ ├── resolve.py # Constraint resolution pipeline (VERIFIED, INFERRED, UNKNOWN)
│ ├── audit.py # Deterministic AST static analysis and violation detection
│ └── server.py # FastMCP / MCPServer stdio transport server
├── tests/
│ ├── fixtures/ # Sample lockfiles and manifests (uv.lock, pyproject.toml, requirements.txt)
│ ├── test_inspect.py # Stack inspection unit tests
│ ├── test_cache.py # SQLite cache and TTL tests
│ ├── test_resolve.py # Constraint resolution and priority tests
│ ├── test_audit.py # Deterministic AST audit tests
│ └── test_server.py # MCP server tool execution tests
├── pyproject.toml # Modern PEP 621 configuration (uv-compatible)
├── CONTRIBUTING.md # Development and contribution standards
├── LICENSE # MIT License
├── .env.example # Configuration templates
└── .gitignore # Clean source control patternsMCP Capabilities & Tools
1. inspect_stack(project_dir: str = ".") -> str
Detects project metadata, Python version, package manager (uv, poetry, pip), and exact resolved versions for all supported libraries.
Example Response:
{
"project_name": "sample-service",
"python_version": ">=3.10",
"package_manager": "uv",
"detected_files": ["uv.lock", "pyproject.toml"],
"supported_libraries": {
"fastapi": "0.115.0",
"pydantic": "2.9.2",
"sqlalchemy": "2.0.35",
"alembic": "1.13.3"
}
}2. resolve_constraints(task_description: str, libraries: list = None, project_dir: str = ".") -> str
Given a developer task and target libraries, determines active version constraints, deprecated APIs, recommended replacements, and authoritative evidence citations.
Example Output (excerpt):
{
"confidence": "VERIFIED",
"deprecated_patterns": [
{
"name": "BaseModel.dict()",
"status": "deprecated",
"reason": ".dict() is deprecated in Pydantic v2. Use .model_dump() instead.",
"replacement": "model.model_dump(mode='python')",
"evidence": {
"source_type": "migration_guide",
"title": "Pydantic V2 Migration Guide - Model Methods",
"url": "https://docs.pydantic.dev/latest/migration/#changes-to-pydanticbasemodel"
}
}
]
}3. freshness_audit(code: str, project_dir: str = ".") -> str
Analyzes generated or developer-written Python code using deterministic static AST analysis. Pinpoints exact line numbers, columns, severity, rationale, and authoritative evidence for deprecated or incompatible APIs.
Local-First Privacy Guarantee
FreshStack is designed with privacy as a foundational requirement:
Local AST Analysis: Code parsing occurs on the local machine via Python's
astmodule.No Secret Transmission: API keys, passwords, environment variables, and unrelated codebase files are never transmitted externally.
Offline Capable: Operates seamlessly in offline environments using the local SQLite evidence cache.
Getting Started
Installation
Clone the repository and install with uv:
git clone https://github.com/freshstack/freshstack-mcp.git
cd freshstack-mcp
# Create virtual environment and install
uv venv .venv
uv pip install -e ".[dev]"Running the MCP Server
Start the server using stdio transport:
uv run freshstackOr run via Python directly:
python -m freshstack.serverIntegrating with Claude Desktop / Cursor
Add FreshStack to your claude_desktop_config.json:
{
"mcpServers": {
"freshstack": {
"command": "uv",
"args": [
"--directory",
"/path/to/freshstack-mcp",
"run",
"freshstack"
]
}
}
}Running Tests
Execute the complete test suite:
uv run pytest -vAvailable Tools
3 toolsfreshness_auditA
Analyze Python code to detect deprecated APIs, version mismatches, and outdated patterns.
Uses deterministic static AST analysis grounded in authoritative documentation.
Args: code: Python source code snippet or module to audit. project_dir: Root directory of the Python project to ground version context against.
Returns: JSON string containing FreshnessAuditReport with detected violations, severity, and replacements.
Inputs: code (required), project_dir. Returns: result
inspect_stackA
Detect Python version, package manager, resolved dependencies, and supported libraries.
Args: project_dir: Root directory of the Python project to inspect (defaults to current directory).
Returns: JSON string containing StackInfo with resolved versions and evidence sources.
Inputs: project_dir. Returns: result
resolve_constraintsA
Determine exact project dependency versions and retrieve authoritative version-specific constraints.
Identifies version-specific APIs, deprecated/forbidden patterns, recommended patterns, and authoritative evidence sources (documentation URLs, changelogs).
Args: task_description: Description of the coding task or feature to implement. libraries: Optional list or mapping of specific libraries to inspect (e.g. ['fastapi', 'pydantic']). project_dir: Root directory of the Python project (defaults to current directory).
Returns: JSON string containing ResolvedConstraints with verified rules and evidence.
Inputs: task_description (required), libraries, project_dir. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct role: one inspects the environment, one resolves authoritative constraints for a task, and one audits existing code. The only conceptual overlap (deprecated patterns in resolve_constraints and freshness_audit) is separated by input type and purpose.
inspect_stack and resolve_constraints follow a clear verb_noun pattern, but freshness_audit uses a noun_noun form and breaks the convention. The overall set is still readable and predictable.
Three tools is well-scoped for a focused analysis and guidance server, covering environment discovery, constraint resolution, and code audit without redundancy. Each tool earns its place.
The workflow is complete for its apparent domain: inspect the stack, resolve version-specific rules, then audit code against them. No dead ends remain because the audit returns violations and replacements; a remediation/write tool would be outside this server's stated analysis scope.
Maintenance
Related MCP Connectors
Open-source licence risk checks for AI coding agents and dependency trees.
CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.
CVE lookups (NVD) and dependency-manifest audits (OSV) for AI agents. No API keys.
Real-time package and vulnerability data (Python, npm, Cargo, Go, and more) for AI coding agents.
Related MCP Servers
- AlicenseAqualityCmaintenanceChecks npm and PyPI packages for outdated versions, deprecation status, and breaking changes with cited sources, enabling AI agents to verify dependency freshness.1ISC
- AlicenseAqualityDmaintenanceProvides verified dependency-audit verdicts for AI agents, checking installed versions against OSV advisories and splitting direct vs transitive dependencies.3MIT
- FlicenseAqualityDmaintenanceProvides AI coding agents with dependency analysis, impact detection, and build verification tools.14-
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to identify exactly what broke between two dependency versions, with citations for every claim, and to verify package existence to catch typosquatting, all without requiring an API key.MIT