A robust Model Context Protocol (MCP) server integration for the DFNS Python SDK. This server allows AI agents (like Gemini or Claude) to interact securely with DFNS digital asset custody services.
The Model Context Protocol (MCP) is an open standard that enables AI models to connect with external tools and data sources. Instead of writing custom integrations for Every AI model, MCP provides a universal interface.
In this project, the MCP server acts as a bridge:
- Gemini/Claude asks to see wallets.
- MCP Server translates this request into a DFNS API call.
- DFNS returns the wallet data.
- MCP Server passes the structured data back to the AI.
- AI explains the results to you in plain English.
- Python 3.10 or higher
- DFNS Organization & Credentials (Get them here)
- Google Gemini API Key (Get one here)
- Clone the repository.
- Initialize the environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt # Or install: mcp dfns-sdk google-genai python-dotenv pydantic
- Configure Environment Variables:
Copy
.env.exampleto.envand fill in your credentials.cp .env.example .env
mcp_server/main.py: The entry point that initializes the high-performanceFastMCPserver.mcp_server/client.py: A secure wrapper that handles DFNS authentication and client initialization.mcp_server/tools/: Contains domain-specific tool definitions (Wallets, Policies).gemini_client.py: A native Python client demonstrating how to use Gemini with this server.
- Wallets: List, create, and get wallet details; list assets and transactions; transfer assets.
- Policies: List and get security policies.
Use the official MCP Inspector to verify tool connectivity without an AI agent:
npx -y @modelcontextprotocol/inspector ./venv/bin/python mcp_server/main.pyThis launches a web interface at http://localhost:6274.
Run the interactive chat script to talk to DFNS using natural language:
./venv/bin/python gemini_client.pyExample Prompts:
- "What are my current DFNS wallets?"
- "Can you list the assets inside wallet [ID]?"
- "Show me my security policies."
- Secrets: Sensitive keys are loaded from
.envand never hardcoded. - Git:
.envis excluded via.gitignore. An.env.exampleis provided for configuration templates. - MPC: DFNS uses Multi-Party Computation to ensure your private keys are never exposed in full.
This project is licensed under the MIT License.