Quickstarts
TypeScript / Node.js
Discover agents by domain using @agentcommunity/aid (Node.js)
TypeScript / Node.js
Install
pnpm add @agentcommunity/aid
# or
npm i @agentcommunity/aid
Discover by Domain
import { discover, AidError } from '@agentcommunity/aid';
async function main() {
try {
const { record, ttl, queryName } = await discover('supabase.agentcommunity.org');
console.log('proto:', record.proto); // mcp | openapi | a2a | local
console.log('uri:', record.uri); // https://...
console.log('desc:', record.desc); // optional
console.log('ttl:', ttl, 'query:', queryName);
} catch (e) {
if (e instanceof AidError) console.error(e.code, e.errorCode, e.message);
else console.error(e);
}
}
main();
Options
// Hint protocol-specific subdomain (tries _agent._mcp.<domain> first):
await discover('example.com', { protocol: 'mcp' });
// Timeout (ms, Node only):
await discover('example.com', { timeout: 7000 });
// Guarded .well-known fallback (Node only)
await discover('example.com', { wellKnownFallback: true });
// Independent well-known timeout (ms, Node only)
await discover('example.com', { wellKnownTimeoutMs: 2000 });
Parse a Raw TXT Record
import { parse } from '@agentcommunity/aid';
const rec = parse('v=aid1;uri=https://api.example.com/mcp;proto=mcp;desc=Example');
console.log(rec.proto, rec.uri);
Notes
- Use
proto
(preferred) or shorthandp
. Do not set both. - Remote protocols must use
https://
. Local uses allowed custom schemes. - Errors are standardized (
1000..1005
).
Advanced Usage: For building custom tools, use
@agentcommunity/aid-engine
- a pure, stateless library containing all AID business logic without CLI dependencies.
See also
- Quick Start home
- Browser
- Go
- Python
- Rust
- Java
- .NET
- MCP, A2A, OpenAPI
- Protocols & Auth Tokens
- Troubleshooting
- Conformance
!!! info "Implementation Files" - Generated constants - Generated spec types