Skip to content

Repository files navigation

SynapticChain MCP Server Banner

SynapticLang MCP Server

The Universal Agentic Interface for THE Language for Bots.

License: MIT Node.js Version TypeScript SynapticChain


🤖 THE Language for Bots

SynapticLang is engineered from the ground up to be THE language for autonomous AI agents and trading bots. Unlike EVM/Solidity—which is riddled with unpredictable runtime reverts, dynamic memory exhaustion, and complex inheritance trees—SynapticLang is statically mapped and fully deterministic. For an AI agent, writing a SynapticLang contract means zero guessing: execution lanes are known at compile-time, there are no unhandled runtime exceptions, and gas costs are 100% fixed before deployment. If it compiles, it runs perfectly.

⚡ What is SynapticChain?

SynapticChain is a next-generation Layer-1 blockchain engineered entirely around a compiler-driven static scheduling paradigm. It is designed from the ground up for extreme throughput and enterprise financial messaging.

Rather than relying on runtime conflict resolution and std::sync::Mutex deadlocks on hot paths, the custom smart-contract language SynapticLang (.syn) enforces explicit compile-time state annotations (#[reads(...)], #[writes(...)]). This allows the network's S=0 parallel execution engine to statically route transactions across 256 completely lock-free concurrent memory lanes.

The Edge:

  • Unrivaled Throughput: Benchmarked at 100,000+ TPS in mainnet configurations using the DAG-Primary multi-proposer SCBFT consensus (ADR-641).
  • Sub-500ms Finality: Instant cross-border settlement speeds backed by robust Byzantine fault tolerance and rotating sequencer accountability.
  • ISO 20022 Native: Built-in financial message primitives bridging standard SWIFT/pacs.008 traffic directly into on-chain SwapEngineV3b ODL pools.
  • Zero-Database Hotpaths: Complete removal of PostgreSQL/Redis bloat on validator nodes, utilizing bare-metal RocksDB/QMDB storage and raw O_DIRECT NVMe paths.
  • Deterministic Disaster Recovery: 100% cryptographic state root parity across snapshot hardlink restores, enabling mesh-wide catastrophic recovery in under 15 seconds (ADR-643).

🌍 The Vision: An Autonomous Ecosystem Hub

The SynapticLang MCP Server is not just a syntax checker—it is the Agentic Control Plane for the SynapticChain ecosystem. While its current capabilities excel at statically analyzing, generating, and compiling 100% bulletproof smart contracts, we are building it to interact with the entire network automatically.

🚀 Upcoming Ecosystem Integrations:

  1. Live Network Telemetry & Execution: Agents will autonomously sign, batch (via syn_sendTransactionBatch), and deploy contracts directly to the African Testnet mesh, seamlessly managing 256-lane nonce distribution (ADR-063).
  2. Explorer & State Firehoses: Deep MCP integration with the explorer-backend-v2 Axum RPC APIs, allowing AI agents to perform live deterministic audits, check ODL pool reserves (/api/pools), and trace historical wallet routes instantly.
  3. Automated SVAH Security Sweeps: Direct hooks into the SynapticChain Vulnerability Agentic Harness (SVAH) to automatically execute Red/Blue/Purple-team security sweeps against generated .syn code before it ever touches a validator.
  4. AgentFi & Tokenomics Operations: Native hooks for AI agents to spin up Polymarket-style prediction markets, Moltbook W3C Identity attestations, and issue $BOTCOIN or Carbon Credit tokens autonomously.

Table of Contents

Features

🚀 Rapid Development

  • Pre-built contract templates for tokens, NFTs, DeFi, governance, and more
  • Interactive contract builder with step-by-step guidance
  • Boilerplate code generation for common patterns

📚 Language Expertise

  • Comprehensive SynapticLang documentation access
  • Syntax and semantic guidance
  • Solidity comparison and migration help

Code Quality

  • Real-time contract validation
  • Best practices enforcement
  • Security vulnerability detection
  • Anti-pattern identification

Gas Optimization

  • Static gas cost analysis
  • Worst-case gas computation
  • Optimization suggestions with estimated savings
  • Gas breakdown by operation type

🧪 Testing Support

  • Unit test generation
  • Property-based test scaffolding
  • Test fixture creation
  • Coverage analysis

🔧 Developer Tools

  • Contract compilation to execution plans
  • Error diagnosis with fix suggestions
  • Documentation generation
  • Code formatting

What is SynapticLang?

SynapticLang is a blockchain-specific programming language for SynapticChain featuring:

  • Static Gas Computation - Gas costs calculated at compile time
  • Explicit State Access - Functions declare reads/writes via annotations
  • Bounded Loops - All loops require #[max_iterations(N)]
  • Parallel Execution - Independent operations can run concurrently
  • Type Safety - Strong typing with Result-based error handling
  • Execution Plans - Compiler generates optimized execution schedules

This MCP server accelerates SynapticLang development by providing AI assistants with deep language knowledge and powerful development tools.

Installation

Prerequisites

  • Node.js 18.0.0 or higher
  • npm (comes with Node.js)
  • An MCP-compatible client (e.g., Claude Desktop, Cline, etc.)

Quick Start

Install via npm (when published):

npm install -g synapticlang-mcp-server

From Source

Clone and build from source:

# Clone the repository
git clone https://github.com/synapticchain/synapticlang-mcp-server.git
cd synapticlang-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Verify installation
npm test

Configuration

Claude Desktop

Add the server to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "synapticlang": {
      "command": "node",
      "args": ["/absolute/path/to/synapticlang-mcp-server/dist/index.js"]
    }
  }
}

