This document explains how to integrate the Bundesanzeiger MCP Server with various LLM clients and applications.
The Bundesanzeiger MCP Server exposes German company financial data search and analysis capabilities through the Model Context Protocol (MCP). This allows LLMs to:
- Search for German companies in the Bundesanzeiger database
- Analyze financial reports and extract structured financial data
-
Install dependencies:
cd mcp_server pip install -r requirements.txt -
Set up environment variables:
# Copy .env from parent project or create new one cp ../.env .
-
Test the server:
python test_server.py
-
Run the server:
python server.py # or ./run_server.sh
To integrate with Claude Desktop, add the server configuration to your MCP settings:
-
Locate the Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Add the server configuration:
{ "mcpServers": { "bundesanzeiger": { "command": "python", "args": ["server.py"], "cwd": "/path/to/your/bundesanzeiger_telegram_bot/mcp_server", "env": { "OPENAI_API_KEY": "your_openai_api_key_here" } } } } -
Restart Claude Desktop
To integrate with Cursor IDE:
-
Install the MCP extension (if not already installed):
- Open Cursor IDE
- Go to Extensions (Cmd/Ctrl + Shift + X)
- Search for "MCP" or "Model Context Protocol"
- Install the MCP extension
-
Configure the MCP server:
- Open Cursor settings (Cmd/Ctrl + ,)
- Search for "MCP" in settings
- Add a new MCP server configuration:
{ "mcp.servers": [ { "name": "bundesanzeiger", "command": "python", "args": ["server.py"], "cwd": "/absolute/path/to/your/bundesanzeiger_telegram_bot/mcp_server", "env": { "OPENROUTER_API_KEY": "your_openrouter_api_key_here", "OPENAI_API_KEY": "your_openai_api_key_here" } } ] } -
Update the configuration:
- Replace the path with your actual directory path
- Add your actual API keys
-
Restart Cursor IDE and test with prompts like:
- "Search for Deutsche Bahn AG in the German business registry"
- "Analyze the financial data for Siemens Aktiengesellschaft"
To use with Cline in VS Code:
-
Install the Cline extension
-
Configure MCP server in Cline settings:
{ "cline.mcp": { "servers": [ { "name": "bundesanzeiger", "command": "python", "args": ["server.py"], "cwd": "/path/to/your/bundesanzeiger_telegram_bot/mcp_server", "env": { "OPENROUTER_API_KEY": "your_openrouter_api_key_here", "OPENAI_API_KEY": "your_openai_api_key_here" } } ] } }
To integrate with a custom MCP client:
import asyncio
import subprocess
import json
from mcp.client import ClientSession
from mcp.client.stdio import stdio_client
async def use_bundesanzeiger_server():
# Start the server process
server_process = subprocess.Popen(
["python", "server.py"],
cwd="/path/to/mcp_server",
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
# Connect to the server
async with stdio_client(server_process) as (read, write):
async with ClientSession(read, write) as session:
# Initialize the session
await session.initialize()
# List available tools
tools = await session.list_tools()
print("Available tools:", [tool.name for tool in tools])
# Search for a company
search_result = await session.call_tool(
"search",
{"company_name": "Deutsche Bahn AG"}
)
print("Search result:", search_result)
# Analyze the company
analyze_result = await session.call_tool(
"analyze",
{"company_name": "Deutsche Bahn AG"}
)
print("Analysis result:", analyze_result)
# Run the example
asyncio.run(use_bundesanzeiger_server())Use case: Find available financial reports for a German company
{
"tool": "search",
"arguments": {
"company_name": "Volkswagen AG"
}
}Response:
{
"found": true,
"searched_name": "Volkswagen AG",
"reports_count": 2,
"reports": [
{
"name": "Jahresabschluss zum 31.12.2023",
"company": "Volkswagen AG",
"date": "2024-05-20T00:00:00",
"has_financial_data": true
},
{
"name": "Lagebericht 2023",
"company": "Volkswagen AG",
"date": "2024-05-20T00:00:00",
"has_financial_data": false
}
]
}Use case: Extract detailed financial data from reports
{
"tool": "analyze",
"arguments": {
"company_name": "Volkswagen AG"
}
}Response:
{
"company_name": "Volkswagen AG",
"found": true,
"is_cached": false,
"date": "2024-05-20T00:00:00",
"financial_data": {
"earnings_current_year": 18951000000,
"total_assets": 565425000000,
"revenue": 322279000000
},
"report_name": "Jahresabschluss zum 31.12.2023"
}Here are some example prompts you can use with LLMs connected to this MCP server:
"Can you search for BMW AG in the German business registry and tell me what financial reports are available?"
"Please analyze the financial data for Siemens AG and provide a summary of their key financial metrics."
"Compare the financial performance of Deutsche Bahn AG and BMW AG. Search for both companies and analyze their latest financial reports."
"I'm researching the German automotive industry. Can you analyze the financial data for Volkswagen AG, BMW AG, and Mercedes-Benz Group AG?"
The server provides detailed error messages for common scenarios:
{
"found": false,
"message": "No reports found for company: NonExistent Company",
"searched_name": "NonExistent Company"
}{
"company_name": "Example AG",
"found": true,
"is_cached": false,
"date": "2024-01-15T00:00:00",
"report_name": "Jahresabschluss zum 31.12.2023",
"message": "Found report but couldn't extract financial data"
}- Caching: The server automatically caches results to improve performance for repeated queries
- Rate Limiting: The Bundesanzeiger website may impose rate limits; the server handles this gracefully
- CAPTCHA: The server automatically handles CAPTCHA challenges when they occur
- Timeout: Long-running analysis requests may timeout; consider implementing retry logic in your client
-
Import Error:
ModuleNotFoundError: No module named 'mcp'Solution: Install dependencies:
pip install -r requirements.txt -
OpenAI API Error:
Error: OpenAI API key not found
Solution: Set the
OPENAI_API_KEYenvironment variable -
Connection Timeout:
Error: Connection to Bundesanzeiger failed
Solution: Check internet connection and try again later
To run the server with debug logging:
PYTHONPATH=../ python -c "
import logging
logging.basicConfig(level=logging.DEBUG)
from server import main
import asyncio
asyncio.run(main())
"- API Keys: Never commit API keys to version control
- Rate Limiting: Be respectful of the Bundesanzeiger website's resources
- Data Privacy: Be aware that financial data may be sensitive
- Environment Variables: Use environment variables for configuration
For issues related to:
- MCP Protocol: Check the MCP documentation
- Bundesanzeiger Data: Refer to the main project documentation
- Server Issues: Check the logs and error messages
To contribute improvements to the MCP server:
- Test your changes with
python test_server.py - Ensure compatibility with the existing Bundesanzeiger functionality
- Update documentation as needed
- Submit a pull request with your changes