ToolStorePy is an automatic MCP (Model Context Protocol) server builder.
Describe the tools you need in plain English. ToolStorePy finds the best matching implementations from a curated vector index, clones the repositories, audits them for security, and generates a ready-to-run MCP server β in one command.
Full architecture details, examples, and advanced usage:
https://tool-store-py-docs.vercel.app/
pip install toolstorepyPyPI: https://pypi.org/project/toolstorepy/
Given a queries.json file:
[
{ "tool_description": "evaluate a mathematical arithmetic expression securely" },
{ "tool_description": "convert between different units of measurement" },
{ "tool_description": "calculate cryptographic hash of a file" }
]Run:
toolstorepy build --queries queries.json --index core-toolsToolStorePy will:
- Download a vector index of curated tool repositories
- Run semantic retrieval + cross-encoder reranking
- Clone matching repositories via a local bare-repo cache
- Run a static AST security scan on every repo
- Optionally run an LLM-based security review (autonomous, no human prompt)
- Merge
.env.examplefiles and validate required secrets - Extract
@toolfunctions via AST - Generate a unified MCP server
- Optionally launch the server immediately
Output:
toolstorepy_workspace/
βββ mcp_unified_server.py
βββ security_report.txt
βββ .env.example
βββ .venv/
# Using the built-in index
toolstorepy build \
--queries queries.json \
--index core-tools
# Using a remote index URL
toolstorepy build \
--queries queries.json \
--index-url https://your-index-url.zip
# Custom port
toolstorepy build \
--queries queries.json \
--index core-tools \
--port 9090
# LLM-based security scan (autonomous, no human prompt)
toolstorepy build \
--queries queries.json \
--index core-tools \
--llm-scantoolstorepy build --queries <path> [options]
| Flag | Default | Description |
|---|---|---|
--queries |
required | Path to queries.json |
--index |
β | Built-in index name |
--index-url |
β | Remote index archive URL |
--workspace |
toolstorepy_workspace |
Workspace directory |
--install-requirements |
off | Install repo requirements.txt files |
--host |
0.0.0.0 |
Host the MCP server binds on |
--port |
8000 |
Port the MCP server listens on |
--llm-scan |
off | Enable LLM-based autonomous security review |
--llm-model |
claude-sonnet-4-6 |
Model for LLM scanning (any LangChain-supported string) |
--force-refresh |
off | Re-download cached index |
--verbose |
off | Verbose logging + full tracebacks |
# Pre-warm cache from a resolved queries file (items must have git_link)
toolstorepy cache populate --queries resolved.json
# Pre-warm cache from explicit URLs
toolstorepy cache populate --url https://github.com/org/repo1.git \
--url https://github.com/org/repo2.git
# List cached repos
toolstorepy cache list
# Clear cache
toolstorepy cache clearEvery repository is scanned before inclusion. Two modes are available:
Static analysis using Python's ast module. Fast and deterministic.
| Severity | What triggers it |
|---|---|
| HIGH | eval/exec, os.system, subprocess with shell=True, pickle.loads, yaml.load without Loader= |
| MEDIUM | Capability imports (subprocess, pickle, raw sockets, unsafe XML parsers), dynamic reflection |
| LOW | HTTP clients, crypto primitives, deprecated modules |
Repos with HIGH findings prompt you to include or skip before the build proceeds.
An LLM reviews the full source of each repo and makes an autonomous INCLUDE/SKIP decision. The human prompt is bypassed entirely β the build proceeds automatically based on the LLM verdict.
Both scanners can be used together. When --llm-scan is active, AST findings are merged into the same security report and the LLM decision is final.
The LLM scanner uses LangChain's init_chat_model so any supported provider works:
# Claude (default)
export ANTHROPIC_API_KEY=sk-...
toolstorepy build --queries q.json --index core-tools --llm-scan
# GPT-4o
export OPENAI_API_KEY=sk-...
toolstorepy build ... --llm-scan --llm-model gpt-4o
# Gemini
export GOOGLE_API_KEY=...
toolstorepy build ... --llm-scan --llm-model gemini-2.0-flashInstall the integration package for your chosen provider:
pip install langchain-anthropic # Claude β ANTHROPIC_API_KEY
pip install langchain-openai # GPT β OPENAI_API_KEY
pip install langchain-google-genai # Gemini β GOOGLE_API_KEYThe security report (workspace/security_report.txt) is always written regardless of which scan mode is used. LLM findings are tagged [LLM] in the report so they're visually distinct from AST findings.
If any cloned tool includes a .env.example, ToolStorePy automatically:
- Merges all
.env.examplefiles across repos - Resolves conflicts interactively
- Validates completeness against an existing
.env - Documents required keys at the top of the generated server file
Output: workspace/.env.example
Steps:
- Copy
.env.exampleβ.envin your workspace - Fill in the required values
- Re-run the server
The generated server runs on streamable-http transport. Host and port are baked in at build time:
# Default: 0.0.0.0:8000
toolstorepy build --queries q.json --index core-tools
# Custom host/port
toolstorepy build --queries q.json --index core-tools --host 127.0.0.1 --port 9090The generated mcp_unified_server.py contains:
if __name__ == "__main__":
mcp.run(transport='streamable-http', host='127.0.0.1', port=9090)queries.json
β
βΌ
vector index retrieval
β
βΌ
semantic search + reranking
β
βΌ
repository cloning (bare-repo cache)
β
βΌ
AST security scan
β
βΌ
LLM security scan (optional, --llm-scan)
β
βΌ
.env merge + validation
β
βΌ
@tool extraction via AST
β
βΌ
MCP server synthesis
Repositories are cached as bare git clones at:
~/.repo_cache/
Subsequent builds reuse the cache, skipping remote clones entirely. Pre-warm it manually with:
toolstorepy cache populate --url https://github.com/org/repo.gittoolstorepy/
βββ cli.py
βββ orchestrator.py
βββ config.py
βββ builder/
β βββ mcp_builder.py
β βββ parser.py
βββ index/
β βββ downloader.py
β βββ registry.py
βββ loader/
β βββ cache.py
β βββ repo.py
βββ search/
β βββ rerank.py
β βββ semantic.py
βββ utils/
βββ env_merger.py
βββ llm_scanner.py
βββ security_scanner.py
| Goal | Location |
|---|---|
| Add a built-in index | index/registry.py |
| Change embedding model | orchestrator.py |
| Add AST security rules | utils/security_scanner.py |
| Tune LLM scan prompt | utils/llm_scanner.py |
| Modify MCP server output | builder/mcp_builder.py |
Adjust @tool detection |
builder/parser.py |
toolstore.yamlmanifest support- Public tool submission portal
- Versioned index publication
- Dry-run preview mode
- Build manifest export (cross-build pollution fix)
- Async tool support
- Hardcoded secret detection in AST scanner
- Aliased-import tracking in security scanner
MIT License β Copyright (c) 2025 Sujal Maheshwari
See LICENSE for full terms. Attribution required in public-facing derivative works.
Contributions welcome. Open issues or submit pull requests following the existing module structure.