SF Permits MCP Server
Provides access to San Francisco public permitting, business, and property data through the Socrata SODA API. Users can search permit details, aggregate statistics, and look up property assessments using natural language.
README
SF Permits MCP Server
MCP server that exposes San Francisco public permitting data to Claude. Built with FastMCP and the Socrata SODA API.
Phase 1 of a larger project that will add fraud detection (social network analysis of permit actors) and permit facilitation.
Tools
| Tool | Description |
|---|---|
search_permits |
Search building permits by neighborhood, type, status, cost, date, address, or description |
get_permit_details |
Get full details for a specific permit by permit number |
permit_stats |
Aggregate statistics grouped by neighborhood, type, status, month, or year |
search_businesses |
Search registered business locations in SF |
property_lookup |
Look up property assessments by address or block/lot |
Data Sources
All data from DataSF (San Francisco Open Data) via the Socrata SODA API. 22 datasets cataloged covering:
- Permits: Building (1.3M), Plumbing (513K), Electrical (344K), Boiler (152K), Street-Use (1.2M)
- Contacts: Building Permits Contacts (1M records, 11 actor types), Electrical Contacts (340K), Plumbing Contacts (503K)
- Violations: Building Inspections (671K), DBI Complaints (326K), Notices of Violation (509K)
- Enrichment: Business Locations (354K), Property Tax Rolls (3.7M), Development Pipeline, Housing Production
See datasets/CATALOG.md for the full catalog and docs/contact-data-report.md for the contact/actor data analysis.
Setup
# Clone
git clone https://github.com/tbrennem-source/sf-permits-mcp.git
cd sf-permits-mcp
# Install dependencies
pip install -e ".[dev]"
# Optional: set SODA app token for higher rate limits
export SODA_APP_TOKEN="your_token_here"
# Run the MCP server
python -m src.server
Architecture
Claude (claude.ai / Claude Code)
↓ MCP tool call
SF Permits MCP Server (FastMCP)
↓ HTTP GET (SoQL)
data.sfgov.org SODA API
↓ JSON response
MCP Server formats + returns
↓ structured results
Claude renders for user
Key Files
src/
├── server.py # FastMCP entry point, tool registration
├── soda_client.py # Async SODA API client (httpx)
├── formatters.py # Response formatting for Claude consumption
└── tools/
├── search_permits.py
├── get_permit_details.py
├── permit_stats.py
├── search_businesses.py
└── property_lookup.py
Tests
# Run integration tests (hits live API)
pytest tests/ -v
Performance
Benchmarks run against the live SODA API (see benchmarks/RESULTS.md):
- Single lookups: ~500ms
- Filtered searches: ~600-720ms
- Aggregations: ~600ms warm cache, 10-14s cold cache on large datasets
- Full-text search: ~600ms-1.4s (most datasets)
The API is sufficient for interactive use. Aggregation results should be cached for production.
Project Phases
- [x] Phase 1: MCP server + dataset catalog + benchmarks ← you are here
- [ ] Phase 2: Local storage decision, contacts data ingestion
- [ ] Phase 3: Fraud detection prototype (social network analysis using Mehri model)
- [ ] Phase 4: Predictive analytics, Railway deployment
Decisions
See docs/DECISIONS.md for architecture decisions including:
- Why we built from scratch vs. forking existing Socrata MCP servers
- Custom SODA client vs. sodapy
- NIXPACKS deployment strategy
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.