mcp-osint
# mcp-osint
A **free, zero-API-key** passive OSINT **TypeScript library** and **Model Context Protocol (MCP) stdio server**.
All OSINT protocol logic is built directly into `mcp-osint` using native Node.js APIs (`node:dns`, `node:net`, `node:tls`, `node:crypto`, built-in `fetch`) and open public standards (IANA RDAP, port-43 WHOIS, DNS/DoH, Certificate Transparency, Team Cymru DNS ASN, Gravatar, OpenPGP WKD, and keyless open-web APIs). Run it locally over stdio with **Claude Code**, **OpenAI Codex CLI**, **Qoder**, **Cursor**, **Claude Desktop**, or import it directly as an npm library in your TypeScript/JavaScript projects—no accounts, subscriptions, or API keys required.
## Highlights
- **100% Zero API Keys:** Every tool runs out of the box with no environment variables or paid services.
- **Dual Distribution:** Use it as a standalone **MCP stdio server** (`npx -y mcp-osint`) or as a **side-effect-free TypeScript/JavaScript library** (`import { ... } from 'mcp-osint'`).
- **9 Focused Passive OSINT Tools:**
1. `domain_registration` — IANA RDAP bootstrap lookup with native TCP port-43 WHOIS referral fallback, dates, age/expiry, EPP statuses, DNSSEC, and GDPR redaction detection.
2. `dns_email_posture` — Full DNS (`A`, `AAAA`, `CNAME`, `MX`, `NS`, `TXT`, `SOA`, `CAA`), SPF RFC 7208 lookup-limit evaluation, DMARC, optional DKIM selectors, MTA-STS, TLS-RPT, BIMI, mail provider fingerprinting, and grade (`A`–`F`).
3. `cert_transparency_search` — Certificate Transparency (`crt.sh`) domain/subdomain or organization (`O=`) search with deduplication, wildcard separation, issuer stats, and optional active DNS resolution.
4. `web_tls_profile` — Direct TLS certificate inspection (`node:tls`: SANs, issuer, expiry, chain, SHA-256 fingerprint) + HTTP security headers score, passive technology fingerprinting, `robots.txt`, and `security.txt`.
5. `ip_asn_intel` — Pure-DNS Team Cymru IP-to-ASN / ASN lookup + IANA RDAP IPv4/IPv6/ASN RIR metadata + Reverse DNS (`PTR`) + optional DNSBL check with public-resolver refusal detection.
6. `email_passive_check` — RFC syntax & alias normalization, built-in disposable & role-account detection, domain mail posture, Gravatar SHA-256 profile, OpenPGP WKD & `keys.openpgp.org`, and public GitHub match (no SMTP probing).
7. `username_search` — Built-in declarative catalog of 18 open-web & developer platforms (GitHub, GitLab, npm, PyPI, crates.io, RubyGems, Docker Hub, Hugging Face, Hacker News, DEV, Reddit, Keybase, Gravatar, Codeberg, Wikipedia, Packagist, Launchpad, Medium) with `found` / `not_found` / `unknown` classification.
8. `reverse_domain_pivot` — Keyless reverse-infrastructure discovery from a domain, organization, or IP via CT org/SAN co-occurrence, live TLS SANs, SPF includes, PTR, and ASN clustering.
9. `osint_investigate` — Coordinated passive investigation for a domain or IP returning a unified entity-relationship **pivot graph** (`nodes` + `edges`), hygiene findings, and suggested next pivots.
- **Built-in Security Guards:** Strict SSRF protection blocks loopback, RFC 1918 private, CGNAT, link-local / cloud metadata (`169.254.169.254`), IPv6 ULA/link-local, IPv4-mapped IPv6, and private redirects. Pure passive recon only—no port scanning, no exploitation, no anti-bot social scraping.
## Requirements
- Node.js **18.17** or newer.
- No API keys.
## Install
### Run on demand (MCP stdio)
```bash
npx -y mcp-osint --help
```
### Install globally
```bash
npm install --global mcp-osint
mcp-osint --help
```
### Install as a TypeScript / JavaScript library
```bash
npm install mcp-osint
```
## MCP Client Configuration (Free Stdio)
### Claude Code
```bash
claude mcp add osint -- npx -y mcp-osint
```
Or in `.mcp.json`:
```json
{
"mcpServers": {
"osint": {
"command": "npx",
"args": ["-y", "mcp-osint"]
}
}
}
```
### OpenAI Codex CLI
Add to `~/.codex/config.toml`:
```toml
[mcp_servers.osint]
command = "npx"
args = ["-y", "mcp-osint"]
```
Or register via CLI:
```bash
codex mcp add osint -- npx -y mcp-osint
```
### Qoder / Cursor / Claude Desktop / Generic MCP Clients
```json
{
"mcpServers": {
"osint": {
"command": "npx",
"args": ["-y", "mcp-osint"]
}
}
}
```
If installed globally (`npm i -g mcp-osint`), replace `"command": "npx", "args": ["-y", "mcp-osint"]` with `"command": "mcp-osint"`. When running from a local clone, use `"command": "node"` and `"args": ["/absolute/path/to/mcp-osint/dist/index.js"]`.
### Optional Environment Variables
No environment variables are required. Two optional settings are supported:
| Variable | Default | Purpose |
| --- | --- | --- |
| `MCP_OSINT_TIMEOUT_MS` | `10000` | Per-request network timeout in milliseconds (`1000`–`60000`). |
| `MCP_OSINT_DOH_URL` | unset | Optional DNS-over-HTTPS JSON endpoint (e.g. `https://cloudflare-dns.com/dns-query` or `https://dns.google/resolve`) when local UDP port 53 is restricted. |
## Programmatic Library Usage (TypeScript & JavaScript)
Importing `mcp-osint` is completely side-effect-free (it does not start stdio). You can call every OSINT module directly or mount all 9 tools onto your own `McpServer`:
```ts
import {
lookupDomainRegistration,
analyzeDnsEmail,
searchCertTransparency,
inspectWebTls,
lookupIpAsn,
checkEmailPassive,
searchUsername,
pivotRelatedDomains,
investigateTarget
} from 'mcp-osint';
const reg = await lookupDomainRegistration('example.com');
const dns = await analyzeDnsEmail('example.com', { probeCommonDkim: true });
const ct = await searchCertTransparency('example.com', { limit: 50 });
const web = await inspectWebTls('https://example.com');
const ip = await lookupIpAsn('1.1.1.1');
const email = await checkEmailPassive('security@example.com');
const profiles = await searchUsername('octocat', { platforms: ['github', 'npm', 'hackernews'] });
const pivot = await pivotRelatedDomains('example.com');
const report = await investigateTarget('example.com');
```
### Embedding inside an existing MCP Server
```ts
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { registerOsintTools, version } from 'mcp-osint';
const server = new McpServer({ name: 'my-agent-server', version });
registerOsintTools(server);
```
## MCP Tools Reference
All 9 tools are marked `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: true`.
| Tool | Key Inputs | Returns |
| --- | --- | --- |
| `domain_registration` | `domain`, `preferWhoisFallback` (`true`) | RDAP / WHOIS registrar, IANA ID, creation/update/expiry dates, age, EPP statuses, nameservers, DNSSEC, abuse email, privacy redaction flag. |
| `dns_email_posture` | `domain`, `dkimSelectors?`, `probeCommonDkim` (`false`) | `A`, `AAAA`, `CNAME`, `MX`, `NS`, `TXT`, `SOA`, `CAA`, detected mail providers, SPF/DMARC/DKIM/MTA-STS/TLS-RPT/BIMI analysis, grade (`A`–`F`), findings. |
| `cert_transparency_search` | `query`, `queryType` (`domain` \| `organization`), `includeExpired`, `includeWildcards`, `limit`, `resolveActive` | Deduplicated hostnames & wildcards from `crt.sh`, certificate counts, issuers, related apex domains, optional active DNS IPs. |
| `web_tls_profile` | `target`, `includeRobotsAndSecurityTxt` (`true`) | Live TLS certificate subject/issuer/SANs/expiry/chain/fingerprint, HTTP redirect chain, security headers score & grade, passive tech fingerprints, `robots.txt`, `security.txt`. |
| `ip_asn_intel` | `target` (IPv4/IPv6/ASN), `includeDnsbl` (`false`) | IP scope classification, Reverse DNS (`PTR`), Team Cymru ASN & BGP prefix, IANA RDAP network/RIR/org/abuse contact, optional DNSBL checks. |
| `email_passive_check` | `email`, `includePublicProfiles` (`true`) | Syntax/canonicalization, role & disposable checks, domain MX/mail posture, Gravatar SHA-256 profile, OpenPGP WKD & `keys.openpgp.org`, public GitHub match. |
| `username_search` | `username`, `platforms?`, `categories?` | Public account presence across up to 18 open-web/dev platforms with `found`, `not_found`, or `unknown` status and profile metadata. |
| `reverse_domain_pivot` | `query`, `queryType` (`auto` \| `domain` \| `organization` \| `ip`), `limit` | Related domains ranked by keyless signals (CT org match, SAN co-occurrence, live TLS SANs, SPF includes, shared IP PTR) + shared infrastructure summary. |
| `osint_investigate` | `target` (domain or IP), `includeWebTls`, `includeCertTransparency`, `maxIps` | Combined report with `pivotGraph` (`nodes` + `edges`), aggregated findings, suggested follow-up pivots, and partial-failure resilience. |
## Safety, Ethics & Scope
- **Pure Passive Reconnaissance:** `mcp-osint` performs standard protocol lookups and passive public metadata checks only. It does **not** include port scanning, vulnerability exploitation, SMTP user enumeration, brute-force subdomain wordlists, or anti-bot social media scraping.
- **SSRF Protection:** `web_tls_profile`, WHOIS referral chasing, and OpenPGP WKD checks resolve hostnames before connecting and block loopback (`127.0.0.0/8`, `::1`), RFC 1918 private networks (`10/8`, `172.16/12`, `192.168/16`), CGNAT (`100.64/10`), cloud metadata / link-local (`169.254.0.0/16`, `fe80::/10`), IPv6 ULA (`fc00::/7`), NAT64, IPv4-mapped IPv6 private targets, and private local suffixes (`.localhost`, `.local`, `.internal`). Every HTTP redirect hop is re-validated before following.
- **Connection safety:** Guarded HTTP requests and WHOIS referrals connect to validated addresses. An application supplying a custom `fetch` implementation must honor the passed Undici `dispatcher`; a custom resolver or transport is trusted application code and can weaken these protections.
- **Incomplete results:** Inspect `errors` in `osint_investigate` and `warnings` in `reverse_domain_pivot`. An npm username search that finds no maintained packages reports `unknown`, since the account may still exist. DNSBL results with DNS failures report `error` rather than `clean`.
- **Honest Reverse-Discovery Limitations:** Post-GDPR, registrant PII is widely redacted from public WHOIS/RDAP. `reverse_domain_pivot` therefore correlates domains using open cryptographic and DNS signals (Certificate Transparency `O=` & SANs, live TLS SANs, NS/MX/SPF, PTR, ASN) instead of brittle HTML scrapers.
- **Clean-Room MIT Implementation:** Written 100% from scratch in TypeScript under the MIT license.
## Development
```bash
npm ci
npm run lint
npm run format:check
npm run build
npm test
npm audit --omit=dev
npm pack --dry-run
```
`npm test` compiles TypeScript and runs both offline unit tests (`tests/unit.test.js`) and full end-to-end stdio MCP protocol tests (`tests/mcp.test.js`) using the official `@modelcontextprotocol/sdk` client against local mock HTTP/DoH/RDAP/CT/WHOIS servers—zero external network access required.
## Publishing to npm & MCP Registry
```bash
npm run lint
npm test
npm pack --dry-run
npm publish --access public
```
This repository includes `server.json` and `"mcpName": "io.github.zororaka00/mcp-osint"` for the official [MCP Registry](https://modelcontextprotocol.io/registry/quickstart):
```bash
mcp-publisher validate
mcp-publisher login github
mcp-publisher publish
```
## License
MIT — see [LICENSE](LICENSE).
TDQS
Scored across 9 tools
Each tool targets a distinct pivot input (username, domain, IP/ASN, email) plus one explicit aggregator (osint_investigate) that clearly frames itself as a coordinated run. The only mild overlap is cert_transparency_search vs reverse_domain_pivot, which both mine CT logs, and dns_email_posture vs email_passive_check, which both assess SPF/DMARC — descriptions distinguish them but an agent could still hesitate.
All names are snake_case and follow a consistent noun_phrase 'subject_action' convention (username_search, domain_registration, ip_asn_intel, email_passive_check), so the domain is readable at a glance. It deviates from a strict verb_noun pattern and mixes noun-first and action-first ordering, which is a minor inconsistency rather than a confusing one.
Nine tools is well within the sweet spot, and each earns its place by covering a different pivot type plus one orchestration tool. Nothing feels redundant or padded.
The surface covers the core passive OSINT pivots — identity, domain registration, DNS/email hygiene, certificates, live web/TLS, and network/ASN — with a graph-producing aggregator, so no major dead ends. Gaps remain for other pivot classes such as person/name search, phone numbers, breach/credential exposure, or social-media enumeration beyond username checks.