If installed globally via npm:

{
  "mcpServers": {
    "synapticlang": {
      "command": "synapticlang-mcp-server"
    }
  }
}

After updating the configuration, restart Claude Desktop.

Other MCP Clients

For other MCP clients (Cline, etc.), refer to their documentation for adding MCP servers. The general pattern is:

{
  "command": "node",
  "args": ["/path/to/synapticlang-mcp-server/dist/index.js"],
  "env": {}
}

Usage

Once configured, the MCP server provides tools that AI assistants can use to help with SynapticLang development. You can interact naturally with your AI assistant, and it will use these tools as needed.

Available Tools

The server exposes 12 powerful tools:

Tool Description
query_language_docs Search SynapticLang documentation by topic
list_templates List available contract templates with filtering
get_template Retrieve and customize a specific template
validate_contract Validate contract code for errors and best practices
analyze_gas Analyze gas costs and suggest optimizations
generate_code Generate boilerplate code for common patterns
compile_contract Compile contracts to execution plans
search_examples Search example contracts by use case or feature
get_example Retrieve a complete example contract
generate_tests Generate unit and property-based tests
diagnose_error Diagnose errors and suggest fixes
generate_documentation Generate documentation from contract code

Tool Examples

Query Language Documentation

Ask your AI assistant:

"How do I declare state variables in SynapticLang?"

The assistant will use query_language_docs to retrieve relevant documentation with examples.

Get a Contract Template

Ask your AI assistant:

"Show me an ERC20 token template"

The assistant will use list_templates and get_template to provide a complete, customizable token contract.

Validate Your Contract

Ask your AI assistant:

"Validate this contract and check for issues"

contract MyToken {
    state balances: Map<Address, u256>;
    
    pub fn transfer(to: Address, amount: u256) {
        self.balances[msg.sender] -= amount;
        self.balances[to] += amount;
    }
}

The assistant will use validate_contract to identify missing annotations, lack of error handling, and other issues.

Analyze Gas Costs

Ask your AI assistant:

"Analyze the gas costs of my contract and suggest optimizations"

The assistant will use analyze_gas to provide detailed gas breakdowns and optimization suggestions.

Generate Code

Ask your AI assistant:

"Generate a pausable pattern for my contract"

The assistant will use generate_code to create the necessary state variables, functions, and annotations.

Get Example Contracts

Ask your AI assistant:

"Show me an example of a staking contract"

The assistant will use search_examples and get_example to provide a complete working example with tests and documentation.

Features Overview

Contract Templates

Access 30+ pre-built templates across multiple categories:

  • Tokens: ERC20, mintable, burnable, pausable, governance tokens
  • NFTs: ERC721, marketplace, staking, royalties
  • DeFi: AMM DEX, lending, staking, yield farming, flash loans
  • Governance: DAO voting, timelock, multi-sig, quadratic voting
  • Escrow: Payment escrow, dispute resolution, milestone payments
  • Gaming: Item ownership, tournaments, loot boxes
  • P2P: Peer payments, reputation systems, marketplaces
  • Business: Supply chain, invoicing, subscriptions, loyalty programs

Each template includes:

  • Complete, compilable contract code
  • Deployment scripts
  • Comprehensive test suites
  • Gas cost estimates
  • Security considerations
  • Usage documentation

Validation Rules

The validator checks for:

  • Syntax Errors: Invalid SynapticLang syntax
  • Annotation Errors: Missing or incorrect function annotations
  • State Access Errors: Undeclared state reads/writes
  • Loop Bound Errors: Missing #[max_iterations] annotations
  • Type Errors: Type mismatches and invalid conversions
  • Gas Inefficiencies: Suboptimal patterns that waste gas
  • Security Issues: Common vulnerabilities
  • Missing Validations: Missing require! statements

Gas Analysis

Detailed gas analysis including:

  • Static gas cost per function
  • Worst-case gas for functions with loops
  • Gas formulas for variable-length inputs
  • Breakdown by operation type (reads: 20 gas, writes: 50 gas, events: 10 gas)
  • Optimization opportunities with estimated savings
  • Comparison with similar contract patterns

Code Generation

Generate boilerplate for:

  • State variable declarations
  • Event definitions
  • Constructor (init) functions
  • Getter and setter functions
  • Access control patterns (owner, roles)
  • Pausable patterns
  • Property-based tests

