Swarms MCP Documentation Server
π Swarms MCP Documentation Server
π Description
This program is an Agent Framework Documentation MCP Server built on FastMCP, designed to enable AI agents to efficiently retrieve information from your documentation database. It combines hybrid semantic (vector) and keyword (BM25) search, chunked indexing, and a robust FastMCP tools API for seamless agent integration.
Key Capabilities:
Efficient, chunk-level retrieval using both semantic and keyword search
Agents can query, list, and retrieve documentation using FastMCP tools
Local-first, low-latency design (all data indexed and queried locally)
Automatic reindexing on file changes
Modular: add any repos to
corpora/, support for all major filetypesExtensible: add new tools, retrievers, or corpora as needed
Main modules:
embed_documents.pyβ Loads, chunks, and embeds documentsswarms_server.pyβ Brings up the MCP server and FastMCP tools
π Key Features
Hybrid Retriever π: Combines semantic and keyword search.
Dynamic Markdown Handling π: Smart loader based on file size.
Specialized Loaders βοΈ:
.py,.ipynb,.md,.txt,.yaml,.yml.Chunk and File Summaries π: Displays chunk counts along with file counts.
Live Watchdog π₯: Instantly responds to any changes in
corpora/.User Confirmation for Costs β : Confirms before expensive embeddings.
Healthcheck Endpoint π: Ensure server is ready for use.
Local-First ποΈ: All repos indexed locally without external dependencies.
Safe Deletion Helper π₯: Auto-delete broken/mismatched indexes.
ποΈ Version History
Version | Date | Highlights |
2.2 | 2025β04β25 | Split embed/load from server; full chunk counting in loading summaries |
1.0 | 2025β04β25 | Dynamic Markdown loader, color logs, Healthcheck tool |
0.7 | 2025β04β25 | Specialized file loaders for |
0.5 | 2025β04β10 | OpenAI large model embeddings, extended MCP tools |
0.1 | 2025β04β10 | Initial version with generic loaders |
π Managing Your Corpora (Local Repos)
Because Swarms and other frameworks are very large, full corpora are not pushed to GitHub.
Instead, you clone them manually under corpora/:
# Inside your project folder:
cd corpora/
# Clone useful frameworks:
git clone https://github.com/SwarmsAI/Swarms
git clone https://github.com/SwarmsAI/Swarms-Examples
git clone https://github.com/microsoft/autogen
git clone https://github.com/langchain-ai/langgraph
git clone https://github.com/openai/openai-agent-sdkβ Notes:
Add any repo β public, private, custom.
Build your own custom AI knowledge base locally.
Large repos (>500MB) are fine; all indexing is local.
π Quick Start
# 1. Activate virtual environment
venv\Scripts\Activate.ps1
# 2. Install all dependencies
pip install -r requirements.txt
# 3. Configure OpenAI API Key
echo OPENAI_API_KEY=sk-... > .env
# 4. (Load and embed documents
python embed_documents.py
# 5. Start MCP server
python swarms_server.py
# If no index is found, the server will prompt you to embed documents automatically.βοΈ Configuration
Corpus: Drop repos inside
corpora/Environment Variables:
.envmust containOPENAI_API_KEY
Index File Support:
Both
chroma-collections.parquetandchroma.sqlite3are supported..parquetis preferred if both exist.
Auto-Embedding:
If no index is found, the server will prompt you to embed and index your documents automatically.
Optional:
Disable Chroma compaction if you prefer:
setx CHROMA_COMPACTION_SERVICE__COMPACTOR__DISABLED_COLLECTIONS "swarms_docs"
Command-Line Flags:
--reindexβ trigger a refresh reindex during server run.
π File Watching & Auto Reindexing
The MCP Server watches corpora/ for any file changes:
Any modification, creation, or deletion triggers a live reindex.
No need to restart the server.
π οΈ Available FastMCP Tools
Tool | Description |
| Search relevant documentation chunks |
| List all indexed files |
| Get a specific chunk by path and index |
| Force reindex (full or incremental) |
| Check MCP Server status |
β Troubleshooting
Q: I get 'No valid existing index found' when starting the server.
A: The server will now prompt you to embed and index documents. Accept the prompt to proceed, or run
python embed_documents.pymanually first.
Q: Which index file is used?
A: The server will use
chroma-collections.parquetif available, otherwisechroma.sqlite3.
Q: I want to force a reindex.
A: Run
python swarms_server.py --reindexor use theswarm_docs.reindextool.
π Example Usage
# Search the documentation
result = swarm_docs.search("How do I load a notebook?")
print(result)
# List all available files
files = swarm_docs.list_files()
print(files)
# Get a specific document chunk
chunk = swarm_docs.get_chunk(path="examples/agent.py", chunk_idx=2)
print(chunk["content"])π§° Extending & Rebuilding
Add new docs β drop into
corpora/, then:python swarms_server.py --reindexSchema changes β (e.g. different metadata structure):
python swarms_server.py --reindex --fullAdd new repo β Drop folder under
corpora/, reindex.Recommended for mostly read-only repos:
setx CHROMA_COMPACTION_SERVICE__COMPACTOR__DISABLED_COLLECTIONS "swarms_docs"
π IDE Integration
Plug directly into Windsurf Cascade:
"swarms": {
"command": "C:/β¦/Swarms/venv/Scripts/python.exe",
"args": ["swarms_server.py"]
}Then you can access swarm_docs.* tools from Cascade automations.
π¦ Requirements
π‘ Python 3.11 Environment Required
Create your environment explicitly:
python3.11 -m venv venvThen install with:
pip install -r requirements.txtβ MCP Server Ready
After boot:
Proper loading summaries
Safe confirmation before expensive actions
Auto file watching and reindexing
Windsurf plug-in ready
Full tool coverage
You're good to cascade it! πββοΈ
π Flow Diagram
+------------------+
| π₯οΈ MCP Server |
+------------------+
|
+---------------------------------------------------+
| |
+-------------+ +-----------------+
| π Corpora | | π FastMCP Tools |
| Folder | | (search, list, |
| (markdown, | | get_chunk, etc.) |
| code, etc) | +-----------------+
+-------------+ |
| |
+-----------------+ +----------------+
| π Loaders | | π§ Ensemble |
| (Python, MD, TXT)| | Retriever (BM25|
| Split into Chunks| | + Chroma) |
+-----------------+ +----------------+
| |
+-----------------+ +----------------+
| βοΈ Text Splitter | | π§© Similarity |
| (RecursiveCharacter) | | Search (chunks) |
+-----------------+ +----------------+
| |
+-----------------+ +----------------+
| πΎ Embed chunks | βOpenAI Embedding (small)β> | π’οΈ Chroma Vector |
| via OpenAI API | | DB (Local Store) |
+-----------------+ +----------------+
| |
+-----------------+ +----------------+
| π‘ Reindex Watcher| | π File Watchdog |
| (Auto detect | | (Auto reindex |
| new/modified files| | on file events) |
+-----------------+ +----------------+Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Ransom-Alpha/Swarms_MCPserver'
If you have feedback or need assistance with the MCP directory API, please join our Discord server