A smart, unified API for accessing Model Context Protocol (MCP) tools through Groq's Responses endpoint. Features AI-powered tool selection, dynamic MCP registry integration, and zero-configuration tool access.
Install Deno: https://deno.land/#installation
Set environment variables:
export GROQ_API_KEY="your_groq_api_key" export PARALLEL_API_KEY="your_parallel_api_key"
deno task serve
This runs: deno serve --allow-sys --allow-read --allow-import --allow-env --allow-write --allow-net --reload=https://esm.town ./main.js
Let AI automatically choose the best tools for your query:
# Browser-friendly: AI picks the right tools and executes them GET /select?q=Plan a 3-day trip to Tokyo # Generate curl commands for any query GET /select?q=Find trending AI models&mode=curl # Programmatic usage with custom API keys curl -X POST "http://localhost:8000/select" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_GROQ_API_KEY" \ -d '{"query": "Build a travel itinerary for Paris", "mode": "execute"}'
When you know exactly which tools to use:
# Execute specific tools GET /?tools=parallel_web_search&q=what's the weather in San Francisco # Multiple tools coordination GET /?tools=github,huggingface&q=research trending AI models and create an issue # MCP Registry tool (zero configuration) GET /?tools=garden.stanislav.svelte-llm/svelte-llm-mcp&q=what are svelte runes
# List all available tools GET /?mode=list # Get detailed tool schemas GET /?tools=parallel_web_search&mode=list # Browse the MCP registry GET /registry # Search for specific tools GET /registry?search=gmail
For production use, you can provide custom API keys per tool using the POST endpoint:
# Execute with custom API keys for each tool curl -X POST "http://localhost:8000/" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_GROQ_API_KEY" \ -d '{ "tools": "parallel_web_search,github", "q": "research latest AI developments and create an issue", "toolHeaders": { "parallel_web_search": { "x-api-key": "USER_PROVIDED_PARALLEL_KEY" }, "github": { "Authorization": "Bearer USER_PROVIDED_GITHUB_TOKEN" } } }' # List tools with custom headers curl -X POST "http://localhost:8000/" \ -H "Content-Type: application/json" \ -d '{ "mode": "list", "tools": "parallel_web_search", "apiKey": "YOUR_GROQ_API_KEY", "toolHeaders": { "parallel_web_search": { "x-api-key": "USER_PROVIDED_PARALLEL_KEY" } } }'
Key Features:
GET/POST /select
ā AI automatically chooses the best tools for your query
Parameter | Description | Default | Required |
---|---|---|---|
q or query | Your natural language query | - | Yes |
mode | execute or curl | execute | No |
model | Groq model to use | openai/gpt-oss-120b | No |
{ "query": "Your natural language query", "mode": "execute", // or "curl" "model": "openai/gpt-oss-120b" }
Examples:
# Let AI pick tools and execute GET /select?q=Plan a trip to Tokyo # Generate curl command GET /select?q=Find trending AI models&mode=curl # Programmatic usage POST /select {"query": "Search for emails about project", "mode": "execute"}
GET/POST /
ā Execute specific tools when you know what you need
Parameter | Description | Default | Required |
---|---|---|---|
tools | Comma-separated tool names | - | For execute mode |
q | Query/input for tools | - | For execute mode |
mode | execute or list | execute | No |
model | Groq model | openai/gpt-oss-120b | No |
```json
{
"tools": "tool1,tool2", "q": "Your query", "mode": "execute", "toolHeaders": { "tool1": {"x-api-key": "YOUR_KEY"} } }
### š§ Other Endpoints
- **`GET /registry`** ā Browse official MCP registry with search
- **`POST /api/tool/:toolName`** ā Individual tool execution (supports MCP registry)
- **`GET /debug`** ā Environment and configuration check
- **`POST /api/groq/responses`** ā Direct Groq API wrapper
## š Universal MCP Access
One of the most powerful features is **zero-configuration access** to any MCP tool from the official registry:
```bash
# Use any MCP tool without setup - automatically discovered from registry
GET /?tools=garden.stanislav.svelte-llm/svelte-llm-mcp&q=what are svelte runes
GET /?tools=com.peek/mcp&q=plan a 3-day tokyo itinerary
GET /?tools=ai.waystation/gmail&q=search for emails about the project
# Or let AI pick the perfect tool automatically
GET /select?q=I need help with Svelte development
How it works:
Tools are registered in the toolsRegistry
object in main.js
. Each tool can include optional _meta
for better documentation and examples:
const toolsRegistry = {
parallel_web_search: {
type: "mcp",
server_label: "parallel_web_search",
server_url: "https://mcp.parallel.ai/v1beta/search_mcp/",
headers: {
"x-api-key": () => Deno.env.get("PARALLEL_API_KEY")
},
require_approval: "never",
// Optional metadata for better dynamic examples
_meta: {
description: "Web search with AI-optimized results",
example_queries: [
"what's the weather in San Francisco",
"latest developments in AI safety research",
"current news about climate change"
],
use_cases: ["Current events", "Research", "Weather", "News"]
}
},
github: {
type: "mcp",
server_label: "GitHub",
server_url: "https://api.githubcopilot.com/mcp/",
headers: {
"Authorization": () => `Bearer ${Deno.env.get("GITHUB_TOKEN")}`
},
require_approval: "never",
_meta: {
description: "GitHub repository management and operations",
example_queries: [
"create an issue in my repo about adding MCP examples",
"search for repositories related to AI",
"create a new issue titled 'Add authentication'"
],
use_cases: ["Create issues", "Manage repos", "Code search", "Pull requests"]
}
},
// Add more tools here...
};
toolsRegistry
_meta
for better documentationExample:
new_tool: {
type: "mcp",
server_label: "new_tool",
server_url: "https://example.com/mcp/",
headers: {
"authorization": () => `Bearer ${Deno.env.get("NEW_TOOL_API_KEY")}`
},
require_approval: "never",
_meta: {
description: "Custom tool for specific operations",
example_queries: [
"primary example query",
"secondary example query",
"tertiary example query"
],
use_cases: ["Use case 1", "Use case 2", "Use case 3"]
}
}
The API documentation at /
is completely dynamic and generates examples based on:
_meta
) if providedThis means:
```json
{ "id": "resp_01k5shpe...", "object": "response", "status": "completed", "output": [ { "type": "mcp_call", "server_label": "parallel_web_search", "name": "web_search_preview", "output": "..." }, { "type": "message", "role": "assistant", "content": [...] } ], "usage": {...} }
### Tool Schema Response
```json
{
"mode": "list",
"schemas": [
{
"toolName": "parallel_web_search",
"server_label": "parallel_web_search",
"tools": [
{
"name": "web_search_preview",
"description": "Perform web searches...",
"input_schema": {...}
}
],
"tool_count": 1
}
]
}
Variable | Description | Required |
---|---|---|
GROQ_API_KEY | Groq API key for model access | Yes |
PARALLEL_API_KEY | Parallel AI API key for web search | For parallel_web_search tool |
GITHUB_TOKEN | GitHub token for GitHub MCP tool | For github tool |
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.GROQ_API_KEY,
baseURL: "https://api.groq.com/openai/v1",
});
// Single tool example
const response = await client.responses.create({
model: "openai/gpt-oss-120b",
input: "What models are trending on Huggingface?",
tools: [
{
type: "mcp",
server_label: "Huggingface",
server_url: "https://huggingface.co/mcp",
}
]
});
console.log(response);
const response = await client.responses.create({
model: "openai/gpt-oss-120b",
input: "Please create a new issue in my repository called 'build-with-groq/groq-code-cli' with the title 'Add MCP examples' and outline a few examples of MCP?",
tools: [
{
type: "mcp",
server_label: "GitHub",
server_url: "https://api.githubcopilot.com/mcp/",
headers: {
Authorization: "Bearer <GITHUB_TOKEN>"
}
},
{
type: "mcp",
server_label: "Huggingface",
server_url: "https://huggingface.co/mcp",
}
]
});
console.log(response);
const response = await client.responses.create({
model: "openai/gpt-oss-120b",
input: "Research trending AI models and create a GitHub issue summarizing them",
tools: [
{
type: "mcp",
server_label: "GitHub",
server_url: "https://api.githubcopilot.com/mcp/",
headers: { "Authorization": "Bearer <GITHUB_TOKEN>" }
},
{
type: "mcp",
server_label: "Huggingface",
server_url: "https://huggingface.co/mcp"
},
{
type: "mcp",
server_label: "parallel_web_search",
server_url: "https://mcp.parallel.ai/v1beta/search_mcp/",
headers: { "x-api-key": "<PARALLEL_API_KEY>" }
}
]
});
/select?q=X
ā AI picks tools and executes/?tools=X&q=Y
ā Direct tool execution/?mode=list
ā Tool discovery and schemasThe API provides detailed error messages with helpful examples:
groq-mcp-nav/
āāā main.js # Main server and API logic
āāā deno.json # Deno configuration
āāā README.md # This file
āāā ...
Multiple ways to test and explore:
/
ā Interactive API documentation/select?q=your query
ā AI-powered tool selection/?tools=tool_name&q=test
ā Direct tool execution/?mode=list
ā Explore available tools/registry
ā Browse 300+ public MCP tools/debug
ā Check configuration and API keysPowered by Groq ā get your API key at https://groq.com