All generated code includes:

  • Correct function annotations
  • Proper error handling
  • Input validation
  • Event emissions
  • Gas-efficient patterns

Project Structure

synapticlang-mcp-server/
├── src/                    # Source code
│   ├── index.ts           # MCP server entry point
│   ├── tools/             # MCP tool handlers
│   │   ├── documentation.ts
│   │   ├── templates.ts
│   │   ├── validation.ts
│   │   ├── gas-analysis.ts
│   │   ├── code-generation.ts
│   │   ├── compilation.ts
│   │   ├── examples.ts
│   │   ├── testing.ts
│   │   └── documentation-gen.ts
│   ├── services/          # Core business logic
│   │   ├── language.ts
│   │   ├── template.ts
│   │   ├── validator.ts
│   │   ├── gas-analyzer.ts
│   │   ├── code-generator.ts
│   │   └── compiler.ts
│   ├── parser/            # SynapticLang AST parser
│   │   ├── lexer.ts
│   │   ├── parser.ts
│   │   └── ast.ts
│   ├── validation/        # Validation rules engine
│   │   ├── rules/
│   │   └── engine.ts
│   └── utils/             # Utility functions
├── data/                  # Data files
│   ├── language/          # Language documentation
│   │   ├── types.json
│   │   ├── annotations.json
│   │   ├── control-flow.json
│   │   └── ...
│   ├── templates/         # Contract templates
│   │   ├── tokens/
│   │   ├── nfts/
│   │   ├── defi/
│   │   └── ...
│   └── examples/          # Example contracts
│       ├── tokens/
│       ├── nfts/
│       ├── defi/
│       └── ...
├── tests/                 # Test files
├── dist/                  # Build output (generated)
├── package.json           # Node.js package configuration
├── tsconfig.json          # TypeScript configuration
├── vitest.config.ts       # Test configuration
├── DEVELOPMENT.md         # Developer guide
└── README.md              # This file

Development

For detailed development instructions, see DEVELOPMENT.md.

Quick Development Setup

# Install dependencies
npm install

# Run in watch mode (auto-recompile on changes)
npm run dev

# Run tests in watch mode
npm run test:watch

# Type check
npm run typecheck

# Run tests with coverage
npm run test:coverage

Available Scripts

  • npm run build - Compile TypeScript to JavaScript
  • npm run clean - Remove build artifacts
  • npm run dev - Watch mode for development
  • npm run typecheck - Type check without emitting files
  • npm test - Run all tests once
  • npm run test:watch - Run tests in watch mode
  • npm run test:coverage - Run tests with coverage report
  • npm start - Start the MCP server

Testing

The project uses Vitest for testing and targets 80%+ code coverage. Tests are located in the tests/ directory and alongside source files with .test.ts extensions.

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Generate coverage report
npm run test:coverage

Troubleshooting

Server Not Appearing in MCP Client

  1. Check configuration file path: Ensure you're editing the correct config file for your MCP client
  2. Verify absolute path: Use absolute paths in the configuration, not relative paths
  3. Check Node.js version: Ensure Node.js 18+ is installed (node --version)
  4. Rebuild the project: Run npm run build to ensure the dist/ directory exists
  5. Restart the client: Restart your MCP client after configuration changes

Build Errors

# Clean and rebuild
npm run clean
npm install
npm run build

Test Failures

# Run tests with verbose output
npm test -- --reporter=verbose

# Run specific test file
npm test -- path/to/test.test.ts

Runtime Errors

  • "Cannot find module": Ensure you've run npm run build before npm start
  • "Permission denied": Check file permissions on the dist directory
  • Type errors: Run npm run typecheck to see detailed type errors

Getting Help

Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Make your changes
  4. Write tests: Ensure 80%+ coverage for new code
  5. Run quality checks:
    npm run typecheck
    npm test
    npm run test:coverage
  6. Commit your changes: Use clear, descriptive commit messages
  7. Push to your fork: git push origin feature/my-feature
  8. Submit a pull request

Contribution Guidelines

  • Follow the existing code style and conventions
  • Write tests for all new features and bug fixes
  • Update documentation for user-facing changes
  • Ensure all tests pass and coverage meets requirements
  • Add JSDoc comments for public APIs
  • Keep commits focused and atomic

Adding New Templates

  1. Create template JSON in data/templates/[category]/
  2. Include all required fields (code, deployment, tests, documentation)
  3. Test that the template compiles successfully
  4. Add to the template service
  5. Write tests for the template
  6. Update documentation

Adding New Validation Rules

  1. Create rule class in src/validation/rules/
  2. Implement the ValidationRule interface
  3. Add rule to the validation engine
  4. Write comprehensive tests
  5. Document the rule and its suggestions

License

This project is licensed under the MIT License - see the LICENSE file for details.

Resources

Documentation

Related Projects

Community

Support


Built with ❤️ by the SynapticChain Team

About

Standalone SynapticLang MCP Server for AI-assisted smart contract development and full-stack dApp generation on SynapticChain

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages