{"_id":"@anygpt/mcp-discovery","name":"@anygpt/mcp-discovery","dist-tags":{"latest":"0.3.2"},"versions":{"0.3.2":{"name":"@anygpt/mcp-discovery","version":"0.3.2","description":"MCP Discovery Engine - Core logic for on-demand MCP tool discovery","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{"./package.json":"./package.json",".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"repository":{"type":"git","url":"git+https://github.com/genai-tools/anygpt.git","directory":"packages/mcp-discovery"},"keywords":["mcp","discovery","tools","ai","gateway"],"author":{"name":"AnyGPT Contributors"},"license":"MIT","bugs":{"url":"https://github.com/genai-tools/anygpt/issues"},"homepage":"https://github.com/genai-tools/anygpt#readme","publishConfig":{"access":"public"},"scripts":{"build:dts":"tsc --project tsconfig.lib.json"},"dependencies":{"@anygpt/config":"3.0.1","@anygpt/rules":"0.3.1","@anygpt/types":"2.0.1","@modelcontextprotocol/sdk":"1.20.0","@huggingface/transformers":"^3.7.5"},"gitHead":"694856d0f9aa5bafc05fbf934367a8add2fddb59","_id":"@anygpt/mcp-discovery@0.3.2","_nodeVersion":"24.10.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-nYqjKkDC82ge2hJnEUuNiZfM0op8YbvtdhZmH5i6IvUHFhqw4VENwUbuH134sGyFCB/WyeelrtnbKMXjLyH19A==","shasum":"dde5553966573e0f27e8d57609a6cf8e96f45cf7","tarball":"https://registry.npmjs.org/@anygpt/mcp-discovery/-/mcp-discovery-0.3.2.tgz","fileCount":6,"unpackedSize":120960,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCqHqpBHsNktSzgVypR20kboh1D5H4AQwEzkmAnuy6UKAIhAKcN4ViNzr2MWe5uSim6VApI81TNRirVXstyvUKpB5tX"}]},"_npmUser":{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"},"directories":{},"maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mcp-discovery_0.3.2_1761046519322_0.2250737684692674"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-21T11:35:19.248Z","0.3.2":"2025-10-21T11:35:19.524Z","modified":"2025-10-21T11:35:19.848Z"},"maintainers":[{"name":"theplenkov-npm","email":"petr.plenkov@gmail.com"}],"description":"MCP Discovery Engine - Core logic for on-demand MCP tool discovery","homepage":"https://github.com/genai-tools/anygpt#readme","keywords":["mcp","discovery","tools","ai","gateway"],"repository":{"type":"git","url":"git+https://github.com/genai-tools/anygpt.git","directory":"packages/mcp-discovery"},"author":{"name":"AnyGPT Contributors"},"bugs":{"url":"https://github.com/genai-tools/anygpt/issues"},"license":"MIT","readme":"# @anygpt/mcp-discovery\n\n> **⚠️ WORK IN PROGRESS**: This package is under active development. APIs and discovery mechanisms may change significantly. Use at your own risk in production environments.\n\nMCP Discovery Engine - Core logic for on-demand MCP tool discovery.\n\n## Overview\n\nProvides search, filtering, caching, and tool execution proxy capabilities to enable AI agents to discover and use tools from 100+ MCP servers without loading everything into context.\n\n**Key Capability**: Reduces token consumption from 100,000+ tokens to ~600 tokens per message (99% reduction).\n\n## Installation\n\n```bash\nnpm install @anygpt/mcp-discovery\n```\n\n## Usage\n\n### Basic Setup\n\n```typescript\nimport { DiscoveryEngine } from '@anygpt/mcp-discovery';\n\n// Create discovery engine with default configuration\nconst engine = new DiscoveryEngine({\n  enabled: true,\n  cache: {\n    enabled: true,\n    ttl: 3600, // 1 hour\n  },\n});\n```\n\n### Search for Tools\n\n```typescript\n// Free-text search across all tools\nconst results = await engine.searchTools('github issue');\n\n// Search with options\nconst filtered = await engine.searchTools('create', {\n  server: 'github', // Filter by server\n  limit: 5, // Limit results\n});\n\n// Results include relevance scores\nresults.forEach((result) => {\n  console.log(`${result.server}:${result.tool} (${result.relevance})`);\n  console.log(`  ${result.summary}`);\n  console.log(`  Tags: ${result.tags.join(', ')}`);\n});\n```\n\n### List and Get Tool Details\n\n```typescript\n// List all servers\nconst servers = await engine.listServers();\n\n// List tools from a specific server\nconst githubTools = await engine.listTools('github');\n\n// Get detailed information about a tool\nconst tool = await engine.getToolDetails('github', 'create_issue');\nconsole.log(tool?.description);\nconsole.log(tool?.parameters);\n```\n\n### Execute Tools\n\n```typescript\n// Execute a tool\nconst result = await engine.executeTool('github', 'create_issue', {\n  repo: 'owner/repo',\n  title: 'Bug report',\n  body: 'Description of the bug',\n});\n\nif (result.success) {\n  console.log('Tool executed successfully:', result.result);\n} else {\n  console.error('Execution failed:', result.error?.message);\n}\n```\n\n### Advanced Configuration\n\n```typescript\n// Configure with tool rules for filtering\nconst engine = new DiscoveryEngine({\n  enabled: true,\n  cache: {\n    enabled: true,\n    ttl: 3600,\n  },\n  toolRules: [\n    // Enable all github tools\n    {\n      pattern: ['*github*'],\n      enabled: true,\n      tags: ['github'],\n    },\n    // Disable dangerous tools\n    {\n      pattern: ['*delete*', '*remove*'],\n      enabled: false,\n      tags: ['dangerous'],\n    },\n    // Server-specific rules\n    {\n      server: 'jira',\n      pattern: ['*ticket*'],\n      enabled: true,\n      tags: ['jira', 'tickets'],\n    },\n  ],\n});\n```\n\n### Pattern Matching\n\nSupports multiple pattern types:\n\n```typescript\n// Glob patterns\n{ pattern: ['*github*'] }           // Contains 'github'\n{ pattern: ['github_*'] }           // Starts with 'github_'\n{ pattern: ['*_issue'] }            // Ends with '_issue'\n\n// Regex patterns\n{ pattern: ['/^create_/'] }         // Starts with 'create_'\n{ pattern: ['/^(create|update)_/'] } // Starts with 'create_' or 'update_'\n\n// Negation patterns\n{ pattern: ['!*delete*'] }          // Exclude tools with 'delete'\n{ pattern: ['!*dangerous*'] }       // Exclude dangerous tools\n\n// Combined patterns\n{\n  pattern: ['*github*', '!*delete*'],\n  enabled: true\n}\n```\n\n## Features\n\n- **Configuration Loading**: Load discovery config from TypeScript files\n- **Pattern Matching**: Glob and regex patterns for tool filtering\n- **Search Engine**: Free-text search with relevance scoring\n- **Tool Metadata**: Manage tool metadata with enabled/disabled status\n- **Caching**: TTL-based caching for performance\n- **Tool Execution**: Proxy tool execution to actual MCP servers\n\n## Documentation\n\n- [Feature Documentation](../../docs/projects/anygpt-ts/features/4-4-mcp-discovery-engine/README.md)\n- [Design Document](../../docs/projects/anygpt-ts/features/4-4-mcp-discovery-engine/design.md)\n- [Specification](../../docs/products/anygpt/specs/anygpt/mcp-discovery.md)\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-08048c2414221fccfd4cdb01a8a6ad4d"}