mcp-server
Skill2 starsChanged 51 days agoMITView on GitHub
Model Context Protocol server development patterns. Use when building custom MCP servers, exposing tools and resources, handling JSON-RPC, implementing credential isolation, or integrating with Claude Desktop, Cursor, or AI agents. Covers @modelcontextprotocol/sdk, StdioServerTransport, tool schemas, and multi-tenant credential patterns.
- Reads credentials
- Sends data out
12 other projects use a version of this.
Adopted by
Most recently taken up by
- justmiles/skillstheir own version, first seen Nov 8, 2026
- DaleStudy/skillstheir own version, first seen Nov 1, 2026
- Happy-Technologies-LLC/happy-platform-skillstheir own version, first seen Nov 1, 2026
- leewang246731-beep/aijiquntheir own version, first seen Oct 25, 2026
- mukco/claude-skillstheir own version, first seen Oct 15, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Oct 13, 2026
Used with
Projects with it also use react.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
VercelSkillreact
React renderer for json-render that turns JSON specs into React components. Use when working with @json-render/react, building React UIs from JSON, creating component catalogs, or rendering AI-generated specs.
Also in 3 projects that use this
Other versions12 projects use a version of this.
Word for word · 1
- revealui-studio/revskills★ 2100% same
Edited · 0
None found.
Wrote their own version · 11
- rrezartprebreza/spring-boot-skills★ 344same name
- Happy-Technologies-LLC/happy-platform-skills★ 41same name
- nimadorostkar/Claude-Skills-collection★ 33same name
- saschb2b/skills★ 22same name
- DaleStudy/skills★ 4same name
- leewang246731-beep/aijiqun★ 4same name
- prizmad/agent-skills★ 2same name
- timsonner/agent-skills★ 2same name
- justmiles/skills★ 1same name
- michaelsvanbeek/personal-agent-skills★ 1same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- skills/revealui-design/CLAUDE.mdCLAUDE.md
- drizzle-dbSkill
- electric-syncSkill
- exhaustive-auditSkill
- grok-bot-checkpointSkill
- knowledge-graphSkill
- multi-agent-memorySkill
- next-best-practicesSkill
- redundancy-scanSkill
- revealui-checkpointSkill
- revealui-cleanupSkill
- coordinateSkill
- revealui-designSkill
- revealui-design-statusSkill
- revealui-doctorSkill
- revealui-opsSkill
- revealui-pickupSkill
- revealui-recoverSkill
- revealui-rollupSkill
- revealui-skills-testSkill
- revealui-snapshotSkill
- revealui-sync-ltsSkill
- revealui-sync-rulesSkill
- revealui-trackerSkill
- revvault-resolveSkill
- security-hardeningSkill
- tailwind-v4Skill
- vitest-testingSkill
- yjs-collaborationSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 212
Always return content array with type: 'text':
- Very specific: line 231
Use descriptive tool names with a namespace prefix (e.g., stripe_, memory_)
- Distinctive: line 232
Keep tool descriptions actionable: what it does, when to use it
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
MCP Server Development
Server Scaffolding
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
type CallToolRequest,
CallToolRequestSchema,
ListToolsRequestSchema,
type Tool,
} from '@modelcontextprotocol/sdk/types.js';
const server = new Server(
{ name: 'my-server', version: '0.1.0' },
{ capabilities: { tools: {} } },
);Tool Definition
Tools use JSON Schema for input validation:
const TOOLS: Tool[] = [
{
name: 'my_tool',
description: 'What this tool does and when to use it.',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: 'Search query' },
limit: { type: 'number', description: 'Max results (default: 10)', default: 10 },
filters: {
type: 'object',
description: 'Optional filters',
properties: {
status: { type: 'string', enum: ['active', 'archived'] },
},
},
},
required: ['query'],
},
},
];
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));Tool Dispatch
server.setRequestHandler(CallToolRequestSchema, async (request: CallToolRequest) => {
const startTime = Date.now();
const toolName = request.params.name;
try {
let data: unknown;
switch (toolName) {
case 'my_tool': {
const { query, limit = 10 } = request.params.arguments as {
query: string;
limit?: number;
};
data = await myApiCall(query, limit);
break;
}
default:
return {
content: [{ type: 'text', text: `Error: Unknown tool: ${toolName}` }],
isError: true,
};
}
return {
content: [{
type: 'text',
text: JSON.stringify({
data,
_meta: {
durationMs: Date.now() - startTime,
server: 'my-server',
tool: toolName,
timestamp: new Date().toISOString(),
},
}, null, 2),
}],
};
} catch (err) {
return {
content: [{
type: 'text',
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
}],
isError: true,
};
}
});Server Startup
async function main() {
const transport = new StdioServerTransport();
await server.connect(transport);
}
main().catch((err) => {
console.error('MCP server error:', err);
process.exit(1);
});Credential Isolation
For multi-tenant servers, use a credential override pattern:
let _credentialOverrides: Record<string, string> = {};
export async function withTenantCredentials<T>(
creds: Record<string, string>,
fn: () => Promise<T>,
): Promise<T> {
_credentialOverrides = { ...creds };
try {
return await fn();
} finally {
_credentialOverrides = {};
}
}
// In tool handler, only the credentials for this invocation are visible.
// A missing withTenantCredentials call must not reuse the previous tenant.
const apiKey = _credentialOverrides.API_KEY ?? process.env.API_KEY;
if (!apiKey) {
return { content: [{ type: 'text', text: 'Error: API_KEY not set' }], isError: true };
}The hypervisor wraps each invocation in withTenantCredentials. The finally clears the override so the next invocation cannot read the previous tenant key.
HTTP API Helper Pattern
function authHeaders(token: string): Record<string, string> {
return {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
'User-Agent': 'MyServer-MCP/0.1.0',
};
}
async function apiPost(path: string, body: Record<string, unknown>): Promise<unknown> {
const { apiUrl, token } = getConfig();
const res = await fetch(`${apiUrl}${path}`, {
method: 'POST',
headers: authHeaders(token),
body: JSON.stringify(body),
});
const data = await res.json();
if (!res.ok) throw new Error(data.error ?? `API error ${res.status}`);
return data;
}Hypervisor Registration
hypervisor.registerServer({
name: 'my-server',
command: 'node',
args: ['dist/servers/my-server.js'],
env: { API_KEY: 'resolved-at-spawn' },
requiredTier: 'pro',
});Claude Desktop Configuration
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["/path/to/dist/servers/my-server.js"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}Response Format
Always return content array with type: 'text':
// Success
return {
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
};
// Error
return {
content: [{ type: 'text', text: `Error: ${message}` }],
isError: true,
};Best Practices
- Validate all inputs before API calls
- Include
_metawith duration, server name, tool name, timestamp - Use descriptive tool names with a namespace prefix (e.g.,
stripe_,memory_) - Keep tool descriptions actionable: what it does, when to use it
- Set
requiredonly for truly required fields; use defaults for optional - Handle timeouts gracefully (AbortController with 10-30s limits)
- Log errors server-side but return clean error messages to clients
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

