Ads.txt MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Ads.txt MCP Server validate ads.txt for example.com and check for duplicates"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ads.txt MCP Server
A Model Context Protocol (MCP) server that provides AI agents with tools to validate, optimize, and analyze ads.txt and sellers.json files for digital advertising transparency.
Overview
This MCP server acts as a bridge between AI agents (like Claude) and the Ads.txt Manager backend API. It enables AI-powered workflows for:
Ads.txt Validation: Syntax checking, duplicate detection, and sellers.json cross-verification
Ads.txt Optimization: Deduplication, formatting, categorization, and certification ID completion
Sellers.json Analysis: Fast lookups, batch searches, and metadata queries
Domain Intelligence: Cache-based ads.txt and sellers.json retrieval
Related MCP server: Crawl Readiness MCP Server
Features
š Validation Tools
Parse and validate ads.txt syntax
Cross-check entries with sellers.json
Detect duplicates and format issues
Provide detailed error messages
ā” Optimization Tools
Level 1: Remove duplicates, standardize format, group by domain
Level 2: Add sellers.json integration, categorize by seller type, complete certification IDs
š Analysis Tools
Batch seller ID lookups (up to 100 at once)
Metadata-only queries for fast checks
Parallel domain processing
Streaming support for large datasets
š¾ Cache Integration
Leverage PostgreSQL-backed cache
Force refresh capability
Automatic expiration handling
Architecture
āāāāāāāāāāāāāāāāāāā
ā AI Agent ā (Claude, GPT, etc.)
ā (Claude Code) ā
āāāāāāāāāā¬āāāāāāāāā
ā MCP Protocol
ā
āāāāāāāāāāāāāāāāāāā
ā MCP Server ā (This project)
ā Lightweight ā
ā Proxy ā
āāāāāāāāāā¬āāāāāāāāā
ā REST API
ā
āāāāāāāāāāāāāāāāāāā
ā Ads.txt Manager ā
ā Backend API ā
āāāāāāāāāā¬āāāāāāāāā
ā
ā
āāāāāāāāāāāāāāāāāāā
ā PostgreSQL ā (ads.txt & sellers.json cache)
āāāāāāāāāāāāāāāāāāāInstallation
Prerequisites
Node.js 18 or higher
Running instance of Ads.txt Manager backend
From npm (when published)
npm install -g adstxt-mcp-serverFrom Source
git clone https://github.com/miyaichi/adstxt-mcp-server.git
cd adstxt-mcp-server
npm install
npm run buildConfiguration
MCP Settings
Add to your MCP settings file (e.g., claude_desktop_config.json):
{
"mcpServers": {
"adstxt-manager": {
"command": "node",
"args": ["/path/to/adstxt-mcp-server/dist/index.js"],
"env": {
"API_BASE_URL": "https://adstxt-manager.jp",
"API_KEY": "your-api-key-here",
"API_TIMEOUT": "30000",
"API_RETRIES": "3"
}
}
}
}Environment Variables
Variable | Description | Default | Required |
| Ads.txt Manager backend URL |
| No |
| API key for authentication | - | Yes |
| Request timeout in milliseconds |
| No |
| Number of retry attempts |
| No |
MCP Tools
validate_adstxt_quick
Fast syntax-only validation without database queries (10-20x faster).
// Input
{
content: string; // ads.txt file content
checkDuplicates?: boolean; // Check for duplicates (default: true)
}
// Output
{
success: boolean;
data: {
isValid: boolean;
records: ParsedAdsTxtRecord[];
errors: ValidationError[];
warnings: ValidationWarning[];
statistics: {
totalLines: number;
validRecords: number;
invalidRecords: number;
variables: number;
comments: number;
duplicates: number;
}
}
}validate_adstxt
Full validation with sellers.json cross-checking.
// Input
{
content: string; // ads.txt file content
publisherDomain?: string; // Optional: for cross-checking
}
// Output
{
success: boolean;
data: {
records: ParsedAdsTxtRecord[];
totalRecords: number;
validRecords: number;
invalidRecords: number;
}
}optimize_adstxt
Optimizes ads.txt with two optimization levels.
// Input
{
content: string;
publisher_domain?: string;
level?: 'level1' | 'level2'; // Default: 'level1'
}
// Output
{
success: boolean;
data: {
optimized_content: string;
original_length: number;
optimized_length: number;
categories?: { // Level 2 only
other: number;
confidential: number;
missing_seller_id: number;
no_seller_json: number;
}
}
}optimize_adstxt_by_domain
Recommended: Optimizes ads.txt by domain (automatically fetches from cache). More efficient than fetching content separately.
// Input
{
domain: string; // Publisher domain
level?: 'level1' | 'level2'; // Default: 'level1'
force?: boolean; // Force refresh (default: false)
}
// Output
{
success: boolean;
data: {
optimized_content: string;
original_length: number;
optimized_length: number;
domain: string;
fetched_at: string;
categories?: { // Level 2 only
other: number;
confidential: number;
missing_seller_id: number;
no_seller_json: number;
}
}
}get_adstxt_cache
Retrieves cached ads.txt for a domain.
// Input
{
domain: string;
force?: boolean; // Force refresh
}
// Output
{
success: boolean;
data: {
domain: string;
content: string;
fetched_at: string;
status: 'success' | 'not_found' | 'error';
}
}get_sellers_json
Gets full sellers.json data for an ad system.
// Input
{
domain: string; // e.g., 'google.com'
}
// Output
{
success: boolean;
data: {
sellers_json: SellerRecord[];
contact_email?: string;
version?: string;
identifiers?: any[];
}
}get_sellers_json_metadata
Gets only metadata (no seller list) for fast checks.
// Input
{
domain: string;
}
// Output
{
success: boolean;
data: {
domain: string;
seller_count: number;
contact_email?: string;
fetched_at: string;
}
}search_sellers_batch
High-performance batch search for multiple seller IDs.
// Input
{
domain: string;
seller_ids: string[]; // Max 100 IDs
}
// Output
{
success: boolean;
data: {
found: SellerRecord[];
not_found: string[];
execution_time_ms: number;
}
}get_seller_by_id
Searches for a specific seller ID.
// Input
{
domain: string;
seller_id: string;
}
// Output
{
success: boolean;
data: {
found: boolean;
seller?: SellerRecord;
}
}get_domain_info
Get comprehensive domain information (ads.txt + sellers.json) in single call.
// Input
{
domain: string;
}
// Output
{
success: boolean;
data: {
domain: string;
ads_txt: {
exists: boolean;
last_fetched?: string;
status: string;
record_count?: number;
};
sellers_json: {
exists: boolean;
last_fetched?: string;
status: string;
seller_count?: number;
};
}
}get_batch_domain_info
Get information for multiple domains (up to 50) in a single request.
// Input
{
domains: string[]; // Max 50 domains
}
// Output
{
success: boolean;
data: {
domains: DomainInfo[];
summary: {
total_domains: number;
with_ads_txt: number;
with_sellers_json: number;
with_both: number;
};
}
}get_error_help
Get detailed help information for ads.txt validation errors and warnings.
// Input
{
errorCode?: string; // Optional: specific error code (e.g., "11010")
language?: 'en' | 'ja'; // Language (default: 'en')
}
// Output
{
success: boolean;
data: {
content: string; // Markdown help content
url?: string; // Link to specific error section
}
}Usage Examples
Example 1: Validate ads.txt
User: "Please validate this ads.txt content"
Agent: Uses validate_adstxt tool
Result: Detailed validation report with errors and warningsExample 2: Optimize ads.txt (Recommended approach)
User: "Optimize my ads.txt file at example.com"
Agent:
1. Calls optimize_adstxt_by_domain with domain='example.com', level='level2'
2. Returns categorized, optimized content
Performance: Single API call, ~50% faster than separate fetch + optimizeExample 2b: Optimize ads.txt (Alternative approach)
User: "Optimize this ads.txt content: [paste content]"
Agent:
1. Calls optimize_adstxt with provided content and level2
2. Returns categorized, optimized contentExample 3: Verify seller relationships
User: "Check if google.com lists publisher ID 12345"
Agent:
1. Calls get_seller_by_id(domain='google.com', seller_id='12345')
2. Returns seller details if foundExample 4: Bulk analysis
User: "Analyze all ad systems in this ads.txt"
Agent:
1. Parses ads.txt to extract domains
2. Calls get_sellers_json_metadata for each domain
3. Generates comprehensive analysis reportAPI Backend Requirements
This MCP server requires a running instance of the Ads.txt Manager backend with the following endpoints:
Core Endpoints (v1)
POST /api/v1/adstxt/validate/quick- Quick validation (10-20x faster)GET /api/v1/domains/:domain/info- Domain info (60-70% fewer calls)POST /api/v1/domains/batch/info- Batch domain info (90%+ fewer calls)POST /api/v1/sellersjson/:domain/sellers/batch- Batch seller search
Legacy Endpoints
POST /api/adsTxt/process- Full validation with sellers.jsonPOST /api/adsTxt/optimize- Optimize ads.txtGET /api/adsTxtCache/domain/:domain- Get cached ads.txtGET /api/sellersJson/:domain- Get sellers.jsonGET /api/sellersJson/:domain/metadata- Get metadata onlyGET /api/sellersJson/:domain/seller/:sellerId- Search seller
Help Resources
GET /help/en/warnings.md- Error help (English)GET /help/ja/warnings.md- Error help (Japanese)
See AGENT.md for detailed specifications.
Performance
Optimization Features
Database caching: Minimizes external HTTP requests
Batch operations: Up to 100 items per request
Parallel processing: Multiple domains simultaneously
Streaming support: Large dataset handling
Metadata queries: Fast checks without full data
Benchmarks
Single seller lookup: ~10ms (cache hit)
Batch 100 sellers: ~50-100ms
Level 2 optimization: ~2-5s (depending on seller count)
Parallel domain analysis: 70-80% faster than sequential
Error Handling
All tools return a consistent error format:
{
success: false;
error: {
code: string; // Error code
message: string; // Human-readable message
details?: any; // Additional context
}
}Common Error Codes
VALIDATION_ERROR- Invalid inputNOT_FOUND- Resource not foundTIMEOUT- Request timeoutRATE_LIMIT- Rate limit exceededSERVER_ERROR- Internal error
Development
Project Structure
adstxt-mcp-server/
āāā src/
ā āāā index.ts # MCP server entry point
ā āāā tools/ # MCP tool implementations
ā ā āāā validate.ts
ā ā āāā optimize.ts
ā ā āāā domain.ts
ā ā āāā sellers.ts
ā ā āāā help.ts
ā āāā api/ # Backend API client
ā ā āāā client.ts
ā āāā types/ # TypeScript definitions
āāā tests/ # Test files
āāā package.json
āāā tsconfig.jsonBuild
npm run buildTest
npm testDevelopment Mode
npm run devContributing
Contributions are welcome! Please follow these guidelines:
Fork the repository
Create a feature branch
Make your changes with tests
Submit a pull request
Code Style
TypeScript strict mode
ESLint configuration
Prettier formatting
Conventional commits
Testing
Unit Tests
npm run test:unitIntegration Tests
Requires running backend:
npm run test:integrationE2E Tests
npm run test:e2eTroubleshooting
MCP Server Not Connecting
Check backend is running:
curl http://localhost:3001/healthVerify MCP configuration in Claude settings
Check logs:
tail -f ~/.claude/logs/mcp-server.log
Slow Performance
Check database cache status
Use metadata-only queries when possible
Implement batch operations for multiple lookups
Consider backend optimization settings
Validation Errors
Verify ads.txt format compliance
Check sellers.json availability
Review error details in response
Consult IAB standards documentation
Security
API Key authentication: Required for all API calls
Environment variables: API key stored securely in environment, never in code
Input validation: All inputs sanitized using Zod schemas
HTTPS only: All API calls use secure HTTPS connections
Rate limiting: Handled by backend API
No data storage: MCP server is stateless, no caching of sensitive data
Retry logic: Automatic retry for transient errors with exponential backoff
Best Practices
Never commit API keys: Keep API_KEY in environment variables only
Rotate keys regularly: Request new API keys periodically
Limit key scope: Use separate keys for different environments
Monitor usage: Check API usage logs for unexpected activity
License
MIT License - see LICENSE file
Related Projects
Ads.txt Manager: https://github.com/miyaichi/adstxt-manager
@miyaichi/ads-txt-validator: NPM package for ads.txt validation
OpenSincera MCP Server: https://github.com/miyaichi/opensincera-mcp-server
Acknowledgments
Built with Model Context Protocol (MCP)
Developed using Claude Code vibe coding approach
Leverages Ads.txt Manager backend
Support
Issues: https://github.com/miyaichi/adstxt-mcp-server/issues
Discussions: https://github.com/miyaichi/adstxt-mcp-server/discussions
Documentation: AGENT.md
Roadmap
Core validation and optimization tools
Sellers.json search capabilities
Database cache integration
Additional backend APIs
Performance monitoring
Advanced error recovery
Comprehensive documentation
Production deployment guide
Available Tools
12 toolsget_adstxt_cacheB
Retrieve cached ads.txt content for a domain from the database. Optionally force refresh from source.
Inputs: domain (required), force.
get_batch_domain_infoB
Get information for multiple domains (up to 50) in a single request. Reduces API calls by 90%+.
Inputs: domains (required).
get_domain_infoB
Get comprehensive domain information (ads.txt + sellers.json status) in a single API call. Reduces API calls by 60-70%.
Inputs: domain (required).
get_error_helpA
Get detailed help information for ads.txt validation errors and warnings. Supports multiple languages (English, Japanese).
Inputs: language, errorCode.
get_seller_by_idB
Search for a specific seller ID in an ad system's sellers.json. Returns seller details including type and confidentiality status.
Inputs: domain (required), seller_id (required).
get_sellers_jsonB
Get full sellers.json data for an advertising system domain. Includes all seller records, contact information, and metadata.
Inputs: domain (required).
get_sellers_json_metadataA
Get sellers.json metadata only (no seller list). Fast check for availability, seller count, and contact information.
Inputs: domain (required).
optimize_adstxtA
Optimize ads.txt content. Level 1: remove duplicates, standardize format, group by domain. Level 2: Level 1 + sellers.json integration and categorization.
Inputs: content (required), level, publisher_domain.
optimize_adstxt_by_domainB
Optimize ads.txt by domain (automatically fetches from cache). More efficient than fetching content separately. Reduces latency and data transfer.
Inputs: domain (required), force, level.
search_sellers_batchB
High-performance batch search for multiple seller IDs in a single domain. Up to 100 IDs per request.
Inputs: domain (required), seller_ids (required).
validate_adstxtB
Full ads.txt validation with sellers.json cross-checking. Validates syntax, format, and verifies account IDs against sellers.json.
Inputs: content (required), publisherDomain.
validate_adstxt_quickA
Fast syntax-only validation without database queries (10-20x faster). Checks ads.txt format, detects duplicates, and provides detailed error messages.
Inputs: content (required), checkDuplicates.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 12 tools
Most tools target clearly distinct operations (quick vs full validation, single vs batch domain info, full vs metadata-only sellers.json, single vs batch seller search). The main overlap is between optimize_adstxt and optimize_adstxt_by_domain, which differ only in whether content is fetched from cache, and get_seller_by_id vs search_sellers_batch which are close but separable by cardinality.
All names are snake_case with consistent verb_noun structure (validate_, optimize_, get_, search_). Minor deviation: the 'batch' qualifier appears in different positions (get_batch_domain_info vs search_sellers_batch) and the _quick/_metadata suffixes vary slightly, but the pattern remains readable.
12 tools is well within the sensible range and maps cleanly onto the domain's sub-areas: validation, optimization, caching, domain info, sellers.json, and error help. One tool (optimize_adstxt_by_domain) is largely a convenience wrapper duplicating optimize_adstxt + get_adstxt_cache, so the set is slightly over-provisioned but reasonable.
The surface covers the full lifecycle: fetch/cache ads.txt, validate (fast and full), optimize, inspect domain and sellers.json data, search sellers, and interpret errors. Gaps are minor, e.g. no tool to persist or write back an optimized ads.txt, and no bulk/batch validation of multiple ads.txt contents in one call.
Maintenance
Related MCP Connectors
Free MCP tools for AI-search visibility: crawler checks, page audits, and llms.txt generation.
100+ MCP tools for AI agents: content metadata, trade intelligence, business-expertise analysis.
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to audit URLs or raw HTML for SEO, AEO, and GEO performance, generate llms.txt manifests, and check the tool version via MCP tools.1MIT
- AlicenseAqualityBmaintenanceChecks what GPTBot, ClaudeBot, PerplexityBot and 50+ other AI crawlers can read on a site and what its access policy allows, checks whether a page permits search, answers, training or agent use (with a signed receipt), generates llms.txt, robots.txt and JSON-LD, and reads your Answer Analysis. Nine tools for Claude Desktop, Cursor and other MCP clients.9168 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to perform live Google SERP searches, run on-page and full-site SEO audits with prioritized fixes, and check brand visibility in AI answer engines via four MCP tools.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to retrieve product information and run a robots.txt check through remote MCP tools.MIT