Skip to main content
Glama
badchars

osint-mcp-server

by badchars

bgp_ip

Look up BGP routing information for any IP address to identify matching prefixes, ASNs, and RIR allocation data.

Instructions

Look up BGP routing information for an IP address. Returns matching prefixes, ASNs, and RIR allocation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesIP address to look up

Implementation Reference

  • The actual implementation (handler) of the `bgp_ip` tool.
    export async function bgpIp(ip: string): Promise<BgpIpResult> {
      const key = `ip:${ip}`;
      const cached = cache.get(key);
      if (cached) return cached;
    
      const data = await bgpFetch(`/ip/${ip}`);
    
      const result: BgpIpResult = {
        ip,
        prefixes: (data.prefixes ?? []).map((p: any) => ({
          prefix: p.prefix, asn: p.asn?.asn, name: p.name, description: p.description, countryCode: p.country_code,
        })),
        rir: data.rir_allocation?.rir_name ?? "",
      };
    
      cache.set(key, result);
      return result;
    }
  • Type definition for the BGP IP lookup result.
    interface BgpIpResult {
      ip: string;
      prefixes: { prefix: string; asn: number; name: string; description: string; countryCode: string }[];
      rir: string;
    }
  • Tool definition and registration for `bgp_ip`.
    const bgpIpTool: ToolDef = {
      name: "bgp_ip",
      description: "Look up BGP routing information for an IP address. Returns matching prefixes, ASNs, and RIR allocation.",
      schema: {
        ip: z.string().describe("IP address to look up"),
      },
      execute: async (args) => json(await bgpIp(args.ip as string)),
    };

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/badchars/osint-mcp-server'

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