@chainlink/mcp-server
Version:
Prototype MCP Server for CLL
160 lines (110 loc) • 6.6 kB
Markdown
# Table of Contents
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [Quick Install](#quick-install)
- [IDE Setup](#ide-setup)
- [Cursor IDE](#cursor-ide)
- [VSCode & Claude Code](#vscode--claude-code)
- [Available Tools](#available-tools)
- [chainlink_developer_assistant](#chainlink_developer_assistant)
- [Usage](#usage)
- [Troubleshooting](#troubleshooting)
- ["No MCP servers configured" Error](#no-mcp-servers-configured-error)
- [Authentication Errors](#authentication-errors)
- [Developing This MCP Server](#developing-this-mcp-server)
- [Support](#support)
- [License](#license)
- [Disclaimer](#disclaimer)
# Chainlink MCP Server
A Model Context Protocol (MCP) server that provides AI-powered access to Chainlink documentation, focusing on CCIP (Cross-Chain Interoperability Protocol) and Data Feeds. Other Chainlink products will follow incrementally.
## Installation
### Prerequisites
- Node.js 18+
- npm or pnpm
- An OpenAI API Key
### Quick Install
The MCP server is available as an npm package and can be used directly with MCP-compatible IDEs. We recommmend installation in the workspace of your project ( eg: in `./.cursor/mcp.json` or in `./.vscode/mcp.json`).
## How It Works
In `Agent` chat mode, your IDE and the Chainlink MCP server may exchange multiple messages to refine responses—depending on your prompt’s detail and task complexity.
For best results, use modern reasoning models in your IDE’s Agent Chat mode, such as GPT-4o.
### API Key Note
If you’re using free API keys, you may encounter 429 (rate limit) errors. This is due to API usage limits from the LLM providers, not the MCP itself.
## IDE Setup
### Cursor IDE
**Cursor IDE**:
Local Project install: add to `<project-root>/.cursor/mcp.json`.
Read about [enabling MCP in Cursor here](https://cursor.com/docs/context/mcp).
```json
{
"mcpServers": {
"chainlink": {
"command": "npx",
"args": ["-y", "@chainlink/mcp-server"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key-here"
}
}
}
}
```
**IMPORTANT**
> ⚠️ Currently it appears Cursor does not support variable expansion or reading from .env files. Which means your `mcp.json` file that contains `env` values **must** be `gitignore`d.
### VSCode & Claude Code
**VSCode**: Add to your Workspace VSCode MCP configuration
Local Project install: add to `<project-root>/.vscode/mcp.json`.
**Note:** that (presently) VSCode supports a more secure way of taking user input for env vars. See the below example where VSCode requests the user for the `openAiApiKey` by using the configuration in the `inputs` key. Note further that VSCode typically shows a dialog box on top of the screen to take user input in this case (once per chat session).
Read about [enabling MCP in VSCode here](https://code.visualstudio.com/docs/copilot/customization/mcp-servers).
**Claude Code** supports variable expansion directly without the need if an `inputs` field.
```json
{
"servers": {
"chainlink": {
"command": "npx",
"args": ["-y", "@chainlink/mcp-server"],
"env": {
"OPENAI_API_KEY": "your-openai-api-key-here"
}
"type": "stdio"
}
},
"inputs": [
{
"id": "openAiApiKey",
"type": "promptString",
"description": "Enter your OpenAI API key",
"password": true
}
]
}
```
## Available Tools
### `chainlink_developer_assistant`
Comprehensive Chainlink developer assistant that handles any type of developer query spanning code examples, configurations, and concepts. Provides access to:
- **Fetched API Data**: CCIP chain configurations and supported tokens (fallback data source)
- **Documentation Search**: Semantic search across Chainlink documentation
- **Code Examples**: Smart Solidity contract examples and implementation patterns
- **Configuration Help**: Network configurations, contract addresses, and deployment guidance
- **Best Practices**: Security recommendations and development patterns
**Example Queries:**
- "How do I send a cross-chain message using CCIP?"
- "What are the supported chains for CCIP?"
- "Show me a complete CCIP contract example"
- "Help me configure CCIP token transfers"
## Usage
Once configured in your IDE, you can ask questions about Chainlink development directly in your chat interface. The MCP server will automatically provide relevant documentation, code examples, and configuration data.
**⚠️Important⚠️**: Use effective <a href="https://www.youtube.com/watch?v=2YCaBqP8muw" target="_blank">Prompting techniques and best practices</a> to get the assistant to answer your questions effectively.
## Troubleshooting
### "No MCP servers configured" Error
Make sure your `mcp.json` file is in the correct location and properly formatted:
See the [IDE Setup section.](#ide-setup)
### Authentication Errors
Verify your OpenAI API key is correctly set in your IDE's MCP configuration.
## Developing This MCP Server
See [DEVELOPMENT.md](./DEVELOPMENT.md) for instructions to develop this MCP Server.
## Support
- **Issues**: Report bugs on [GitHub Issues](https://github.com/smartcontractkit/mcp-server/issues).
- **Questions**: We monitor Stack Overflow (for questions tagged with `chainlink`. You can also get support in the [official Chainlink Discord.](https://discord.com/invite/chainlink)
## License
MIT License - see [LICENSE](./LICENSE) for details.
## Disclaimer
The Chainlink MCP Server (npm package @chainlink/mcp-server) is in the “Early Access” stage of development, which means that it currently has functionality which is under development and may be changed in later versions. There is no guarantee any of the contemplated features of the MCP Server will be implemented as specified. The MCP Server is provided on an “AS IS” and “AS AVAILABLE” basis without any representations, warranties, covenants, or conditions of any kind. Use at your own risk. Users remain fully responsible for reviewing, auditing, and deploying any code or contracts. Do not use the code in this example in a production environment without completing your own audits and application of best practices, including compliance with applicable licenses governing any code used. Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node operators are responsible for unintended outputs that are generated due to errors in code. Please review the Chainlink Terms of Service which provides important information and disclosures. By using the MCP Server, you expressly acknowledge and agree to accept these terms.