isakskogstad/Merinfo.se-MCP
If you are the rightful owner of Merinfo.se-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Merinfo MCP Server is a Model Context Protocol server designed to provide comprehensive Swedish business intelligence by combining web scraping with intelligent caching.
Merinfo MCP Server
🇸🇪 Model Context Protocol server for Swedish company information from merinfo.se and allabolag.se.
A production-ready MCP server that combines web scraping with intelligent caching to provide AI assistants with comprehensive Swedish business intelligence.
✨ Features
🔧 12 MCP Tools
search_company_by_org_number- Search by Swedish organization numberget_company_details- Retrieve cached company datasearch_companies_by_industry- Filter by SNI code or categorysearch_company_by_name- Full-text searchget_board_members- Board member and management detailssearch_person- Search people across all companiesget_financial_data- Financial metrics and ratiosget_tax_information- Tax registration statusget_cached_companies- List cached data with filtersupdate_company_data- Force refresh company dataclear_cache- Cache management (admin)get_cache_stats- Database health metrics
📦 5 MCP Resources
company://{org_number}- Direct company accesscompanies://recent?limit=N- Recently scraped companiescompanies://search?q={query}- Search resultscompanies://industry/{sni_code}- Industry listingsstats://cache- Cache statistics
💬 4 MCP Prompts
analyze-company- Financial health assessmentcompare-companies- Side-by-side comparisonindustry-overview- Market analysis by SNI codedue-diligence- Comprehensive due diligence report
🚀 Advanced Features
- ✅ Intelligent caching with SQLite (30-day TTL)
- ✅ Rate limiting (10 requests/minute to merinfo.se)
- ✅ Exponential backoff with retry logic
- ✅ Playwright browser pool for stable scraping
- ✅ Full-text search with FTS5
- ✅ Structured logging with Pino
- ✅ Input validation with Zod schemas
- ✅ TypeScript for type safety
- ✅ Health checks for production deployment
📋 Data Collected
Company Information
- Basic details (name, org number, legal form, status)
- Contact info (phone, address, municipality, county)
- Tax registrations (F-skatt, VAT, employer)
- Financial data (revenue, profit, assets)
- Industry classification (SNI codes, categories)
- Activity description
- Board members and management
Board Members
- Name, role, age
- Contact details
- Address information
- Multiple roles supported (VD, Ordförande, Styrelseledamot, etc.)
🏗️ Architecture
merinfo-mcp/
├── src/
│ ├── index.ts # Main MCP server (STDIO)
│ ├── streamable-http-server.ts # HTTP/SSE server (Render)
│ ├── types.ts # TypeScript interfaces
│ ├── scraper/
│ │ ├── browser.ts # Playwright pool management
│ │ └── merinfo.ts # Scraping logic
│ ├── cache/
│ │ ├── database.ts # SQLite operations
│ │ └── schema.ts # Database schema
│ ├── utils/
│ │ ├── rate-limiter.ts # Token bucket + backoff
│ │ ├── parsers.ts # Swedish data parsers
│ │ ├── validators.ts # Zod schemas
│ │ └── logger.ts # Pino logging
│ └── server/
│ ├── tools.ts # MCP tool implementations
│ ├── resources.ts # MCP resource handlers
│ └── prompts.ts # MCP prompt templates
├── scripts/
│ └── setup-db.ts # Database initialization
└── data/
└── merinfo.db # SQLite database (auto-created)
🚀 Quick Start
Prerequisites
- Node.js 18+
- npm or yarn
- Playwright browsers (auto-installed)
Installation
# Clone repository
git clone https://github.com/YOUR_USERNAME/merinfo-mcp.git
cd merinfo-mcp
# Install dependencies
npm install
# Setup database
npm run setup-db
# Start development server
npm run dev
Configuration
Copy .env.example to .env and customize:
cp .env.example .env
Key settings:
DATABASE_PATH=./data/merinfo.db
PLAYWRIGHT_HEADLESS=true
RATE_LIMIT_SCRAPING_RPM=10
CACHE_TTL_DAYS=30
LOG_LEVEL=info
Usage with MCP Clients
Claude Desktop (Mac/Windows)
Add to claude_desktop_config.json:
{
"mcpServers": {
"merinfo": {
"command": "node",
"args": ["/path/to/merinfo-mcp/dist/index.js"],
"env": {
"DATABASE_PATH": "/path/to/data/merinfo.db"
}
}
}
}
Claude Code
claude mcp add merinfo node /path/to/merinfo-mcp/dist/index.js
VS Code Copilot / Cursor
Configure MCP servers in settings:
{
"mcp.servers": [
{
"name": "merinfo",
"command": "node",
"args": ["/path/to/merinfo-mcp/dist/index.js"]
}
]
}
🌐 Remote Server (Render.com)
Deploy as HTTP/SSE server for remote access:
Deploy to Render
- Create
render.yaml:
services:
- type: web
name: merinfo-mcp
env: node
buildCommand: npm install && npm run build
startCommand: npm run start:streamable
plan: starter
envVars:
- key: NODE_ENV
value: production
- key: DATABASE_PATH
value: /opt/render/project/data/merinfo.db
- key: PLAYWRIGHT_HEADLESS
value: true
- key: LOG_LEVEL
value: info
disk:
name: merinfo-data
mountPath: /opt/render/project/data
sizeGB: 10
- Connect to GitHub and deploy
- Access MCP endpoint:
https://your-app.onrender.com/mcp
Connect Remote Server
claude mcp add merinfo-remote --transport http https://your-app.onrender.com/mcp
📖 Example Usage
Search Company
// Search by organization number
{
"tool": "search_company_by_org_number",
"arguments": {
"org_number": "556631-3788",
"include_board": true
}
}
Analyze Industry
// Get companies in specific industry
{
"tool": "search_companies_by_industry",
"arguments": {
"sni_code": "62010",
"city": "Stockholm",
"min_revenue": 10000000,
"limit": 20
}
}
Search by Name
// Full-text search
{
"tool": "search_company_by_name",
"arguments": {
"query": "assistans",
"limit": 10
}
}
Generate Analysis
// Use pre-built prompt
{
"prompt": "analyze-company",
"arguments": {
"org_number": "556631-3788"
}
}
🔒 Rate Limiting & Caching
Rate Limits
- Scraping: 10 requests/minute to merinfo.se
- Client: 30 requests/minute per MCP client
- Automatic backoff: Exponential retry with jitter
Cache Strategy
- TTL: 30 days (configurable)
- Stale-while-revalidate: Returns cached data if < 30 days
- Background refresh: Auto-refresh stale data (optional)
- Storage: SQLite with FTS5 for fast search
🛠️ Development
Build
npm run build
Run Tests
npm test
npm run test:coverage
Linting & Formatting
npm run lint
npm run format
Database Management
# View cache stats
npm run setup-db
# Clear old cache
# Use clear_cache tool with confirm: true
🏆 Credits & Inspiration
Built by combining best practices from:
- allabolag - Request client patterns, caching strategies
- merinfo_scraper - Scraping logic, rate limiting
Special thanks to:
- Newsworthy for the allabolag library
- Model Context Protocol team at Anthropic
📝 License
MIT License - see for details
🤝 Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
⚠️ Disclaimer
This server scrapes public data from merinfo.se and allabolag.se. Please:
- Respect rate limits
- Use responsibly
- Check terms of service
- Don't overwhelm their servers
This tool is for legitimate business intelligence and due diligence purposes only.
🆘 Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
📊 Status
Made with ❤️ for the MCP ecosystem