Skip to main content
Glama
reidar80

Norwegian Business Registry MCP Server

by reidar80

get_municipalities

Retrieve comprehensive lists of Norwegian municipalities with pagination and sorting options for business registry queries.

Instructions

Get all Norwegian municipalities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sortNoSort order
sizeNoPage size
pageNoPage number

Implementation Reference

  • MCP tool handler for 'get_municipalities': calls apiClient.getMunicipalities() and returns the result as a formatted JSON text response.
    case "get_municipalities": const municipalities = await apiClient.getMunicipalities(); return { content: [ { type: "text", text: JSON.stringify(municipalities, null, 2), }, ], };
  • Tool registration including name, description, and input schema definition (optional pagination parameters, though not used in handler).
    { name: "get_municipalities", description: "Get all Norwegian municipalities", inputSchema: { type: "object", properties: { sort: { type: "string", description: "Sort order" }, size: { type: "number", description: "Page size" }, page: { type: "number", description: "Page number" } } } },
  • BrregApiClient helper method that fetches the list of municipalities from the BRREG API endpoint.
    async getMunicipalities() { return this.makeRequest('/enhetsregisteret/api/kommuner'); }
  • Core utility method in BrregApiClient for making HTTP requests to BRREG API endpoints, handling params, errors, and JSON parsing.
    private async makeRequest(endpoint: string, params?: Record<string, any>): Promise<any> { const url = new URL(`${BASE_URL}${endpoint}`); if (params) { Object.entries(params).forEach(([key, value]) => { if (value !== undefined && value !== null) { if (Array.isArray(value)) { url.searchParams.set(key, value.join(',')); } else { url.searchParams.set(key, String(value)); } } }); } const response = await fetch(url.toString(), { headers: { 'Accept': 'application/json', }, }); if (!response.ok) { if (response.status === 404) { throw new McpError(ErrorCode.InvalidRequest, `Resource not found: ${endpoint}`); } throw new McpError(ErrorCode.InternalError, `API request failed: ${response.status} ${response.statusText}`); } return response.json(); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/reidar80/BRREG-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server