forc-mcp
is a modular Model Context Protocol (MCP) server that provides AI assistants and tools with programmatic access to the Sway/Fuel ecosystem.
It exposes functionality from various Forc tools through a standardized MCP interface, enabling seamless integration with AI agents like Claude.
The Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. forc-mcp
implements this protocol using a modular architecture that can expose multiple Forc tools and utilities.
forc-mcp
is designed with extensibility in mind. The server uses a plugin-based architecture where each Forc tool can be wrapped as an MCP module. This allows for:
Build and install forc-mcp
from the Sway repository:
# Install from source
cargo install --path ./forc-plugins/forc-mcp
# Or install all forc tools
cargo install --path ./forc
forc-mcp
supports three transport modes for different integration scenarios:
Standard input/output communication for direct process integration:
forc-mcp stdio
Most efficient for single-session interactions and direct integration with applications.
HTTP server with real-time event streaming:
forc-mcp sse --port 3001
Endpoints:
/sse
- Event stream endpoint /message
- Message sending endpoint Suitable for web-based integrations requiring real-time updates.
Full HTTP-based MCP protocol implementation:
forc-mcp http --port 3001
Endpoints:
/mcp
- Main MCP protocol endpoint Most suitable for distributed systems and web applications.
To integrate forc-mcp
with Claude Code CLI, add the MCP server using one of these transport methods:
# STDIO transport (requires building forc-mcp first)
claude mcp add --transport stdio forc-mcp-stdio ./target/debug/forc-mcp stdio
# HTTP transport
claude mcp add --transport http forc-mcp-http http://localhost:3001/mcp
# HTTP transport with API key authentication
claude mcp add --transport http forc-mcp-http http://localhost:3001/mcp -H "X-Api-Key: mcp_XXXXXX..."
# Server-Sent Events transport
claude mcp add --transport sse forc-mcp-sse http://localhost:3001/sse
For Cursor IDE integration, add the following configuration to your MCP settings file:
{
"mcpServers": {
"forc-mcp": {
"command": "./target/debug/forc-mcp",
"args": ["stdio"],
"transport": "stdio"
}
}
}
{
"mcpServers": {
"forc-mcp-http": {
"url": "http://localhost:3001/mcp",
"transport": "http"
}
}
}
{
"mcpServers": {
"forc-mcp-http": {
"url": "http://localhost:3001/mcp",
"transport": "http",
"headers": {
"X-Api-Key": "mcp_XXXXXX..."
}
}
}
}
{
"mcpServers": {
"forc-mcp-sse": {
"url": "http://localhost:3001/sse",
"transport": "sse"
}
}
}
forc-mcp
is designed to accommodate additional Forc tools as MCP modules. Future modules could include:
The modular architecture allows developers to add new modules by:
McpToolModule
trait for the new tool register_module()
Each module operates independently and can expose its own set of tools, resources, and documentation.
For more detailed examples and advanced usage, see the built-in documentation resources accessible through the MCP tools.