AI Agent Integration (MCP)
Connect AI agents like Claude, ChatGPT, and custom applications to the GoSmarter API using the Model Context Protocol (MCP) server.
What is MCP?
The Model Context Protocol (MCP) is a standardized way for AI agents to interact with APIs and resources. The GoSmarter MCP server provides:
- API Tools - All GoSmarter API operations available as callable tools
- Documentation Resources - Read-only access to product documentation
- Standardized Protocol - Works with any MCP-compatible AI agent
- Same Authentication - Uses your existing OAuth 2.0 credentials
Quick Start with Claude Desktop
The easiest way to get started is with Claude Desktop:
1. Install Claude Desktop
Download from claude.ai/download
2. Get Your Credentials
You'll need:
- OAuth 2.0 client ID and secret
- API gateway URL
Contact your administrator if you don't have these.
3. Get an Access Token
Code
Save the access_token from the response.
4. Configure Claude Desktop
Edit the Claude Desktop config file:
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Code
5. Restart Claude Desktop
Claude will now have access to all GoSmarter API operations and documentation.
What Can AI Agents Do?
Once connected, AI agents can:
Call API Operations
Code
Access Documentation
Code
Perform Complex Workflows
Code
Available Tools
The MCP server exposes all backend API operations as tools:
User Management
CheckUserSync- Verify user synchronization statusUpdateUser- Update user profile information
Inventory
GetInventory- Retrieve inventory levelsUpdateInventory- Modify inventory quantities
Orders
CreateOrder- Create new customer ordersUpdateOrder- Modify existing ordersGetOrderStatus- Check order status
Scrap Calculation
CalculateScrap- Calculate cutting scrapOptimizePattern- Find optimal cutting patterns
Mill Certificates
UploadCertificate- Upload mill certificateGetCertificate- Retrieve certificate data
[See full list in the API Reference]
Available Documentation Resources
AI agents can read multiple documentation resources including:
- Dashboard usage guide
- FAQ and troubleshooting
- Getting started tutorials
- Glossary of terms
- Inventory management
- Mill certificates handling
- Optimization features
- Order management
- Quick reference guides
- Scrap calculator instructions
- General troubleshooting
Using MCP Programmatically
Python Example
Code
JavaScript Example
Code
MCP Protocol Reference
Request Format
All MCP requests use JSON-RPC 2.0:
Code
Response Format
Code
Error Format
Code
Authentication with MCP
MCP requests use the same OAuth 2.0 authentication as regular API calls:
Code
Important
Always include the Accept: application/json, text/event-stream header. Some MCP servers require this header to process requests correctly.
Token Management for AI Agents
Since tokens expire after 1 hour:
-
For Interactive Use (Claude Desktop):
- Generate a token before starting a session
- Update the config file with the new token when it expires
- Restart Claude Desktop after updating
-
For Programmatic Use:
- Implement automatic token refresh (see Authentication guide)
- Cache tokens and refresh proactively
- Handle 401 errors by refreshing and retrying
Troubleshooting
406 Not Acceptable Error
Cause: Missing or incorrect Accept header
Solution: Always include:
Code
401 Unauthorized
Cause: Token expired or invalid
Solution:
- Generate a new access token
- Update your configuration
- Restart the AI agent/application
Tool Not Found
Cause: Tool name is incorrect
Solution:
- List available tools using
tools/list - Use the exact
namefield from the tool definition - Tool names are case-sensitive
Resource Not Found
Cause: Resource URI is incorrect
Solution:
- List available resources using
resources/list - Use the exact
urifield from the resource definition - URI format is
mcp://resources/docs/{path}
Best Practices
For AI Agents
- List tools first - Let the agent discover available operations
- Provide context - Give the agent relevant documentation resources
- Handle errors gracefully - Implement retry logic for network issues
- Cache tool lists - Don't list tools on every request
For Developers
- Implement token refresh - Automate token renewal
- Log requests - Track API usage and debug issues
- Validate responses - Check for errors before processing results
- Rate limit - Respect API rate limits (1000 req/hour)
Next Steps
- Authentication Guide - Learn about OAuth 2.0 and token management
- API Reference - Explore all available API operations
- Quick Start - Test the API directly before using MCP
Support
- Technical questions: [email protected]
- Report MCP issues: GitHub Issues
- Check service status: status.gosmarter.ai

