@askingahuman/mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +96 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/tools/ask-human.d.ts +15 -0
- package/dist/tools/ask-human.js +91 -0
- package/dist/tools/check-answer.d.ts +15 -0
- package/dist/tools/check-answer.js +89 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 askingahuman.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# askingahuman MCP Server
|
|
2
|
+
|
|
3
|
+
Get real human answers from AI agents and LLMs.
|
|
4
|
+
|
|
5
|
+
When your AI doesn't know the answer, needs a judgment call, or wants a second opinion — ask a real human.
|
|
6
|
+
|
|
7
|
+
## What It Does
|
|
8
|
+
|
|
9
|
+
This MCP server connects your AI agent to [askingahuman.com](https://askingahuman.com), where a real person reads your question and writes back a thoughtful, honest answer within 24 hours.
|
|
10
|
+
|
|
11
|
+
**Two tools:**
|
|
12
|
+
- `ask_human` — Submit a question (max 400 chars). Returns a `questionId`.
|
|
13
|
+
- `check_answer` — Poll for the human's response using the `questionId`.
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### 1. Get your free API key
|
|
18
|
+
|
|
19
|
+
Visit [askingahuman.com/developers](https://askingahuman.com/developers) and create a key with your email.
|
|
20
|
+
|
|
21
|
+
### 2. Add to your MCP client
|
|
22
|
+
|
|
23
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"askingahuman": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["-y", "@askingahuman/mcp-server"],
|
|
31
|
+
"env": {
|
|
32
|
+
"ASKINGAHUMAN_API_KEY": "ahk_your_key_here"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Cursor** (Settings > MCP Servers):
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"askingahuman": {
|
|
44
|
+
"command": "npx",
|
|
45
|
+
"args": ["-y", "@askingahuman/mcp-server"],
|
|
46
|
+
"env": {
|
|
47
|
+
"ASKINGAHUMAN_API_KEY": "ahk_your_key_here"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Pricing
|
|
54
|
+
|
|
55
|
+
| Tier | Price | Details |
|
|
56
|
+
|------|-------|---------|
|
|
57
|
+
| Free | $0 | 1 question/month, no credit card needed |
|
|
58
|
+
| Paid | $5/question | After free tier; requires saved payment method |
|
|
59
|
+
|
|
60
|
+
Add a payment method at [askingahuman.com/developers](https://askingahuman.com/developers) to unlock paid questions.
|
|
61
|
+
|
|
62
|
+
## Example
|
|
63
|
+
|
|
64
|
+
An AI agent using this server might:
|
|
65
|
+
|
|
66
|
+
1. Call `ask_human` with: "I'm helping a user choose between React and Vue for a small dashboard project. What would an experienced developer recommend and why?"
|
|
67
|
+
2. Receive a `questionId` back immediately
|
|
68
|
+
3. Periodically call `check_answer` with that ID
|
|
69
|
+
4. Eventually receive a thoughtful, human-written response
|
|
70
|
+
|
|
71
|
+
## REST API
|
|
72
|
+
|
|
73
|
+
You can also use the API directly without the MCP server:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Submit a question
|
|
77
|
+
curl -X POST https://askingahuman.com/api/questions \
|
|
78
|
+
-H "Authorization: Bearer ahk_your_key" \
|
|
79
|
+
-H "Content-Type: application/json" \
|
|
80
|
+
-d '{"questionText": "Your question here"}'
|
|
81
|
+
|
|
82
|
+
# Check for answer
|
|
83
|
+
curl https://askingahuman.com/api/questions/{questionId} \
|
|
84
|
+
-H "Authorization: Bearer ahk_your_key"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Environment Variables
|
|
88
|
+
|
|
89
|
+
| Variable | Required | Description |
|
|
90
|
+
|----------|----------|-------------|
|
|
91
|
+
| `ASKINGAHUMAN_API_KEY` | Yes | Your API key from askingahuman.com/developers |
|
|
92
|
+
| `ASKINGAHUMAN_API_URL` | No | Custom API URL (defaults to production) |
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { askHumanTool, handleAskHuman } from './tools/ask-human.js';
|
|
6
|
+
import { checkAnswerTool, handleCheckAnswer } from './tools/check-answer.js';
|
|
7
|
+
const API_BASE = process.env.ASKINGAHUMAN_API_URL || 'https://askingahuman.com';
|
|
8
|
+
const server = new Server({ name: 'askingahuman', version: '1.0.0' }, { capabilities: { tools: {} } });
|
|
9
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
10
|
+
tools: [askHumanTool, checkAnswerTool]
|
|
11
|
+
}));
|
|
12
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
13
|
+
const apiKey = process.env.ASKINGAHUMAN_API_KEY;
|
|
14
|
+
if (!apiKey) {
|
|
15
|
+
return {
|
|
16
|
+
content: [{
|
|
17
|
+
type: 'text',
|
|
18
|
+
text: 'Error: ASKINGAHUMAN_API_KEY environment variable is required. Get your free key at https://askingahuman.com/developers'
|
|
19
|
+
}],
|
|
20
|
+
isError: true
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
switch (request.params.name) {
|
|
24
|
+
case 'ask_human':
|
|
25
|
+
return handleAskHuman(request.params.arguments, apiKey, API_BASE);
|
|
26
|
+
case 'check_answer':
|
|
27
|
+
return handleCheckAnswer(request.params.arguments, apiKey, API_BASE);
|
|
28
|
+
default:
|
|
29
|
+
return {
|
|
30
|
+
content: [{ type: 'text', text: `Unknown tool: ${request.params.name}` }],
|
|
31
|
+
isError: true
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
async function main() {
|
|
36
|
+
const transport = new StdioServerTransport();
|
|
37
|
+
await server.connect(transport);
|
|
38
|
+
}
|
|
39
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const askHumanTool: Tool;
|
|
3
|
+
export declare function handleAskHuman(args: Record<string, unknown> | undefined, apiKey: string, apiBase: string): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
isError: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
content: {
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
}[];
|
|
14
|
+
isError?: undefined;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export const askHumanTool = {
|
|
2
|
+
name: 'ask_human',
|
|
3
|
+
description: 'Submit a question to a real human at askingahuman.com. ' +
|
|
4
|
+
'The human will read your question and write back a thoughtful answer within 24 hours. ' +
|
|
5
|
+
'First question each month is free; subsequent questions cost $5 (requires saved payment method). ' +
|
|
6
|
+
'Returns a questionId — use check_answer to poll for the response.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
question: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The question to ask the human. Be specific and concise (max 400 characters).',
|
|
13
|
+
maxLength: 400
|
|
14
|
+
},
|
|
15
|
+
contact_email: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'Optional email address to receive a notification when the question is answered.'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
required: ['question']
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export async function handleAskHuman(args, apiKey, apiBase) {
|
|
24
|
+
if (!args?.question || typeof args.question !== 'string') {
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: 'text', text: 'Error: question is required.' }],
|
|
27
|
+
isError: true
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const controller = new AbortController();
|
|
31
|
+
const timeoutId = setTimeout(() => controller.abort(), 30_000);
|
|
32
|
+
try {
|
|
33
|
+
const response = await fetch(`${apiBase}/api/questions`, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
headers: {
|
|
36
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
37
|
+
'Content-Type': 'application/json'
|
|
38
|
+
},
|
|
39
|
+
body: JSON.stringify({
|
|
40
|
+
questionText: args.question,
|
|
41
|
+
contactEmail: typeof args.contact_email === 'string' ? args.contact_email : undefined
|
|
42
|
+
}),
|
|
43
|
+
signal: controller.signal
|
|
44
|
+
});
|
|
45
|
+
const data = await response.json();
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
return {
|
|
48
|
+
content: [{
|
|
49
|
+
type: 'text',
|
|
50
|
+
text: `Error (${response.status}): ${data.error || 'Failed to submit question'}. ` +
|
|
51
|
+
`Manage your key at https://askingahuman.com/developers`
|
|
52
|
+
}],
|
|
53
|
+
isError: true
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const charged = data.charged;
|
|
57
|
+
const chargedAmount = data.chargedAmount;
|
|
58
|
+
return {
|
|
59
|
+
content: [{
|
|
60
|
+
type: 'text',
|
|
61
|
+
text: `Question submitted successfully.\n` +
|
|
62
|
+
`Question ID: ${data.questionId}\n` +
|
|
63
|
+
`Status: ${data.status}\n` +
|
|
64
|
+
`Charged: ${charged ? `$${(chargedAmount / 100).toFixed(2)}` : 'Free (monthly allowance)'}\n\n` +
|
|
65
|
+
`Use check_answer with question_id "${data.questionId}" to poll for the response. ` +
|
|
66
|
+
`Answers typically arrive within 24 hours.`
|
|
67
|
+
}]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
72
|
+
return {
|
|
73
|
+
content: [{
|
|
74
|
+
type: 'text',
|
|
75
|
+
text: 'Request timed out after 30 seconds. The askingahuman.com API may be temporarily unavailable.'
|
|
76
|
+
}],
|
|
77
|
+
isError: true
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
content: [{
|
|
82
|
+
type: 'text',
|
|
83
|
+
text: `Network error: ${err instanceof Error ? err.message : 'Unknown error'}. Check your internet connection.`
|
|
84
|
+
}],
|
|
85
|
+
isError: true
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
clearTimeout(timeoutId);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const checkAnswerTool: Tool;
|
|
3
|
+
export declare function handleCheckAnswer(args: Record<string, unknown> | undefined, apiKey: string, apiBase: string): Promise<{
|
|
4
|
+
content: {
|
|
5
|
+
type: "text";
|
|
6
|
+
text: string;
|
|
7
|
+
}[];
|
|
8
|
+
isError: boolean;
|
|
9
|
+
} | {
|
|
10
|
+
content: {
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
}[];
|
|
14
|
+
isError?: undefined;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
2
|
+
export const checkAnswerTool = {
|
|
3
|
+
name: 'check_answer',
|
|
4
|
+
description: 'Check if a human has answered your question at askingahuman.com. ' +
|
|
5
|
+
'Poll this tool periodically after calling ask_human — recommended interval is every 30 minutes or less. ' +
|
|
6
|
+
'Answers typically arrive within 24 hours. ' +
|
|
7
|
+
'Returns the answer text if ready, or the current status if still pending.',
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
question_id: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
description: 'The questionId returned by ask_human.'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
required: ['question_id']
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export async function handleCheckAnswer(args, apiKey, apiBase) {
|
|
20
|
+
if (!args?.question_id || typeof args.question_id !== 'string') {
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: 'text', text: 'Error: question_id is required.' }],
|
|
23
|
+
isError: true
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (!UUID_REGEX.test(args.question_id)) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: 'text', text: 'Error: question_id must be a valid UUID (e.g., the value returned by ask_human).' }],
|
|
29
|
+
isError: true
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const controller = new AbortController();
|
|
33
|
+
const timeoutId = setTimeout(() => controller.abort(), 30_000);
|
|
34
|
+
try {
|
|
35
|
+
const response = await fetch(`${apiBase}/api/questions/${args.question_id}`, {
|
|
36
|
+
headers: { 'Authorization': `Bearer ${apiKey}` },
|
|
37
|
+
signal: controller.signal
|
|
38
|
+
});
|
|
39
|
+
const data = await response.json();
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
return {
|
|
42
|
+
content: [{
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: `Error (${response.status}): ${data.error || 'Failed to check question'}`
|
|
45
|
+
}],
|
|
46
|
+
isError: true
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (data.status === 'ANSWERED') {
|
|
50
|
+
return {
|
|
51
|
+
content: [{
|
|
52
|
+
type: 'text',
|
|
53
|
+
text: `The human has answered your question.\n\n` +
|
|
54
|
+
`Question: ${data.text}\n\n` +
|
|
55
|
+
`Answer: ${data.answer}\n\n` +
|
|
56
|
+
`Answered at: ${data.answeredAt}`
|
|
57
|
+
}]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
content: [{
|
|
62
|
+
type: 'text',
|
|
63
|
+
text: `Status: ${data.status}. The human has not answered yet. ` +
|
|
64
|
+
`Check back later — answers typically arrive within 24 hours.`
|
|
65
|
+
}]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
if (err instanceof Error && err.name === 'AbortError') {
|
|
70
|
+
return {
|
|
71
|
+
content: [{
|
|
72
|
+
type: 'text',
|
|
73
|
+
text: 'Request timed out after 30 seconds. The askingahuman.com API may be temporarily unavailable.'
|
|
74
|
+
}],
|
|
75
|
+
isError: true
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
content: [{
|
|
80
|
+
type: 'text',
|
|
81
|
+
text: `Network error: ${err instanceof Error ? err.message : 'Unknown error'}`
|
|
82
|
+
}],
|
|
83
|
+
isError: true
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
clearTimeout(timeoutId);
|
|
88
|
+
}
|
|
89
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@askingahuman/mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for askingahuman.com — let AI agents ask real humans for answers",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"askingahuman-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsx src/index.ts",
|
|
13
|
+
"prepublishOnly": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"mcp",
|
|
17
|
+
"model-context-protocol",
|
|
18
|
+
"human",
|
|
19
|
+
"ai",
|
|
20
|
+
"agent",
|
|
21
|
+
"answers",
|
|
22
|
+
"askingahuman"
|
|
23
|
+
],
|
|
24
|
+
"files": [
|
|
25
|
+
"dist/",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typescript": "^5.3.0",
|
|
34
|
+
"@types/node": "^20.0.0",
|
|
35
|
+
"tsx": "^4.0.0"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18.0.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/tz-ship-it/askingahuman.com"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://askingahuman.com/developers",
|
|
48
|
+
"author": {
|
|
49
|
+
"name": "askingahuman.com",
|
|
50
|
+
"url": "https://askingahuman.com"
|
|
51
|
+
},
|
|
52
|
+
"license": "MIT"
|
|
53
|
+
}
|