Deploys the MCP server as a publicly accessible HTTP service on Render's EU region (Frankfurt) for integration with Claude Desktop
Uses Supabase as a caching layer and local database for storing 1.85M Swedish company records, company details cache (30-day TTL), document lists cache (7-day TTL), financial reports, and API request logs
Personupplysning MCP Server
MCP server för svensk företags- och persondata via Bolagsverket API och Supabase cache
Ett HTTP MCP-server som tillhandahåller sökfunktioner för svenska företag och hämtar detaljerad finansiell data från Bolagsverket, med lokal cache i Supabase för snabbare svar.
🚀 Features
Företagssökning - Sök bland 1.85M svenska företag i lokal databas
Företagsdetaljer - Hämta fullständig företagsinformation från Bolagsverket
Årsredovisningar - Ladda ner och parsera iXBRL årsredovisningar
Smart caching - Supabase cache-first strategi (30 dagar företagsdata, 7 dagar dokument)
HTTP MCP Server - Publikt tillgänglig via Render deployment
Local development - Stdio mode för lokal utveckling
📋 MCP Tools
Tool | Description | Cache |
| Sök företag lokalt (1.85M) | Lokal DB |
| Hämta företagsinfo | 30 dagar |
| Lista årsredovisningar | 7 dagar |
| Hämta iXBRL årsredovisning | Permanent |
| Cache-statistik | - |
🏗️ Architecture
🛠️ Installation
Prerequisites
Node.js 18+ och npm
Supabase project (gratis tier fungerar)
Bolagsverket API credentials (portal.api.bolagsverket.se)
Local Development
Clone repository:
Install dependencies:
Setup environment:
Setup database:
Import company data (optional):
Run in stdio mode (local):
🌐 Render Deployment
Deploy to Render
Push to GitHub:
Create Render service:
Go to dashboard.render.com
Click "New +" → "Web Service"
Connect your GitHub repository
Render will detect
render.yamlautomatically
Configure environment variables:
Add these in Render dashboard (Environment):
Deploy:
Render will automatically build and deploy
Your MCP server will be available at:
https://personupplysning-mcp.onrender.com/mcp
Connect from Claude Desktop
Add to your Claude Desktop MCP config (claude_desktop_config.json):
Note: The server uses SSE (Server-Sent Events) transport with two endpoints:
GET /sse- Establishes SSE connectionPOST /messages?sessionId=<id>- Sends JSON-RPC messages
📁 Project Structure
🔧 Configuration
Environment Variables
Variable | Description | Required |
| Environment (
/
) | Yes |
| Transport mode (
/
) | Yes |
| HTTP server port (default: 3000) | HTTP only |
| Bind address (default: 0.0.0.0) | HTTP only |
| Supabase project URL | Yes |
| Supabase service role key | Yes |
| Bolagsverket OAuth2 client ID | Yes |
| Bolagsverket OAuth2 client secret | Yes |
Cache TTL Configuration
Cache expiration kan konfigureras i src/services/company-data-service.ts:
📊 Database Schema
Tables
companies- 1.85M svenska företag (lokal kopia)company_details_cache- API-svar från Bolagsverket (30 dagar TTL)company_documents_cache- Dokumentlistor (7 dagar TTL)financial_reports- Parsad finansiell data från iXBRLapi_request_log- Request logging och analytics
Storage
company-documentsbucket - Lagrar nedladdade iXBRL ZIP-filer
🧪 Testing
Run tests:
Test specific file:
Test API connection:
📝 Development Scripts
Script | Description |
| Compile TypeScript →
|
| Run in stdio mode (local) |
| Run compiled JS (production) |
| Run test suite |
| Setup Supabase schema |
| Import 1.85M companies |
🔒 Security
OAuth2 tokens cached with 1-minute safety buffer before expiry
Service role key required for Supabase (never expose publicly)
API credentials stored in environment variables only
GDPR compliance - EU Render region (Frankfurt)
No personal data persisted without consent
📈 Performance
Cache hit rate: ~95% after warm-up
Local search: < 100ms (Supabase full-text search)
Cached company details: < 50ms
Fresh API call: 1-3 seconds (Bolagsverket rate limits)
iXBRL download: 2-5 seconds (depends on file size)
🐛 Troubleshooting
Health Check Fails
Check endpoint:
Expected response:
MCP Connection Issues
Check Render logs for startup errors
Verify all environment variables are set
Test health endpoint first
Check Claude Desktop logs (
~/Library/Logs/Claude/)
Database Connection Failed
Bolagsverket API 401/403
Verify credentials in Render environment
Check token expiry (should auto-refresh)
Ensure OAuth2 scope:
vardefulla-datamangder:ping vardefulla-datamangder:read
📜 License
MIT
🤝 Contributing
Contributions welcome! Please follow these steps:
Fork the repository
Create feature branch (
git checkout -b feature/amazing-feature)Commit changes (
git commit -m 'Add amazing feature')Push to branch (
git push origin feature/amazing-feature)Open Pull Request
📧 Support
For issues or questions:
Open a GitHub issue
Check existing issues first
Built with: TypeScript, MCP SDK, Supabase, Bolagsverket API Deployed on: Render (EU region - Frankfurt)