Skip to main content
Glama
mattjegan

eBird MCP Server

by mattjegan

get_species_list

Retrieve all bird species recorded in a specific region using eBird data, providing taxonomic codes for comprehensive regional biodiversity analysis.

Instructions

Get all species ever recorded in a region (species codes in taxonomic order).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_codeYesAny region code (country, subnational, location, etc.)

Implementation Reference

  • src/index.ts:355-365 (registration)
    Registration of the 'get_species_list' tool using McpServer.tool method, including name, description, input schema, and execution handler.
    server.tool(
      "get_species_list",
      "Get all species ever recorded in a region (species codes in taxonomic order).",
      {
        region_code: z.string().describe("Any region code (country, subnational, location, etc.)"),
      },
      async (args) => {
        const result = await makeRequest(`/product/spplist/${args.region_code}`);
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
      }
    );
  • Handler function that fetches the species list from eBird API endpoint `/product/spplist/{region_code}` using the shared makeRequest helper and returns formatted JSON response.
    async (args) => {
      const result = await makeRequest(`/product/spplist/${args.region_code}`);
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Zod schema defining the single input parameter 'region_code' as a string.
    {
      region_code: z.string().describe("Any region code (country, subnational, location, etc.)"),
    },
  • Shared utility function to make authenticated requests to the eBird API, used by all tools including get_species_list.
    async function makeRequest(endpoint: string, params: Record<string, string | number | boolean> = {}): Promise<unknown> {
      const url = new URL(`${BASE_URL}${endpoint}`);
      Object.entries(params).forEach(([key, value]) => {
        if (value !== undefined && value !== null) {
          url.searchParams.append(key, String(value));
        }
      });
    
      const response = await fetch(url.toString(), {
        headers: { "X-eBirdApiToken": API_KEY! },
      });
    
      if (!response.ok) {
        throw new Error(`eBird API error: ${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/mattjegan/ebird-mcp'

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