SDK MCP Server

The Datafye SDK MCP Server runs on your local development machine and provides AI agents with deep knowledge about how to develop algos using the Datafye SDK, enabling conversational "vibe coding" workflows.

What It Does

The SDK MCP Server acts as an expert assistant for Datafye SDK development, giving your AI tool comprehensive knowledge about:

  • SDK API Reference - All SDK classes, methods, and their signatures

  • Code Patterns - Best practices for common algo development tasks

  • Examples - Working code snippets for typical use cases

  • SDK Capabilities - What's possible with the Datafye SDK

  • Language-Specific Guidance - Python and Java SDK specifics

Where It Runs

The SDK MCP Server runs on your local development machine, independently of any Datafye deployment.

Available in: All scenarios - works regardless of how you're deploying Datafye:

  • ✅ Foundry: Data Cloud Only

  • ✅ Foundry: Full Stack

  • ✅ Trading: Data Cloud + Broker

  • ✅ Trading: Full Stack

  • ✅ Even without any deployment (for learning)

How It Works

  1. You ask your AI tool how to accomplish something with the SDK (e.g., "How do I subscribe to OHLC bars?")

  2. Your AI tool queries the local SDK MCP Server via MCP protocol

  3. The SDK MCP Server provides API documentation, examples, and best practices

  4. Your AI tool generates appropriate code based on this knowledge

  5. Everything runs locally - no network calls to external services needed

What It Provides

SDK API Knowledge

The SDK MCP Server has comprehensive knowledge of the Datafye SDK:

Method Discovery:

You: "What SDK methods are available for subscribing to market data?"

AI Assistant (via SDK MCP): "The SDK provides several subscription methods:

  • subscribe_bars(symbol, interval) - Subscribe to OHLC bars

  • subscribe_quotes(symbol) - Subscribe to real-time quotes

  • subscribe_trades(symbol) - Subscribe to trade updates

  • subscribe_aggregate(aggregate_id) - Subscribe to custom aggregates Let me show you examples..."

Parameter Details:

You: "What parameters does the order placement method accept?"

AI Assistant: "The place_order() method accepts:

  • symbol (str): The ticker symbol

  • side (OrderSide): BUY or SELL

  • quantity (int): Number of shares

  • order_type (OrderType): MARKET, LIMIT, STOP, etc.

  • price (float, optional): Required for LIMIT orders

  • time_in_force (TimeInForce, optional): DAY, GTC, IOC, FOK Here's an example..."

Code Generation

The SDK MCP Server helps generate correct SDK code:

Strategy Patterns:

You: "I need to buy AAPL when the 20-period EMA crosses above the 50-period EMA. How do I write that with the SDK?"

AI Assistant: "Here's how to implement an EMA crossover strategy using the Datafye SDK:

This subscribes to both EMAs from your data descriptor and detects the crossover..."

Event Handlers:

You: "How do I handle order fill notifications?"

AI Assistant: "Override the on_order_filled() event handler:

You can also use on_order_partially_filled() and on_order_rejected() for other order states..."

Best Practices

The SDK MCP Server teaches SDK best practices:

Error Handling:

You: "How should I handle errors when placing orders?"

AI Assistant: "The SDK provides exception handling for order operations. Here's the recommended pattern:

Always handle these exceptions to prevent algo crashes..."

State Management:

You: "What's the best way to track positions in my algo?"

AI Assistant: "The SDK maintains position state for you. Access it via:

The SDK automatically updates positions based on fills, so you don't need to manually track them..."

Language-Specific Guidance

The SDK MCP Server understands both Python and Java SDKs:

Python SDK:

You: "Show me how to use the Python SDK to subscribe to bars"

AI Assistant: "In Python, use the subscribe_bars() method:

The Python SDK uses snake_case and Pythonic idioms..."

Java SDK:

You: "Show me the same thing in Java"

AI Assistant: "In Java, use the subscribeBars() method:

The Java SDK follows Java conventions with camelCase..."

Installation and Setup

The SDK MCP Server is a local service that you install and run on your development machine:

Prerequisites:

  • Node.js (for running the MCP server)

  • Any AI tool, agent, or LLM that integrates with MCP servers

Installation:

Running:

Configuration: Configure your AI tool to connect to the local SDK MCP Server endpoint (typically http://localhost:3001).

See the Vibe Coding Algos with AI guide for detailed setup instructions.

Use Cases

Great for:

  • Learning the Datafye SDK as a beginner

  • Getting code suggestions for common patterns

  • Understanding SDK capabilities and methods

  • Writing algos conversationally without constantly referencing docs

  • Discovering best practices for error handling, state management, etc.

  • Switching between Python and Java SDKs

  • Rapid prototyping of new strategy ideas

Not designed for:

The SDK MCP Server is a learning and development tool - it teaches you how to code, but doesn't connect to your deployments.

Integration Options

The SDK MCP Server works with any AI tool, agent, or LLM that integrates with MCP servers, though it's most useful with coding assistants:

Common Integrations:

  • Development IDEs - VS Code, Cursor, IntelliJ IDEA, Replit (with MCP-compatible AI extensions)

  • Standalone AI Tools - Claude (desktop/web with MCP), ChatGPT (if MCP-enabled), Claude Code

  • Other AI Agents - Any LLM or AI agent that supports the MCP protocol

While the SDK MCP Server works with any MCP-compatible tool, it's most valuable when used with coding assistants and development environments that can directly apply the generated code.

Multi-Server Setup:

You can use both the SDK MCP Server and the Environment MCP Server simultaneously:

This gives your AI tool both SDK knowledge AND access to your deployment.

Relationship with Environment MCP Server

The SDK MCP Server complements the Environment MCP Server:

  • SDK MCP Server (local) teaches you how to write algo code

  • Environment MCP Server (deployed) helps you explore and debug your running environment

Use them together for a complete workflow:

  1. Use the SDK MCP Server to learn SDK patterns and write your algo code

  2. Deploy your algo to a Datafye environment

  3. Use the Environment MCP Server to analyze backtest results and explore data

  4. Iterate on your code using insights from both servers

Example Workflows

Learning the SDK

You: "I'm new to Datafye. How do I get started writing a simple momentum strategy?"

AI Assistant (via SDK MCP): "Let's build a simple momentum strategy step by step. First, I'll show you the basic algo structure..."

Building a Complex Strategy

You: "I need a pairs trading strategy that monitors the spread between SPY and QQQ, and trades when the z-score exceeds 2"

AI Assistant: "I'll help you build that. You'll need to:

  1. Subscribe to bars for both symbols

  2. Calculate the rolling spread

  3. Compute the z-score

  4. Trade on threshold crossings Here's the implementation..."

Debugging SDK Usage

You: "I'm getting an error when I try to access bar.volume. Why?"

AI Assistant: "The volume field is only available when you subscribe to bars from the raw trades schema. If you're using OHLC bars from aggregates, volume might not be included. Check your data descriptor configuration. Here's how to verify..."

Next Steps


Last updated: 2025-10-23

Last updated