This project provides a Multi-Component Protocol (MCP) server specifically designed for the Fuel Network and Sway Language ecosystem. It allows IDEs (like VS Code with the appropriate extension) to connect and seamlessly interact with Fuel documentation, enabling easier searching, understanding, and development within Fuel projects.
This server indexes Fuel and Sway documentation (including markdown files) into a Qdrant vector database using open-source embeddings (via Transformers.js). This allows for powerful semantic search capabilities directly within the development environment.
# Git clone the repo
git clone --depth 1 https://github.com/FuelLabs/fuel-mcp-server
# Docker compose
docker compose -f fuel-mcp-server/docker-compose.yml up -d
# Copy this
realpath fuel-mcp-server
Edit your Cursor mcp.json
{
"mcpServers": {
"fuel-sever": {
"command": "docker",
"args": [
"compose",
"-f { replace w/ real path to fuel-mcp-server }/docker-compose.yml",
"exec",
"-T mcp-server bun run mcp-server"
]
}
}
}
.
├── docs/ # Directory containing sample markdown files
│ └── fuel-docs.md # Example doc
├── src/
│ ├── chunker.ts # Logic for splitting markdown into chunks
│ ├── chunker.test.ts # Tests for the chunker
│ ├── indexer.ts # Main script to index docs into QdrantDB
│ ├── indexer.test.ts # Tests for the indexer
│ ├── query.ts # Script to query the QdrantDB collection
│ ├── query.vest.ts # Tests for querying
│ └── mcp-server.ts # MCP server implementation
├── node_modules/ # Project dependencies
├── qdrant_storage/ # Local Qdrant data persistence (if using Docker volume)
├── Xenova/ # Cached embedding models
├── .env.example # Example environment variables
├── .gitignore
├── bun.lockb # Bun lockfile
├── package.json
├── tsconfig.json
├── vitest.config.ts # Vitest configuration
└── README.md
# Pull the Qdrant image
docker pull qdrant/qdrant
# Run Qdrant with persistent storage (creates ./qdrant_storage)
docker run -p 6333:6333 -p 6334:6334 \\
-v \"$(pwd)/qdrant_storage:/qdrant/storage:z\" \\
qdrant/qdrant
The scripts assume QdrantDB is accessible at http://localhost:6333
. You can configure this using the QDRANT_URL
environment variable. If your Qdrant instance requires an API key (e.g., Qdrant Cloud), set the QDRANT_API_KEY
environment variable.This project includes a docker-compose.yml
file to easily run both the Qdrant database and the MCP server in containers.
Prerequisites:
Steps:
.env
file: Copy .env.example
to .env
and configure environment variables if needed (e.g., QDRANT_API_KEY
for Qdrant Cloud). Note: QDRANT_URL
is automatically handled by Docker Compose for communication between the server and Qdrant containers. You can add other variables needed by the mcp-server
here (like EMBEDDING_MODEL
, QDRANT_COLLECTION
).docker compose up --build -d
--build
: Builds the mcp-server
image based on the Dockerfile
.-d
: Runs the containers in detached mode (in the background).
This command will:qdrant/qdrant
image if not present.mcp-server
image../qdrant_storage
for persistent Qdrant data.mcp-server
container:
# Index files in ./docs using default settings defined in the container
docker compose exec mcp-server-app bun run src/indexer.ts
# Index files specifying arguments (run inside the container)
docker compose exec mcp-server-app bun run src/indexer.ts /app/docs my_collection Xenova/bge-small-en-v1.5
/app/docs
) are relative to the container's filesystem (/app
is the WORKDIR defined in the Dockerfile
). If you need to index files from your host machine, you might need to mount additional volumes in docker-compose.yml
..env
file should be automatically picked up by the mcp-server
container if defined under its environment
section in docker-compose.yml
.docker compose up
command already started the MCP server as defined in the Dockerfile
(CMD ["bun", "run", "mcp-server"]
). It's accessible via docker compose exec
for stdio communication.stdio
command:{
"mcpServers": {
"fuel-sever": {
"command": "docker",
"args": [
"compose",
"-f { replace w/ real path to fuel-mcp-server }/docker-compose.yml",
"exec",
"-T mcp-server bun run mcp-server"
]
}
}
}
{ replace w/ real path to fuel-mcp-server }
with the actual absolute path to your project directory where the docker-compose.yml
file resides.docker-compose.yml
:
docker compose down
To stop without removing:
docker compose stop
bun install
.env
file: Copy .env.example
to .env
and configure QDRANT_URL
and QDRANT_API_KEY
if needed.Add Documents: Place your markdown files (.md
) inside the docs/
directory (or specify a different directory when running the indexer).
Run Tests (Optional):
bun test
Index Documents: Run the indexer script. This will read files from the specified directory (or ./docs
by default), chunk them, generate embeddings using the configured model, and add them to the Qdrant collection.
# Delete the qdrant_storage db
rm -rf qdrant_storage
# Run qdrant locally
docker run -p 6333:6333 -p 6334:6334 -v "$(pwd)/qdrant_storage:/qdrant/storage" qdrant/qdrant
# Index files in ./docs using default settings
bun run index
Script Arguments for Indexer:
docsDir
(optional, positional): Path to the directory containing markdown files (default: ./docs
).collectionName
(optional, positional): Name of the Qdrant collection to use (default: bun_qdrant_docs
).modelName
(optional, positional): Sentence Transformer model from Hugging Face (default: Xenova/all-MiniLM-L6-v2
).targetChunkSize
(optional, positional): Target token size for chunks (default: 2000
).Environment Variables for Indexer:
QDRANT_URL
: URL of your Qdrant instance (default: http://localhost:6333
).QDRANT_API_KEY
: API key for Qdrant (if required).Query Documents: Run the query script with your question as a command-line argument. You must include the --run
flag before your query.
bun run src/query.ts --run \"What is the FuelVM?\"
Environment Variables for Query:
QDRANT_URL
: URL of your Qdrant instance (default: http://localhost:6333
).QDRANT_API_KEY
: API key for Qdrant (if required).QDRANT_COLLECTION
: Specify the collection to query (default: bun_qdrant_docs
). Should match the one used for indexing.EMBEDDING_MODEL
: Specify the embedding model (default: Xenova/all-MiniLM-L6-v2
). Should match the one used for indexing.NUM_RESULTS
: Number of results to retrieve (default: 5
).Example with custom collection and number of results:
QDRANT_COLLECTION=my_qdrant_collection NUM_RESULTS=3 bun run src/query.ts --run \"How do predicates work?\"
This project includes an MCP (Model Context Protocol) server (src/mcp-server.ts
) that exposes the Fuel documentation search functionality as a tool. This allows compatible clients, like Cursor, to connect and use the search capabilities directly within the IDE.
Ensure QdrantDB is running and you have indexed your documents (see steps above).
To start the MCP server, run the following command. Configure environment variables as needed (especially QDRANT_URL
, QDRANT_API_KEY
, QDRANT_COLLECTION
, EMBEDDING_MODEL
if you used non-default values during indexing/querying).
# Example using default settings
bun run mcp-server
# Example with custom settings
QDRANT_URL=http://your-qdrant-host:6333 QDRANT_COLLECTION=my_docs bun run mcp-server
The server will connect via standard input/output (stdio) and wait for a client to connect.
src/chunker.ts
): Splits markdown by code blocks (\`\`\`) first. Text sections are then further split by paragraphs (\\n\\n
) aiming for the target token size.src/indexer.ts
): Reads markdown, chunks content, generates embeddings using Transformers.js, and upserts points (vector + payload) into a specified Qdrant collection. Uses batching for efficiency.src/query.ts
): Takes a text query, generates its embedding, and performs a similarity search against the Qdrant collection to retrieve the most relevant document chunks.src/mcp-server.ts
): Implements the MCP protocol, listening on stdio. Exposes the queryDocs
functionality as an MCP tool, handling request/response cycles with the client (e.g., Cursor).Xenova/all-MiniLM-L6-v2
) via the Transformers.js library to create vector representations of text chunks.
{
"mcpServers": {
"fuel-sever": {
"env": {},
"args": [
"compose",
"-f /path/to/real/fuel-mcp-server/docker-compose.yml",
"exec",
"-T",
"mcp-server",
"bun",
"run",
"mcp-server"
],
"command": "docker"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.