Skip to main content
Glama
badchars

osint-mcp-server

by badchars

bgp_asn

Retrieve BGP ASN details including organization information, contacts, and announced IP prefixes to analyze network ownership and routing data.

Instructions

Look up ASN details and announced IPv4/IPv6 prefixes via BGPView. Returns ASN name, description, contacts, and all announced prefixes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
asnYesAutonomous System Number (e.g. 13335)

Implementation Reference

  • The implementation of the 'bgpAsn' function which fetches and processes BGP ASN data from BGPView.
    export async function bgpAsn(asn: number): Promise<BgpAsnResult> {
      const key = `asn:${asn}`;
      const cached = cache.get(key);
      if (cached) return cached;
    
      const [info, prefixes] = await Promise.all([
        bgpFetch(`/asn/${asn}`),
        bgpFetch(`/asn/${asn}/prefixes`),
      ]);
    
      const result: BgpAsnResult = {
        asn: info.asn,
        name: info.name ?? "",
        description: info.description_short ?? info.description_full ?? "",
        countryCode: info.country_code ?? "",
        emailContacts: info.email_contacts ?? [],
        abuseContacts: info.abuse_contacts ?? [],
        website: info.website,
        ipv4Prefixes: (prefixes.ipv4_prefixes ?? []).map((p: any) => ({
          prefix: p.prefix, name: p.name, description: p.description, countryCode: p.country_code,
        })),
        ipv6Prefixes: (prefixes.ipv6_prefixes ?? []).map((p: any) => ({
          prefix: p.prefix, name: p.name, description: p.description, countryCode: p.country_code,
        })),
      };
    
      cache.set(key, result);
      return result;
    }
  • The registration of the 'bgp_asn' tool, defining its schema, description, and mapping to the 'bgpAsn' handler.
    const bgpAsnTool: ToolDef = {
      name: "bgp_asn",
      description: "Look up ASN details and announced IPv4/IPv6 prefixes via BGPView. Returns ASN name, description, contacts, and all announced prefixes.",
      schema: {
        asn: z.number().describe("Autonomous System Number (e.g. 13335)"),
      },
      execute: async (args) => json(await bgpAsn(args.asn as number)),
    };
  • The TypeScript interface 'BgpAsnResult' defining the structure of the data returned by the tool.
    interface BgpAsnResult {
      asn: number;
      name: string;
      description: string;
      countryCode: string;
      emailContacts: string[];
      abuseContacts: string[];
      website?: string;
      ipv4Prefixes: { prefix: string; name: string; description: string; countryCode: string }[];
      ipv6Prefixes: { prefix: string; name: string; description: string; countryCode: 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