Skip to content

Commit e3a1c3e

Browse files
Merge pull request #10 from PaystackOSS/chore-public-preview
Chore public preview
2 parents 25aa2c7 + 8ffaca9 commit e3a1c3e

8 files changed

Lines changed: 155 additions & 186 deletions

File tree

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
PAYSTACK_BASE_URL="https://api.paystack.co"
2-
USER_AGENT="paystack-mcp/1.0"
31
PAYSTACK_TEST_SECRET_KEY="sk_secret_key_here"
File renamed without changes.
File renamed without changes.

README.md

Lines changed: 152 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,172 @@
11
# Paystack MCP Server
22

3-
This project implements a server for Paystack's [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server.
3+
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that enables AI assistants to interact with the full range of [Paystack APIs](https://paystack.com/docs/api/).
44

5+
> [!WARNING]
6+
> **Public Preview:** This MCP server is currently in public preview. We're seeking early feedback to improve the next iteration, so use cautiously and report any issues you encounter.
7+
8+
## Quick Start
9+
10+
Clone the repo and build locally:
11+
12+
```bash
13+
git clone https://github.com/PaystackOSS/paystack-mcp-server.git
14+
cd paystack-mcp-server
15+
npm install
16+
npm run build
17+
```
18+
19+
Then configure your MCP client to use the built server (see [Client Integration](#client-integration)).
520

621
## Requirements
722

8-
- Node.js (v14+ recommended)
23+
- Node.js v18+
924
- npm or yarn
25+
- A Paystack test secret key (starts with `sk_test_`)
26+
27+
## Configuration Options
28+
29+
| Environment Variable | Purpose |
30+
| -------------------------- | ------------------------------------------------------ |
31+
| `PAYSTACK_TEST_SECRET_KEY` | Your Paystack test secret key **(required)** |
32+
33+
> **Security note:** Only test keys (`sk_test_*`) are allowed. The server validates this at startup and will reject live keys.
34+
35+
## Client Integration
36+
37+
The Paystack MCP Server works with any MCP-compatible client. Below is the standard configuration schema used by most clients (Claude Desktop, ChatGPT Desktop, Cursor, Windsurf, etc.).
38+
39+
### Using a local build
40+
41+
If you've cloned and built the server locally:
42+
43+
```json
44+
{
45+
"mcpServers": {
46+
"paystack": {
47+
"command": "node",
48+
"args": ["/path/to/paystack-mcp-server/build/index.js"],
49+
"env": {
50+
"PAYSTACK_TEST_SECRET_KEY": "sk_test_..."
51+
}
52+
}
53+
}
54+
}
55+
```
56+
57+
> [!IMPORTANT]
58+
> When setting `command: "node"`, you should ensure you're using Node v18+. If you are using a package manager, you might need to get the path of your Node binary by running this command in your CLI:
59+
>
60+
> ### Linux and MacOS
61+
>
62+
> ```sh
63+
> which node
64+
> ```
65+
>
66+
> ### Windows
67+
>
68+
> ```sh
69+
> where node
70+
> ```
71+
>
72+
> Once you have the path, use it as the value of the MCP Server command in the JSON configuration. e.g., `command: "path/to/installation/bin/node"`
73+
74+
### Where to add this configuration
75+
76+
| Client | Config file location |
77+
| --------------- | ------------------------------------------------- |
78+
| VS Code | `.vscode/mcp.json` |
79+
| Claude Desktop | `claude_desktop_config.json` |
80+
| ChatGPT Desktop | MCP settings in app preferences |
81+
| Cursor | `.cursor/mcp.json` or global MCP settings |
82+
| Windsurf | MCP configuration in settings |
83+
| Claude Code | `~/.claude/mcp.json` or project-level `.mcp.json` |
84+
85+
## How It Works
86+
87+
The Paystack MCP Server exposes the **entire Paystack API** to AI assistants by parsing Paystack's OpenAPI specification at runtime. Instead of hardcoding individual endpoints, the server dynamically discovers all available operations and makes them accessible through a small set of tools.
88+
89+
### Available Tools
90+
91+
| Tool | Description |
92+
| ------------------------ | ------------------------------------------------------------------ |
93+
| `get_paystack_operation` | Fetch operation details (method, path, parameters) by operation ID |
94+
| `get_paystack_operation_guided` | Infers the operation ID from prompt |
95+
| `make_paystack_request` | Execute a Paystack API request |
1096
11-
## Setup
97+
### Available Resources
1298
13-
1. Clone the repository:
14-
```
15-
git clone https://github.com/yourusername/paystack-mcp-server.git
16-
cd paystack-mcp
17-
```
99+
| Resource | URI | Description |
100+
| ------------------------- | ---------------------------- | -------------------------------------------------------- |
101+
| `paystack_operation_list` | `paystack://operations/list` | List all available Paystack operations and their details |
18102
19-
2. Install dependencies:
20-
```
21-
npm install
22-
```
103+
### Example
23104
24-
3. Configure environment variables:
25-
- Copy `.env.example` to `.env` and update with your Paystack credentials and server settings.
105+
When you ask your AI assistant something like _"Get me the last 5 transactions on my Paystack integration"_, here's what happens behind the scenes:
26106
27-
4. Start the server:
28-
```
29-
npm start
30-
```
107+
1. The assistant calls `get_paystack_operation("transaction_list")` to look up the endpoint details
108+
2. It gets back the method (`GET`), path (`/transaction`), and available query parameters
109+
3. It then calls `make_paystack_request` with `{ method: "GET", path: "/transaction", data: { perPage: 5 } }`
110+
4. You get your transactions
111+
112+
### Prompt recommendation
113+
114+
To get the best results when using this MCP server, be specific in your prompts and always include "Paystack" in your requests. This helps the LLM quickly identify and use the appropriate Paystack tools.
115+
116+
**Good prompts:**
117+
- "Initialize a Paystack transaction for 50000 NGN"
118+
- "Create a customer with email user@example.com on my Paystack account"
119+
- "How can I send money with the Paystack API?"
120+
121+
**Less effective prompts:**
122+
- "List my transactions" (unclear which service to use)
123+
- "Charge a customer" (missing context about Paystack)
124+
125+
Being explicit ensures the LLM narrows down to the right tool quickly and reduces ambiguity.
126+
127+
## Development
128+
129+
### Run locally (without building)
130+
131+
For local development and testing, you can run the TypeScript source directly:
132+
133+
```bash
134+
PAYSTACK_TEST_SECRET_KEY=sk_test_... npm run dev
135+
```
136+
137+
### Run with MCP Inspector
138+
139+
```bash
140+
npm run inspect
141+
```
142+
143+
### Build
144+
145+
```bash
146+
npm run build
147+
```
148+
149+
### Run tests
150+
151+
```bash
152+
npm test
153+
```
154+
155+
## Troubleshooting
156+
157+
| Issue | Solution |
158+
| -------------------------------- | ------------------------------------------------------------------ |
159+
| Server exits silently at startup | Check that `PAYSTACK_TEST_SECRET_KEY` is set |
160+
| "Invalid key" error | Key must start with `sk_test_` — live keys are not allowed |
161+
| Tools not appearing in client | Ensure the server is running and the client config path is correct |
162+
| Request timeouts | Check network connectivity to `api.paystack.co` |
31163
32164
## Contributing
33165
34166
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
35167
168+
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
169+
36170
## License
37171
38172
MIT

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "paystack-mcp",
3-
"version": "1.0.0",
3+
"version": "0.0.1",
44
"description": "",
55
"bin": {
66
"paystack": "./build/index.js"

readme.md

Lines changed: 0 additions & 163 deletions
This file was deleted.

src/paystack-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { PaystackResponse, PaystackError } from "./types";
22
import { paystackConfig } from "./config";
33

44
const PAYSTACK_BASE_URL = paystackConfig.baseURL;
5-
const USER_AGENT = process.env.USER_AGENT || 'Paystack-MCP-Client';
5+
const USER_AGENT = process.env.USER_AGENT || 'Paystack-MCP-Server/0.0.1';
66

77
class PaystackClient {
88
private baseUrl: string;

src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { registerAllResources } from "./resources";
88
async function createServer() {
99
const server = new McpServer({
1010
name: "paystack",
11-
version: "1.0.0",
11+
version: "0.0.1",
1212
});
1313

1414
const oasPath = path.join(__dirname, "./", "data/paystack.openapi.yaml");

0 commit comments

Comments
 (0)