mcp-ai-api-assistant
An intelligent Model Context Protocol (MCP) endpoint utilizing the Claude AI model to facilitate sophisticated API interaction drafting and contextual documentation retrieval. It offers functionalities for translating natural language specifications into executable query formats and sourcing precise documentation details based on user inquiries.
Author

crazyrabbitLTC
Quick Info
Actions
Tags
MCP AI API Interface Agent
This server instance operates under the Model Context Protocol, leveraging the advanced capabilities of Claude AI to provide sophisticated assistance for API operations. It critically examines provided API specifications to power two primary utilities:
- synthesize-call: Converts human-readable requirements into structured API invocation syntax.
- lookup-spec: Retrieves pertinent details from the ingested documentation corpus in response to direct questions.
System Requirements
- Node.js environment, version 18 or newer is mandatory.
- A valid API credential for the Anthropic service (Claude).
Initial Setup Procedure
- Obtain the source code repository via cloning.
-
Install required software packages: bash npm install
-
Establish a configuration file named
.envcontaining your Anthropic access token:
ANTHROPIC_API_KEY=your_secret_token_here
Configuration Steps
Prior to server activation, execute the following compilation and initialization sequence: bash npm run build npm run setup
This sequence achieves several goals:
- Establishes necessary folder structures (docs/ for specifications, prompts/ for instructional texts).
- Populates starter prompt templates.
- Generates an initial synopsis of the service capabilities.
Subsequent actions include:
-
Deposit all relevant API documentation assets (supporting formats:
.txt,.md, and.json) into the designateddocs/directory. -
Optional refinement of internal instructions found within the
prompts/subdirectory: system-prompt.txt: The core directive guiding Claude's overall behavior.tool-metadata.txt: Supplementary context specifically detailing tool functionality.query-metadata.txt: Specific guidance for the query synthesis operation.service-description.txt: The automatically generated overview of service functionality.
Operational Guide
Direct Server Execution
Initiate the service runtime: bash npm start
The service exposes two distinct endpoint functions via the MCP framework:
- synthesize-call: Formulates an API interaction based on a plain-language directive
{ "name": "synthesize-call", "arguments": { "request": "Retrieve the complete record set for accounts established within the preceding seven days" } }
- lookup-spec: Queries the documentation repository for targeted information
{ "name": "lookup-spec", "arguments": { "request": "What is the required procedure for securely authorizing subsequent API transmissions?" } }
Integration with Claude Desktop Application
Incorporate the following configuration stanza into your Claude Desktop settings file:
{ "mcpServers": { "ai-api-tool": { "command": "node", "args": ["/COMPLETE/ABSOLUTE/PATH/TO/mcp-ai-api-assistant/build/index.js"], "env": { "ANTHROPIC_API_KEY": "your_secret_token_here" } } } }
-
Substitute
/COMPLETE/ABSOLUTE/PATH/TO/mcp-ai-api-assistantwith the actual physical location of your server installation. -
Reinitialize the Claude Desktop application.
Internal Layout
. ├── docs/ # API Specification Artifacts ├── prompts/ # Instructional Templates & Context Files │ ├── system-prompt.txt # Primary directive for the AI agent │ ├── tool-metadata.txt # Contextual data for tool definitions │ ├── query-metadata.txt # Contextual data for request formulation │ └── service-description.txt # Dynamically created service summary ├── src/ # Source Code Modules │ ├── index.ts # Primary execution initiator │ ├── server.ts # MCP Listener Implementation │ └── services/ # Core Business Logic │ └── expertService.ts # Interface layer for Claude interactions └── package.json
Development Cycle
-
To compile the source code: bash npm run build
-
The runtime environment is constructed with TypeScript and adheres to a layered, modular design philosophy.
- All interactions involving the Claude service are encapsulated within the ExpertService abstraction.
- Diagnostic messages are routed to standard error (stderr) and prefixed with the tag
[DEBUG].
Debugging Common Issues
Should communication failures occur, systematically review the following:
-
Confirmation that the initialization script was executed successfully: bash npm run setup
-
Validation that all necessary files reside within the
prompts/directory. - Verification of the correct assignment and accessibility of the
ANTHROPIC_API_KEYenvironment variable. - Use of fully qualified, absolute directory references within the Claude Desktop configuration.
- Scrutiny of the diagnostic output stream (stderr) for error markers.
Essential Environmental Variables
ANTHROPIC_API_KEY: Authentication credential for the Anthropic platform (Mandatory)
Licensing
This project is distributed under the MIT License.
